patch: added tcp_set_handlers()

This commit is contained in:
Alfred E. Heggestad 2011-05-24 13:01:44 +00:00
parent 30e6a662b8
commit 7f973a8bc8
2 changed files with 24 additions and 0 deletions

View file

@ -66,6 +66,8 @@ int tcp_conn_bind(struct tcp_conn *tc, const struct sa *local);
int tcp_conn_connect(struct tcp_conn *tc, const struct sa *peer);
int tcp_send(struct tcp_conn *tc, struct mbuf *mb);
int tcp_set_send(struct tcp_conn *tc, tcp_send_h *sendh);
void tcp_set_handlers(struct tcp_conn *tc, tcp_estab_h *eh, tcp_recv_h *rh,
tcp_close_h *ch, void *arg);
void tcp_conn_rxsz_set(struct tcp_conn *tc, size_t rxsz);
int tcp_conn_local_get(const struct tcp_conn *tc, struct sa *local);
int tcp_conn_peer_get(const struct tcp_conn *tc, struct sa *peer);

View file

@ -1106,6 +1106,28 @@ int tcp_set_send(struct tcp_conn *tc, tcp_send_h *sendh)
}
/**
* Set handlers on a TCP Connection
*
* @param tc TCP Connection
* @param eh TCP Connection Established handler
* @param rh TCP Connection Receive data handler
* @param ch TCP Connection Close handler
* @param arg Handler argument
*/
void tcp_set_handlers(struct tcp_conn *tc, tcp_estab_h *eh, tcp_recv_h *rh,
tcp_close_h *ch, void *arg)
{
if (!tc)
return;
tc->estabh = eh;
tc->recvh = rh;
tc->closeh = ch;
tc->arg = arg;
}
/**
* Get local network address of TCP Socket
*