/** * Call pppol2tp_create() in a thread-safe way by running that function inside the * tcpip_thread context. */ ppp_pcb* pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipaddr, u16_t port, const u8_t *secret, u8_t secret_len, ppp_link_status_cb_fn link_status_cb, void *ctx_cb) { ppp_pcb* result; PPPAPI_VAR_DECLARE(msg); PPPAPI_VAR_ALLOC_RETURN_NULL(msg); #if !PPPOL2TP_AUTH_SUPPORT LWIP_UNUSED_ARG(secret); LWIP_UNUSED_ARG(secret_len); #endif /* !PPPOL2TP_AUTH_SUPPORT */ PPPAPI_VAR_REF(msg).msg.ppp = NULL; PPPAPI_VAR_REF(msg).msg.msg.l2tpcreate.pppif = pppif; PPPAPI_VAR_REF(msg).msg.msg.l2tpcreate.netif = netif; PPPAPI_VAR_REF(msg).msg.msg.l2tpcreate.ipaddr = PPPAPI_VAR_REF(ipaddr); PPPAPI_VAR_REF(msg).msg.msg.l2tpcreate.port = port; #if PPPOL2TP_AUTH_SUPPORT PPPAPI_VAR_REF(msg).msg.msg.l2tpcreate.secret = secret; PPPAPI_VAR_REF(msg).msg.msg.l2tpcreate.secret_len = secret_len; #endif /* PPPOL2TP_AUTH_SUPPORT */ PPPAPI_VAR_REF(msg).msg.msg.l2tpcreate.link_status_cb = link_status_cb; PPPAPI_VAR_REF(msg).msg.msg.l2tpcreate.ctx_cb = ctx_cb; tcpip_api_call(pppapi_do_pppol2tp_create, &PPPAPI_VAR_REF(msg).call); result = PPPAPI_VAR_REF(msg).msg.ppp; PPPAPI_VAR_FREE(msg); return result; }
static tcp_pcb * _tcp_listen_with_backlog(tcp_pcb * pcb, uint8_t backlog) { tcp_api_call_t msg; msg.pcb = pcb; msg.backlog = backlog?backlog:0xFF; tcpip_api_call(_tcp_listen_api, (struct tcpip_api_call*)&msg); return msg.pcb; }
static esp_err_t _tcp_recved(tcp_pcb * pcb, size_t len) { tcp_api_call_t msg; msg.pcb = pcb; msg.received = len; tcpip_api_call(_tcp_recved_api, (struct tcpip_api_call*)&msg); return msg.err; }
/** * Call netif_set_addr() in a thread-safe way by running that function inside the * tcpip_thread context. * * @note for params @see netif_set_addr() */ err_t netifapi_netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw) { err_t err; NETIFAPI_VAR_DECLARE(msg); NETIFAPI_VAR_ALLOC(msg); if (ipaddr == NULL) { ipaddr = IP4_ADDR_ANY; } if (netmask == NULL) { netmask = IP4_ADDR_ANY; } if (gw == NULL) { gw = IP4_ADDR_ANY; } NETIFAPI_VAR_REF(msg).netif = netif; NETIFAPI_VAR_REF(msg).msg.add.ipaddr = NETIFAPI_VAR_REF(ipaddr); NETIFAPI_VAR_REF(msg).msg.add.netmask = NETIFAPI_VAR_REF(netmask); NETIFAPI_VAR_REF(msg).msg.add.gw = NETIFAPI_VAR_REF(gw); err = tcpip_api_call(netifapi_do_netif_set_addr, &API_VAR_REF(msg).call); NETIFAPI_VAR_FREE(msg); return err; }
static esp_err_t _tcp_bind(tcp_pcb * pcb, ip_addr_t * addr, uint16_t port) { tcp_api_call_t msg; msg.pcb = pcb; msg.bind.addr = addr; msg.bind.port = port; tcpip_api_call(_tcp_bind_api, (struct tcpip_api_call*)&msg); return msg.err; }
static esp_err_t _tcp_connect(tcp_pcb * pcb, ip_addr_t * addr, uint16_t port, tcp_connected_fn cb) { tcp_api_call_t msg; msg.pcb = pcb; msg.connect.addr = addr; msg.connect.port = port; msg.connect.cb = cb; tcpip_api_call(_tcp_connect_api, (struct tcpip_api_call*)&msg); return msg.err; }
static esp_err_t _tcp_write(tcp_pcb * pcb, const char* data, size_t size, uint8_t apiflags) { tcp_api_call_t msg; msg.pcb = pcb; msg.write.data = data; msg.write.size = size; msg.write.apiflags = apiflags; tcpip_api_call(_tcp_write_api, (struct tcpip_api_call*)&msg); return msg.err; }
/** * Call ppp_set_default() in a thread-safe way by running that function inside the * tcpip_thread context. */ err_t pppapi_set_default(ppp_pcb *pcb) { err_t err; PPPAPI_VAR_DECLARE(msg); PPPAPI_VAR_ALLOC(msg); PPPAPI_VAR_REF(msg).msg.ppp = pcb; err = tcpip_api_call(pppapi_do_ppp_set_default, &PPPAPI_VAR_REF(msg).call); PPPAPI_VAR_FREE(msg); return err; }
/** * Call ppp_close() in a thread-safe way by running that function inside the * tcpip_thread context. */ err_t pppapi_close(ppp_pcb *pcb, u8_t nocarrier) { err_t err; PPPAPI_VAR_DECLARE(msg); PPPAPI_VAR_ALLOC(msg); PPPAPI_VAR_REF(msg).msg.ppp = pcb; PPPAPI_VAR_REF(msg).msg.msg.close.nocarrier = nocarrier; err = tcpip_api_call(pppapi_do_ppp_close, &PPPAPI_VAR_REF(msg).call); PPPAPI_VAR_FREE(msg); return err; }
/** * Call ppp_connect() in a thread-safe way by running that function inside the * tcpip_thread context. */ err_t pppapi_connect(ppp_pcb *pcb, u16_t holdoff) { err_t err; PPPAPI_VAR_DECLARE(msg); PPPAPI_VAR_ALLOC(msg); PPPAPI_VAR_REF(msg).msg.ppp = pcb; PPPAPI_VAR_REF(msg).msg.msg.connect.holdoff = holdoff; err = tcpip_api_call(pppapi_do_ppp_connect, &PPPAPI_VAR_REF(msg).call); PPPAPI_VAR_FREE(msg); return err; }
/** * Call ppp_set_notify_phase_callback() in a thread-safe way by running that function inside the * tcpip_thread context. */ err_t pppapi_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb) { err_t err; PPPAPI_VAR_DECLARE(msg); PPPAPI_VAR_ALLOC(msg); PPPAPI_VAR_REF(msg).msg.ppp = pcb; PPPAPI_VAR_REF(msg).msg.msg.setnotifyphasecb.notify_phase_cb = notify_phase_cb; err = tcpip_api_call(pppapi_do_ppp_set_notify_phase_callback, &PPPAPI_VAR_REF(msg).call); PPPAPI_VAR_FREE(msg); return err; }
/** * Call ppp_ioctl() in a thread-safe way by running that function inside the * tcpip_thread context. */ err_t pppapi_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg) { err_t err; PPPAPI_VAR_DECLARE(msg); PPPAPI_VAR_ALLOC(msg); PPPAPI_VAR_REF(msg).msg.ppp = pcb; PPPAPI_VAR_REF(msg).msg.msg.ioctl.cmd = cmd; PPPAPI_VAR_REF(msg).msg.msg.ioctl.arg = arg; err = tcpip_api_call(pppapi_do_ppp_ioctl, &PPPAPI_VAR_REF(msg).call); PPPAPI_VAR_FREE(msg); return err; }
/** * call the "errtfunc" (or the "voidfunc" if "errtfunc" is NULL) in a thread-safe * way by running that function inside the tcpip_thread context. * * @note use only for functions where there is only "netif" parameter. */ err_t netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc, netifapi_errt_fn errtfunc) { err_t err; NETIFAPI_VAR_DECLARE(msg); NETIFAPI_VAR_ALLOC(msg); NETIFAPI_VAR_REF(msg).netif = netif; NETIFAPI_VAR_REF(msg).msg.common.voidfunc = voidfunc; NETIFAPI_VAR_REF(msg).msg.common.errtfunc = errtfunc; err = tcpip_api_call(netifapi_do_netif_common, &API_VAR_REF(msg).call); NETIFAPI_VAR_FREE(msg); return err; }
/** * Call pppos_create() in a thread-safe way by running that function inside the * tcpip_thread context. */ ppp_pcb* pppapi_pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb, ppp_link_status_cb_fn link_status_cb, void *ctx_cb) { ppp_pcb* result; PPPAPI_VAR_DECLARE(msg); PPPAPI_VAR_ALLOC_RETURN_NULL(msg); PPPAPI_VAR_REF(msg).msg.ppp = NULL; PPPAPI_VAR_REF(msg).msg.msg.serialcreate.pppif = pppif; PPPAPI_VAR_REF(msg).msg.msg.serialcreate.output_cb = output_cb; PPPAPI_VAR_REF(msg).msg.msg.serialcreate.link_status_cb = link_status_cb; PPPAPI_VAR_REF(msg).msg.msg.serialcreate.ctx_cb = ctx_cb; tcpip_api_call(pppapi_do_pppos_create, &PPPAPI_VAR_REF(msg).call); result = PPPAPI_VAR_REF(msg).msg.ppp; PPPAPI_VAR_FREE(msg); return result; }
/** * Call pppoe_create() in a thread-safe way by running that function inside the * tcpip_thread context. */ ppp_pcb* pppapi_pppoe_create(struct netif *pppif, struct netif *ethif, const char *service_name, const char *concentrator_name, ppp_link_status_cb_fn link_status_cb, void *ctx_cb) { ppp_pcb* result; PPPAPI_VAR_DECLARE(msg); PPPAPI_VAR_ALLOC_RETURN_NULL(msg); PPPAPI_VAR_REF(msg).msg.ppp = NULL; PPPAPI_VAR_REF(msg).msg.msg.ethernetcreate.pppif = pppif; PPPAPI_VAR_REF(msg).msg.msg.ethernetcreate.ethif = ethif; PPPAPI_VAR_REF(msg).msg.msg.ethernetcreate.service_name = service_name; PPPAPI_VAR_REF(msg).msg.msg.ethernetcreate.concentrator_name = concentrator_name; PPPAPI_VAR_REF(msg).msg.msg.ethernetcreate.link_status_cb = link_status_cb; PPPAPI_VAR_REF(msg).msg.msg.ethernetcreate.ctx_cb = ctx_cb; tcpip_api_call(pppapi_do_pppoe_create, &PPPAPI_VAR_REF(msg).call); result = PPPAPI_VAR_REF(msg).msg.ppp; PPPAPI_VAR_FREE(msg); return result; }
/** * Call netif_add() in a thread-safe way by running that function inside the * tcpip_thread context. * * @note for params @see netif_add() */ err_t netifapi_netif_add(struct netif *netif, #if LWIP_IPV4 const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw, #endif /* LWIP_IPV4 */ void *state, netif_init_fn init, netif_input_fn input) { err_t err; NETIFAPI_VAR_DECLARE(msg); NETIFAPI_VAR_ALLOC(msg); #if LWIP_IPV4 if (ipaddr == NULL) { ipaddr = IP4_ADDR_ANY; } if (netmask == NULL) { netmask = IP4_ADDR_ANY; } if (gw == NULL) { gw = IP4_ADDR_ANY; } #endif /* LWIP_IPV4 */ NETIFAPI_VAR_REF(msg).netif = netif; #if LWIP_IPV4 NETIFAPI_VAR_REF(msg).msg.add.ipaddr = NETIFAPI_VAR_REF(ipaddr); NETIFAPI_VAR_REF(msg).msg.add.netmask = NETIFAPI_VAR_REF(netmask); NETIFAPI_VAR_REF(msg).msg.add.gw = NETIFAPI_VAR_REF(gw); #endif /* LWIP_IPV4 */ NETIFAPI_VAR_REF(msg).msg.add.state = state; NETIFAPI_VAR_REF(msg).msg.add.init = init; NETIFAPI_VAR_REF(msg).msg.add.input = input; err = tcpip_api_call(netifapi_do_netif_add, &API_VAR_REF(msg).call); NETIFAPI_VAR_FREE(msg); return err; }
static esp_err_t _tcp_abort(tcp_pcb * pcb) { tcp_api_call_t msg; msg.pcb = pcb; tcpip_api_call(_tcp_abort_api, (struct tcpip_api_call*)&msg); return msg.err; }