diff options
author | Diego Nehab <diego.nehab@gmail.com> | 2015-10-05 11:47:51 +0800 |
---|---|---|
committer | Diego Nehab <diego.nehab@gmail.com> | 2015-10-05 11:47:51 +0800 |
commit | fd729b32a8966291f007567f72f3dc0158bdab35 (patch) | |
tree | 46737842ba3f9a5aaa2325a76724f12fbc53353e /src/udp.h | |
parent | d1ec29be7f982db75864155dd61a058902e1cae2 (diff) | |
download | luasocket-fd729b32a8966291f007567f72f3dc0158bdab35.tar.gz luasocket-fd729b32a8966291f007567f72f3dc0158bdab35.tar.bz2 luasocket-fd729b32a8966291f007567f72f3dc0158bdab35.zip |
Added support for arbitrary datagram sizes.
The maximum size is still constant per UDP object, but the
size can be speficied at creation time.
Diffstat (limited to 'src/udp.h')
-rw-r--r-- | src/udp.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -8,7 +8,7 @@ | |||
8 | * (AF_INET, SOCK_DGRAM). | 8 | * (AF_INET, SOCK_DGRAM). |
9 | * | 9 | * |
10 | * Two classes are defined: connected and unconnected. UDP objects are | 10 | * Two classes are defined: connected and unconnected. UDP objects are |
11 | * originally unconnected. They can be "connected" to a given address | 11 | * originally unconnected. They can be "connected" to a given address |
12 | * with a call to the setpeername function. The same function can be used to | 12 | * with a call to the setpeername function. The same function can be used to |
13 | * break the connection. | 13 | * break the connection. |
14 | \*=========================================================================*/ | 14 | \*=========================================================================*/ |
@@ -17,13 +17,14 @@ | |||
17 | #include "timeout.h" | 17 | #include "timeout.h" |
18 | #include "socket.h" | 18 | #include "socket.h" |
19 | 19 | ||
20 | /* can't be larger than wsocket.c MAXCHUNK!!! */ | ||
21 | #define UDP_DATAGRAMSIZE 8192 | 20 | #define UDP_DATAGRAMSIZE 8192 |
22 | 21 | ||
23 | typedef struct t_udp_ { | 22 | typedef struct t_udp_ { |
24 | t_socket sock; | 23 | t_socket sock; |
25 | t_timeout tm; | 24 | t_timeout tm; |
26 | int family; | 25 | int family; |
26 | size_t len; /* length of datagram buffer below */ | ||
27 | char buf[1]; /* allocate larger structure to hold actual buffer */ | ||
27 | } t_udp; | 28 | } t_udp; |
28 | typedef t_udp *p_udp; | 29 | typedef t_udp *p_udp; |
29 | 30 | ||