Hi all,

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
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to