main index

section index




/*-------------------------------------------------------------*/
/* Name : netwib_io_init_sock_xyz
   Description :
     Initialize a socket connection.
   Input parameter(s) :
     localip : local IP
     remoteip : remote IP
     iptype : iptype to use
     localport : local port
     remoteport : remote port
     *pip4opt : optional IP options to add
   Input/output parameter(s) :
   Output parameter(s) :
     **ppio : netwib_io initialized
   Normal return values :
     NETWIB_ERR_OK : ok
*/
netwib_err netwib_io_init_sock_udp_cli(netwib_constip *plocalip,
                                       netwib_constip *premoteip,
                                       netwib_port localport,
                                       netwib_port remoteport,
                                       netwib_constbuf *pip4opt,
                                       netwib_io **ppio);
#define netwib_io_init_sock_udp_cli_easy(premoteip,remoteport,ppio) netwib_io_init_sock_udp_cli(NULL,premoteip,0,remoteport,NULL,ppio)

netwib_err netwib_io_init_sock_tcp_cli(netwib_constip *plocalip,
                                       netwib_constip *premoteip,
                                       netwib_port localport,
                                       netwib_port remoteport,
                                       netwib_constbuf *pip4opt,
                                       netwib_io **ppio);
#define netwib_io_init_sock_tcp_cli_easy(premoteip,remoteport,ppio) netwib_io_init_sock_tcp_cli(NULL,premoteip,0,remoteport,NULL,ppio)

netwib_err netwib_io_init_sock_udp_ser(netwib_constip *plocalip,
                                       netwib_port localport,
                                       netwib_constbuf *pip4opt,
                                       netwib_io **ppio);
netwib_err netwib_io_init_sock_udp_ser_easy(netwib_iptype iptype,
                                            netwib_port localport,
                                            netwib_io **ppio);

netwib_err netwib_io_init_sock_tcp_ser(netwib_constip *plocalip,
                                       netwib_port localport,
                                       netwib_constbuf *pip4opt,
                                       netwib_io **ppio);
netwib_err netwib_io_init_sock_tcp_ser_easy(netwib_iptype iptype,
                                            netwib_port localport,
                                            netwib_io **ppio);

netwib_err netwib_io_init_sock_udp_mulser(netwib_constip *plocalip,
                                          netwib_port localport,
                                          netwib_constbuf *pip4opt,
                                          netwib_io **ppio);
netwib_err netwib_io_init_sock_udp_mulser_easy(netwib_iptype iptype,
                                               netwib_port localport,
                                               netwib_io **ppio);

/*-------------------------------------------------------------*/
/* Name : netwib_sock_tcp_mulser
   Description :
     Deal with a tcp multi-client server.
     Note : we never exit from this function.
   Input parameter(s) :
     localip : listening IP address
     localport : listening port
     ip4opt : IP options to add
     pfunc : memory address of the function which will be
             called for each client. For each call, the first
             parameter ('pio') will be set with socket,
             and the second parameter ('pinfos')
             will be set with the optional parameter below.
             Note : at the end, this function has to close pio
   Input/output parameter(s) :
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc. This
              may be used to send information to *pfunc.
   Output parameter(s) :
   Normal return values :
     NETWIB_ERR_OK : ok
*/
typedef netwib_err (*netwib_sock_tcp_mulser_pf)(netwib_io *pio,
                                                netwib_ptr pinfos);
netwib_err netwib_sock_tcp_mulser(netwib_constip *plocalip,
                                  netwib_port localport,
                                  netwib_constbuf *pip4opt,
                                  netwib_sock_tcp_mulser_pf pfunc,
                                  netwib_ptr pinfos);
netwib_err netwib_sock_tcp_mulser_easy(netwib_iptype iptype,
                                       netwib_port localport,
                                       netwib_sock_tcp_mulser_pf pfunc,
                                       netwib_ptr pinfos);

/*-------------------------------------------------------------*/
/* Set/get IP options */
/* netwib_err f(netwib_io *pio, netwib_constbuf *pip4opt); */
#define netwib_sock_ctl_set_ip4opt(pio,pip4opt) netwib_io_ctl_set(pio,NETWIB_IO_WAYTYPE_SUPPORTED,NETWIB_IO_CTLTYPE_SOCK_IP4OPT,pip4opt,0)
/* netwib_err f(netwib_io *pio, netwib_buf *pip4opt); */
#define netwib_sock_ctl_get_ip4opt(pio,pip4opt) netwib_io_ctl_get(pio,NETWIB_IO_WAYTYPE_SUPPORTED,NETWIB_IO_CTLTYPE_SOCK_IP4OPT,pip4opt,NULL)

/*-------------------------------------------------------------*/
/* Obtain local IP address and port */
/* netwib_err f(netwib_io *pio, netwib_ip *pip, netwib_port *pport); */
#define netwib_sock_ctl_get_local(pio,pip,pport) netwib_io_ctl_get(pio,NETWIB_IO_WAYTYPE_SUPPORTED,NETWIB_IO_CTLTYPE_SOCK_LOCAL,pip,pport)
/* Obtain remote IP address and port */
/* netwib_err f(netwib_io *pio, netwib_ip *pip, netwib_port *pport); */
#define netwib_sock_ctl_get_remote(pio,pip,pport) netwib_io_ctl_get(pio,NETWIB_IO_WAYTYPE_SUPPORTED,NETWIB_IO_CTLTYPE_SOCK_REMOTE,pip,pport)




main index

section index