aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/mime.c8
-rw-r--r--src/options.c45
-rw-r--r--src/unixdgram.c2
-rwxr-xr-xsrc/wsocket.c20
4 files changed, 38 insertions, 37 deletions
diff --git a/src/mime.c b/src/mime.c
index 6c210e4..05602f5 100755
--- a/src/mime.c
+++ b/src/mime.c
@@ -27,12 +27,12 @@ static int mime_global_eol(lua_State *L);
27static int mime_global_dot(lua_State *L); 27static int mime_global_dot(lua_State *L);
28 28
29static size_t dot(int c, size_t state, luaL_Buffer *buffer); 29static size_t dot(int c, size_t state, luaL_Buffer *buffer);
30//static void b64setup(UC *base); 30/*static void b64setup(UC *base);*/
31static size_t b64encode(UC c, UC *input, size_t size, luaL_Buffer *buffer); 31static size_t b64encode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
32static size_t b64pad(const UC *input, size_t size, luaL_Buffer *buffer); 32static size_t b64pad(const UC *input, size_t size, luaL_Buffer *buffer);
33static size_t b64decode(UC c, UC *input, size_t size, luaL_Buffer *buffer); 33static size_t b64decode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
34 34
35//static void qpsetup(UC *class, UC *unbase); 35/*static void qpsetup(UC *class, UC *unbase);*/
36static void qpquote(UC c, luaL_Buffer *buffer); 36static void qpquote(UC c, luaL_Buffer *buffer);
37static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer); 37static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
38static size_t qpencode(UC c, UC *input, size_t size, 38static size_t qpencode(UC c, UC *input, size_t size,
@@ -176,8 +176,8 @@ LUASOCKET_API int luaopen_mime_core(lua_State *L)
176 lua_pushstring(L, MIME_VERSION); 176 lua_pushstring(L, MIME_VERSION);
177 lua_rawset(L, -3); 177 lua_rawset(L, -3);
178 /* initialize lookup tables */ 178 /* initialize lookup tables */
179 // qpsetup(qpclass, qpunbase); 179 /*qpsetup(qpclass, qpunbase);*/
180 // b64setup(b64unbase); 180 /*b64setup(b64unbase);*/
181 return 1; 181 return 1;
182} 182}
183 183
diff --git a/src/options.c b/src/options.c
index 06ab58d..2b53c67 100644
--- a/src/options.c
+++ b/src/options.c
@@ -54,7 +54,7 @@ int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps)
54 return opt->func(L, ps); 54 return opt->func(L, ps);
55} 55}
56 56
57// ------------------------------------------------------- 57/*------------------------------------------------------*/
58/* enables reuse of local address */ 58/* enables reuse of local address */
59int opt_set_reuseaddr(lua_State *L, p_socket ps) 59int opt_set_reuseaddr(lua_State *L, p_socket ps)
60{ 60{
@@ -66,7 +66,7 @@ int opt_get_reuseaddr(lua_State *L, p_socket ps)
66 return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEADDR); 66 return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEADDR);
67} 67}
68 68
69// ------------------------------------------------------- 69/*------------------------------------------------------*/
70/* enables reuse of local port */ 70/* enables reuse of local port */
71int opt_set_reuseport(lua_State *L, p_socket ps) 71int opt_set_reuseport(lua_State *L, p_socket ps)
72{ 72{
@@ -78,7 +78,7 @@ int opt_get_reuseport(lua_State *L, p_socket ps)
78 return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEPORT); 78 return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEPORT);
79} 79}
80 80
81// ------------------------------------------------------- 81/*------------------------------------------------------*/
82/* disables the Nagle algorithm */ 82/* disables the Nagle algorithm */
83int opt_set_tcp_nodelay(lua_State *L, p_socket ps) 83int opt_set_tcp_nodelay(lua_State *L, p_socket ps)
84{ 84{
@@ -90,7 +90,7 @@ int opt_get_tcp_nodelay(lua_State *L, p_socket ps)
90 return opt_getboolean(L, ps, IPPROTO_TCP, TCP_NODELAY); 90 return opt_getboolean(L, ps, IPPROTO_TCP, TCP_NODELAY);
91} 91}
92 92
93// ------------------------------------------------------- 93/*------------------------------------------------------*/
94#ifdef TCP_KEEPIDLE 94#ifdef TCP_KEEPIDLE
95 95
96int opt_get_tcp_keepidle(lua_State *L, p_socket ps) 96int opt_get_tcp_keepidle(lua_State *L, p_socket ps)
@@ -105,7 +105,7 @@ int opt_set_tcp_keepidle(lua_State *L, p_socket ps)
105 105
106#endif 106#endif
107 107
108// ------------------------------------------------------- 108/*------------------------------------------------------*/
109#ifdef TCP_KEEPCNT 109#ifdef TCP_KEEPCNT
110 110
111int opt_get_tcp_keepcnt(lua_State *L, p_socket ps) 111int opt_get_tcp_keepcnt(lua_State *L, p_socket ps)
@@ -120,7 +120,7 @@ int opt_set_tcp_keepcnt(lua_State *L, p_socket ps)
120 120
121#endif 121#endif
122 122
123// ------------------------------------------------------- 123/*------------------------------------------------------*/
124#ifdef TCP_KEEPINTVL 124#ifdef TCP_KEEPINTVL
125 125
126int opt_get_tcp_keepintvl(lua_State *L, p_socket ps) 126int opt_get_tcp_keepintvl(lua_State *L, p_socket ps)
@@ -135,7 +135,7 @@ int opt_set_tcp_keepintvl(lua_State *L, p_socket ps)
135 135
136#endif 136#endif
137 137
138// ------------------------------------------------------- 138/*------------------------------------------------------*/
139int opt_set_keepalive(lua_State *L, p_socket ps) 139int opt_set_keepalive(lua_State *L, p_socket ps)
140{ 140{
141 return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE); 141 return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE);
@@ -146,7 +146,7 @@ int opt_get_keepalive(lua_State *L, p_socket ps)
146 return opt_getboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE); 146 return opt_getboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE);
147} 147}
148 148
149// ------------------------------------------------------- 149/*------------------------------------------------------*/
150int opt_set_dontroute(lua_State *L, p_socket ps) 150int opt_set_dontroute(lua_State *L, p_socket ps)
151{ 151{
152 return opt_setboolean(L, ps, SOL_SOCKET, SO_DONTROUTE); 152 return opt_setboolean(L, ps, SOL_SOCKET, SO_DONTROUTE);
@@ -157,7 +157,7 @@ int opt_get_dontroute(lua_State *L, p_socket ps)
157 return opt_getboolean(L, ps, SOL_SOCKET, SO_DONTROUTE); 157 return opt_getboolean(L, ps, SOL_SOCKET, SO_DONTROUTE);
158} 158}
159 159
160// ------------------------------------------------------- 160/*------------------------------------------------------*/
161int opt_set_broadcast(lua_State *L, p_socket ps) 161int opt_set_broadcast(lua_State *L, p_socket ps)
162{ 162{
163 return opt_setboolean(L, ps, SOL_SOCKET, SO_BROADCAST); 163 return opt_setboolean(L, ps, SOL_SOCKET, SO_BROADCAST);
@@ -168,7 +168,7 @@ int opt_get_broadcast(lua_State *L, p_socket ps)
168 return opt_getboolean(L, ps, SOL_SOCKET, SO_BROADCAST); 168 return opt_getboolean(L, ps, SOL_SOCKET, SO_BROADCAST);
169} 169}
170 170
171// ------------------------------------------------------- 171/*------------------------------------------------------*/
172int opt_set_recv_buf_size(lua_State *L, p_socket ps) 172int opt_set_recv_buf_size(lua_State *L, p_socket ps)
173{ 173{
174 return opt_setint(L, ps, SOL_SOCKET, SO_RCVBUF); 174 return opt_setint(L, ps, SOL_SOCKET, SO_RCVBUF);
@@ -179,7 +179,7 @@ int opt_get_recv_buf_size(lua_State *L, p_socket ps)
179 return opt_getint(L, ps, SOL_SOCKET, SO_RCVBUF); 179 return opt_getint(L, ps, SOL_SOCKET, SO_RCVBUF);
180} 180}
181 181
182// ------------------------------------------------------- 182/*------------------------------------------------------*/
183int opt_get_send_buf_size(lua_State *L, p_socket ps) 183int opt_get_send_buf_size(lua_State *L, p_socket ps)
184{ 184{
185 return opt_getint(L, ps, SOL_SOCKET, SO_SNDBUF); 185 return opt_getint(L, ps, SOL_SOCKET, SO_SNDBUF);
@@ -190,7 +190,7 @@ int opt_set_send_buf_size(lua_State *L, p_socket ps)
190 return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF); 190 return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF);
191} 191}
192 192
193// ------------------------------------------------------- 193/*------------------------------------------------------*/
194int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps) 194int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps)
195{ 195{
196 return opt_setint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS); 196 return opt_setint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS);
@@ -201,7 +201,7 @@ int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps)
201 return opt_getint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS); 201 return opt_getint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS);
202} 202}
203 203
204// ------------------------------------------------------- 204/*------------------------------------------------------*/
205int opt_set_ip6_multicast_hops(lua_State *L, p_socket ps) 205int opt_set_ip6_multicast_hops(lua_State *L, p_socket ps)
206{ 206{
207 return opt_setint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS); 207 return opt_setint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS);
@@ -212,7 +212,7 @@ int opt_get_ip6_multicast_hops(lua_State *L, p_socket ps)
212 return opt_getint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS); 212 return opt_getint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS);
213} 213}
214 214
215// ------------------------------------------------------- 215/*------------------------------------------------------*/
216int opt_set_ip_multicast_loop(lua_State *L, p_socket ps) 216int opt_set_ip_multicast_loop(lua_State *L, p_socket ps)
217{ 217{
218 return opt_setboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP); 218 return opt_setboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP);
@@ -223,7 +223,7 @@ int opt_get_ip_multicast_loop(lua_State *L, p_socket ps)
223 return opt_getboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP); 223 return opt_getboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP);
224} 224}
225 225
226// ------------------------------------------------------- 226/*------------------------------------------------------*/
227int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps) 227int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps)
228{ 228{
229 return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP); 229 return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP);
@@ -234,7 +234,7 @@ int opt_get_ip6_multicast_loop(lua_State *L, p_socket ps)
234 return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP); 234 return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP);
235} 235}
236 236
237// ------------------------------------------------------- 237/*------------------------------------------------------*/
238int opt_set_linger(lua_State *L, p_socket ps) 238int opt_set_linger(lua_State *L, p_socket ps)
239{ 239{
240 struct linger li; /* obj, name, table */ 240 struct linger li; /* obj, name, table */
@@ -267,13 +267,13 @@ int opt_get_linger(lua_State *L, p_socket ps)
267 return 1; 267 return 1;
268} 268}
269 269
270// ------------------------------------------------------- 270/*------------------------------------------------------*/
271int opt_set_ip_multicast_ttl(lua_State *L, p_socket ps) 271int opt_set_ip_multicast_ttl(lua_State *L, p_socket ps)
272{ 272{
273 return opt_setint(L, ps, IPPROTO_IP, IP_MULTICAST_TTL); 273 return opt_setint(L, ps, IPPROTO_IP, IP_MULTICAST_TTL);
274} 274}
275 275
276// ------------------------------------------------------- 276/*------------------------------------------------------*/
277int opt_set_ip_multicast_if(lua_State *L, p_socket ps) 277int opt_set_ip_multicast_if(lua_State *L, p_socket ps)
278{ 278{
279 const char *address = luaL_checkstring(L, 3); /* obj, name, ip */ 279 const char *address = luaL_checkstring(L, 3); /* obj, name, ip */
@@ -298,7 +298,7 @@ int opt_get_ip_multicast_if(lua_State *L, p_socket ps)
298 return 1; 298 return 1;
299} 299}
300 300
301// ------------------------------------------------------- 301/*------------------------------------------------------*/
302int opt_set_ip_add_membership(lua_State *L, p_socket ps) 302int opt_set_ip_add_membership(lua_State *L, p_socket ps)
303{ 303{
304 return opt_setmembership(L, ps, IPPROTO_IP, IP_ADD_MEMBERSHIP); 304 return opt_setmembership(L, ps, IPPROTO_IP, IP_ADD_MEMBERSHIP);
@@ -309,7 +309,7 @@ int opt_set_ip_drop_membersip(lua_State *L, p_socket ps)
309 return opt_setmembership(L, ps, IPPROTO_IP, IP_DROP_MEMBERSHIP); 309 return opt_setmembership(L, ps, IPPROTO_IP, IP_DROP_MEMBERSHIP);
310} 310}
311 311
312// ------------------------------------------------------- 312/*------------------------------------------------------*/
313int opt_set_ip6_add_membership(lua_State *L, p_socket ps) 313int opt_set_ip6_add_membership(lua_State *L, p_socket ps)
314{ 314{
315 return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP); 315 return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP);
@@ -319,7 +319,8 @@ int opt_set_ip6_drop_membersip(lua_State *L, p_socket ps)
319{ 319{
320 return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP); 320 return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP);
321} 321}
322// ------------------------------------------------------- 322
323/*------------------------------------------------------*/
323int opt_get_ip6_v6only(lua_State *L, p_socket ps) 324int opt_get_ip6_v6only(lua_State *L, p_socket ps)
324{ 325{
325 return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY); 326 return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY);
@@ -330,7 +331,7 @@ int opt_set_ip6_v6only(lua_State *L, p_socket ps)
330 return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY); 331 return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY);
331} 332}
332 333
333// ------------------------------------------------------- 334/*------------------------------------------------------*/
334int opt_get_error(lua_State *L, p_socket ps) 335int opt_get_error(lua_State *L, p_socket ps)
335{ 336{
336 int val = 0; 337 int val = 0;
diff --git a/src/unixdgram.c b/src/unixdgram.c
index 3ac3c5e..69093d7 100644
--- a/src/unixdgram.c
+++ b/src/unixdgram.c
@@ -16,7 +16,7 @@
16 16
17#define UNIXDGRAM_DATAGRAMSIZE 8192 17#define UNIXDGRAM_DATAGRAMSIZE 8192
18 18
19// provide a SUN_LEN macro if sys/un.h doesn't (e.g. Android) 19/* provide a SUN_LEN macro if sys/un.h doesn't (e.g. Android) */
20#ifndef SUN_LEN 20#ifndef SUN_LEN
21#define SUN_LEN(ptr) \ 21#define SUN_LEN(ptr) \
22 ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ 22 ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
diff --git a/src/wsocket.c b/src/wsocket.c
index 20da330..7cd4115 100755
--- a/src/wsocket.c
+++ b/src/wsocket.c
@@ -360,7 +360,7 @@ const char *socket_ioerror(p_socket ps, int err) {
360static const char *wstrerror(int err) { 360static const char *wstrerror(int err) {
361 switch (err) { 361 switch (err) {
362 case WSAEINTR: return "Interrupted function call"; 362 case WSAEINTR: return "Interrupted function call";
363 case WSAEACCES: return PIE_ACCESS; // "Permission denied"; 363 case WSAEACCES: return PIE_ACCESS; /* "Permission denied"; */
364 case WSAEFAULT: return "Bad address"; 364 case WSAEFAULT: return "Bad address";
365 case WSAEINVAL: return "Invalid argument"; 365 case WSAEINVAL: return "Invalid argument";
366 case WSAEMFILE: return "Too many open files"; 366 case WSAEMFILE: return "Too many open files";
@@ -373,23 +373,23 @@ static const char *wstrerror(int err) {
373 case WSAEPROTOTYPE: return "Protocol wrong type for socket"; 373 case WSAEPROTOTYPE: return "Protocol wrong type for socket";
374 case WSAENOPROTOOPT: return "Bad protocol option"; 374 case WSAENOPROTOOPT: return "Bad protocol option";
375 case WSAEPROTONOSUPPORT: return "Protocol not supported"; 375 case WSAEPROTONOSUPPORT: return "Protocol not supported";
376 case WSAESOCKTNOSUPPORT: return PIE_SOCKTYPE; // "Socket type not supported"; 376 case WSAESOCKTNOSUPPORT: return PIE_SOCKTYPE; /* "Socket type not supported"; */
377 case WSAEOPNOTSUPP: return "Operation not supported"; 377 case WSAEOPNOTSUPP: return "Operation not supported";
378 case WSAEPFNOSUPPORT: return "Protocol family not supported"; 378 case WSAEPFNOSUPPORT: return "Protocol family not supported";
379 case WSAEAFNOSUPPORT: return PIE_FAMILY; // "Address family not supported by protocol family"; 379 case WSAEAFNOSUPPORT: return PIE_FAMILY; /* "Address family not supported by protocol family"; */
380 case WSAEADDRINUSE: return PIE_ADDRINUSE; // "Address already in use"; 380 case WSAEADDRINUSE: return PIE_ADDRINUSE; /* "Address already in use"; */
381 case WSAEADDRNOTAVAIL: return "Cannot assign requested address"; 381 case WSAEADDRNOTAVAIL: return "Cannot assign requested address";
382 case WSAENETDOWN: return "Network is down"; 382 case WSAENETDOWN: return "Network is down";
383 case WSAENETUNREACH: return "Network is unreachable"; 383 case WSAENETUNREACH: return "Network is unreachable";
384 case WSAENETRESET: return "Network dropped connection on reset"; 384 case WSAENETRESET: return "Network dropped connection on reset";
385 case WSAECONNABORTED: return "Software caused connection abort"; 385 case WSAECONNABORTED: return "Software caused connection abort";
386 case WSAECONNRESET: return PIE_CONNRESET; // "Connection reset by peer"; 386 case WSAECONNRESET: return PIE_CONNRESET; /* "Connection reset by peer"; */
387 case WSAENOBUFS: return "No buffer space available"; 387 case WSAENOBUFS: return "No buffer space available";
388 case WSAEISCONN: return PIE_ISCONN; // "Socket is already connected"; 388 case WSAEISCONN: return PIE_ISCONN; /* "Socket is already connected"; */
389 case WSAENOTCONN: return "Socket is not connected"; 389 case WSAENOTCONN: return "Socket is not connected";
390 case WSAESHUTDOWN: return "Cannot send after socket shutdown"; 390 case WSAESHUTDOWN: return "Cannot send after socket shutdown";
391 case WSAETIMEDOUT: return PIE_TIMEDOUT; // "Connection timed out"; 391 case WSAETIMEDOUT: return PIE_TIMEDOUT; /* "Connection timed out"; */
392 case WSAECONNREFUSED: return PIE_CONNREFUSED; // "Connection refused"; 392 case WSAECONNREFUSED: return PIE_CONNREFUSED; /* "Connection refused"; */
393 case WSAEHOSTDOWN: return "Host is down"; 393 case WSAEHOSTDOWN: return "Host is down";
394 case WSAEHOSTUNREACH: return "No route to host"; 394 case WSAEHOSTUNREACH: return "No route to host";
395 case WSAEPROCLIM: return "Too many processes"; 395 case WSAEPROCLIM: return "Too many processes";
@@ -398,9 +398,9 @@ static const char *wstrerror(int err) {
398 case WSANOTINITIALISED: 398 case WSANOTINITIALISED:
399 return "Successful WSAStartup not yet performed"; 399 return "Successful WSAStartup not yet performed";
400 case WSAEDISCON: return "Graceful shutdown in progress"; 400 case WSAEDISCON: return "Graceful shutdown in progress";
401 case WSAHOST_NOT_FOUND: return PIE_HOST_NOT_FOUND; // "Host not found"; 401 case WSAHOST_NOT_FOUND: return PIE_HOST_NOT_FOUND; /* "Host not found"; */
402 case WSATRY_AGAIN: return "Nonauthoritative host not found"; 402 case WSATRY_AGAIN: return "Nonauthoritative host not found";
403 case WSANO_RECOVERY: return PIE_FAIL; // "Nonrecoverable name lookup error"; 403 case WSANO_RECOVERY: return PIE_FAIL; /* "Nonrecoverable name lookup error"; */
404 case WSANO_DATA: return "Valid name, no data record of requested type"; 404 case WSANO_DATA: return "Valid name, no data record of requested type";
405 default: return "Unknown error"; 405 default: return "Unknown error";
406 } 406 }