48
50
//this function was interanal intially.. this is required for public and
49
51
//interface probably should change.
50
bool CreateUDPSocket(int *resfd, struct sockaddr_in *addr,
52
int my_port, unsigned int my_ip = 0, int send_bufsize = 0, int recv_bufsize = 0);
54
sockaddr const* remote_addr,
58
int send_bufsize = 0, int recv_bufsize = 0
55
62
create UDPConnection
64
71
@param c Continuation that is called back with newly created
66
@param my_port Local port to be bound (required)
67
@param my_ip Local IP to be bound (optional). Defaults to '0' (INADDR_ANY)
73
@param addr Address to bind (includes port)
68
74
@param send_bufsize (optional) Socket buffer size for sending.
69
75
Limits how much outstanding data to OS before it is able to send
73
79
@return Action* Always returns ACTION_RESULT_DONE if socket was
74
80
created successfuly, or ACTION_IO_ERROR if not.
76
inkcoreapi Action *UDPBind(Continuation * c, int my_port, int my_ip = 0, int send_bufsize = 0, int recv_bufsize = 0);
82
inkcoreapi Action *UDPBind(Continuation * c, sockaddr const* addr, int send_bufsize = 0, int recv_bufsize = 0);
78
84
// The mess again: the complier won't let me stick UDPConnection here.
79
void UDPClassifyConnection(Continuation * udpConn, int destIP);
85
void UDPClassifyConnection(Continuation * udpConn, IpAddr const& addr);
81
87
// create pairs of UDPConnections in which the first connection is
82
88
// on a even-#'ed port and the second connection is on the next
83
89
// odd-#'ed port. Create "nPairs" of such connections.
84
90
Action *UDPCreatePortPairs(Continuation *, int nPairs,
85
unsigned int myIP = 0,
86
unsigned int destIP = 0, int send_bufsize = 0, int recv_bufsize = 0);
91
sockaddr const* local_addr,
92
sockaddr const* remote_addr,
93
int send_bufsize = 0, int recv_bufsize = 0);
88
95
// Regarding sendto_re, sendmsg_re, recvfrom_re:
89
96
// * You may be called back on 'c' with completion or error status.
105
112
// * You can get other info about the completed operation through use
106
113
// of the completionUtil class.
107
114
Action *sendto_re(Continuation * c, void *token, int fd,
108
struct sockaddr *toaddr, int toaddrlen, IOBufferBlock * buf, int len);
115
sockaddr const* toaddr, int toaddrlen, IOBufferBlock * buf, int len);
109
116
// I/O buffers referenced by msg must be pinned by the caller until
110
117
// continuation is called back.
111
118
Action *sendmsg_re(Continuation * c, void *token, int fd, struct msghdr *msg);
113
120
Action *recvfrom_re(Continuation * c, void *token, int fd,
114
struct sockaddr *fromaddr, socklen_t *fromaddrlen,
121
sockaddr *fromaddr, socklen_t *fromaddrlen,
115
122
IOBufferBlock * buf, int len, bool useReadCont = true, int timeout = 0);
116
123
// Continuation is really a UDPConnection; due to the include mess, we stick in the
117
124
// base-class of UDPConnection.