|
From: | Jin Won Seo |
Subject: | [lwip-users] Question about udp_recv() |
Date: | Thu, 18 Jul 2013 11:47:04 -0700 |
Hi,
I am now looking at qs-checkout example provided by StellarisWare10636.
The procedure of calling udp_recv() is below:
1. call TFTPQSInit(void) in tftp_qs.c
TFTPQSInit(void)
{
//
// Initialize the TFTP module and pass it our board-specific GET and PUT
// request handler function pointer.
//
TFTPInit(TFTPRequest);
}
2 call TFTPInit(pointer to callback function) in tftp.c
void
TFTPInit(tTFTPRequest pfnRequest)
{
void *pcb;
//
// Remember the application's notification callback.
//
g_pfnRequest = pfnRequest;
//
// Start listening for incoming TFTP requests.
//
pcb = udp_new();
udp_recv(pcb, TFTPRecv, NULL);
udp_bind(pcb, IP_ADDR_ANY, TFTP_PORT);
}
3. call udp_recv by calling function pointer TFTPRecv
udp_recv(struct udp_pcb *pcb,
void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p,
struct ip_addr *addr, u16_t port),
void *recv_arg)
{
/* remember recv() callback and user data */
pcb->recv = recv;
pcb->recv_arg = recv_arg;
}
static void
TFTPRecv(void *arg, struct udp_pcb *upcb, struct pbuf *p, struct ip_addr *addr,
u16_t port)
{
//do something with arguments
}
My question I don't see any arguments passed to callback functions : udp_recv() and TFTPRecv().
How are the arguments going to be filled up and by whom??
Thanks,
Jin
[Prev in Thread] | Current Thread | [Next in Thread] |