- Main Page
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# api_msg.c File Reference

`#include <ubixos/types.h>`
`#include "net/debug.h"`
`#include "net/arch.h"`
`#include "net/api_msg.h"`
`#include "net/memp.h"`
`#include "net/sys.h"`
`#include "net/tcpip.h"`

Go to the source code of this file.

## Typedefs
typedef void(*) | api_msg_decode (struct api_msg_msg *msg)
## Functions
static err_t | accept_function (void *arg, struct tcp_pcb *newpcb, err_t err)
void | api_msg_input (struct api_msg *msg)
void | api_msg_post (struct api_msg *msg)
static void | do_accept (struct api_msg_msg *msg)
static void | do_bind (struct api_msg_msg *msg)
static void | do_close (struct api_msg_msg *msg)
static void | do_connect (struct api_msg_msg *msg)
static err_t | do_connected (void *arg, struct tcp_pcb *pcb, err_t err)
static void | do_delconn (struct api_msg_msg *msg)
static void | do_listen (struct api_msg_msg *msg)
static void | do_newconn (struct api_msg_msg *msg)
static void | do_recv (struct api_msg_msg *msg)
static void | do_send (struct api_msg_msg *msg)
static void | do_write (struct api_msg_msg *msg)
static void | err_tcp (void *arg, err_t err)
static err_t | poll_tcp (void *arg, struct tcp_pcb *pcb)
static err_t | recv_tcp (void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
static void | recv_udp (void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, uInt16 port)
static err_t | sent_tcp (void *arg, struct tcp_pcb *pcb, uInt16 len)
static void | setup_tcp (struct netconn *conn)
## Variables
static api_msg_decode | decode [API_MSG_MAX]

## Typedef Documentation

typedef void(* ) api_msg_decode(struct api_msg_msg *msg)

Definition at line 503 of file api_msg.c.

## Function Documentation

static err_t accept_function | ( | void * | arg,
|  | struct tcp_pcb * | newpcb,
|  | err_t | err |
| ) |  |  | `[static]`

Definition at line 160 of file api_msg.c.

References netconn::acceptmbox, netconn::err, ERR_MEM, ERR_OK, netconn::mbox, mbox, memp_free(), memp_mallocp(), MEMP_NETCONN, NETCONN_TCP, NULL, netconn::pcb, netconn::recvmbox, netconn::sem, setup_tcp(), tcp_pcb::state, sys_mbox_free(), sys_mbox_new(), SYS_MBOX_NULL, sys_mbox_post(), sys_sem_new(), SYS_SEM_NULL, netconn::tcp, and netconn::type.

Referenced by do_listen().

void api_msg_input | ( | struct api_msg * | msg | ) |

Definition at line 517 of file api_msg.c.

References decode, and api_msg_msg::msg.

Referenced by tcpip_thread().

void api_msg_post | ( | struct api_msg * | msg | ) |

Definition at line 523 of file api_msg.c.

References api_msg_msg::msg, and tcpip_apimsg().

Referenced by netconn_bind(), netconn_close(), netconn_connect(), netconn_delete(), netconn_listen(), netconn_recv(), netconn_send(), and netconn_write().

static void do_accept | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 401 of file api_msg.c.

References API_MSG_DEBUG, api_msg_msg::conn, DEBUGF, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, netconn::tcp, and netconn::type.

static void do_bind | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 243 of file api_msg.c.

References api_msg_msg::bc, api_msg_msg::conn, netconn::err, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, recv_udp(), setup_tcp(), sys_mbox_post(), netconn::tcp, tcp_bind(), tcp_new(), netconn::type, netconn::udp, udp_bind(), UDP_FLAGS_NOCHKSUM, UDP_FLAGS_UDPLITE, udp_new(), udp_recv(), and udp_setflags.

static void do_close | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 479 of file api_msg.c.

References api_msg_msg::conn, netconn::err, LISTEN, netconn::mbox, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, tcp_pcb::state, sys_mbox_post(), netconn::tcp, tcp_close(), and netconn::type.

static void do_connect | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 305 of file api_msg.c.

References api_msg_msg::bc, api_msg_msg::conn, do_connected(), netconn::err, ERR_MEM, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, recv_udp(), setup_tcp(), sys_mbox_post(), netconn::tcp, tcp_connect(), tcp_new(), netconn::type, netconn::udp, udp_connect(), UDP_FLAGS_NOCHKSUM, UDP_FLAGS_UDPLITE, udp_new(), udp_recv(), and udp_setflags.

static err_t do_connected | ( | void * | arg,
|  | struct tcp_pcb * | pcb,
|  | err_t | err |
| ) |  |  | `[static]`

Definition at line 284 of file api_msg.c.

References netconn::err, ERR_OK, ERR_VAL, netconn::mbox, NETCONN_TCP, NULL, setup_tcp(), sys_mbox_post(), and netconn::type.

Referenced by do_connect().

static void do_delconn | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 208 of file api_msg.c.

References api_msg_msg::conn, ERR_OK, LISTEN, netconn::mbox, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, udp_pcb::recv_arg, tcp_pcb::state, SYS_MBOX_NULL, sys_mbox_post(), netconn::tcp, tcp_abort(), tcp_accept(), tcp_arg(), tcp_close(), tcp_err(), tcp_poll(), tcp_recv(), tcp_sent(), netconn::type, netconn::udp, and udp_remove().

static void do_listen | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 368 of file api_msg.c.

References accept_function(), netconn::acceptmbox, API_MSG_DEBUG, api_msg_msg::conn, DEBUGF, netconn::err, ERR_MEM, netconn::mbox, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_new(), SYS_MBOX_NULL, sys_mbox_post(), netconn::tcp, tcp_accept(), tcp_arg(), tcp_listen(), and netconn::type.

static void do_newconn | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 203 of file api_msg.c.

static void do_recv | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 438 of file api_msg.c.

References api_msg_msg::conn, api_msg_msg::len, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NULL, netconn::pcb, sys_mbox_post(), netconn::tcp, tcp_recved(), and netconn::type.

static void do_send | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 419 of file api_msg.c.

References api_msg_msg::conn, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, api_msg_msg::p, netconn::pcb, sys_mbox_post(), netconn::tcp, netconn::type, netconn::udp, and udp_send().

static void do_write | ( | struct api_msg_msg * | msg | ) | `[static]`

Definition at line 449 of file api_msg.c.

References api_msg_msg::conn, netconn::err, ERR_OK, ERR_VAL, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_post(), netconn::tcp, tcp_output(), tcp_write(), netconn::type, tcp_pcb::unacked, and api_msg_msg::w.

static void err_tcp | ( | void * | arg,
|  | err_t | err |
| ) |  |  | `[static]`

Definition at line 122 of file api_msg.c.

References netconn::acceptmbox, netconn::err, netconn::mbox, NULL, netconn::pcb, netconn::recvmbox, netconn::sem, SYS_MBOX_NULL, sys_mbox_post(), SYS_SEM_NULL, sys_sem_signal(), and netconn::tcp.

Referenced by setup_tcp().

static err_t poll_tcp | ( | void * | arg,
|  | struct tcp_pcb * | pcb |
| ) |  |  | `[static]`

Definition at line 96 of file api_msg.c.

References ERR_OK, NETCONN_CLOSE, NETCONN_WRITE, NULL, netconn::sem, netconn::state, SYS_SEM_NULL, and sys_sem_signal().

Referenced by setup_tcp().

static err_t recv_tcp | ( | void * | arg,
|  | struct tcp_pcb * | pcb,
|  | struct pbuf * | p,
|  | err_t | err |
| ) |  |  | `[static]`

Definition at line 47 of file api_msg.c.

References netconn::err, ERR_OK, ERR_VAL, NULL, pbuf_free(), netconn::recvmbox, SYS_MBOX_NULL, and sys_mbox_post().

Referenced by setup_tcp().

static void recv_udp | ( | void * | arg,
|  | struct udp_pcb * | pcb,
|  | struct pbuf * | p,
|  | struct ip_addr * | addr,
|  | uInt16 | port |
| ) |  |  | `[static]`

Definition at line 66 of file api_msg.c.

References netbuf::fromaddr, netbuf::fromport, memp_mallocp(), MEMP_NETBUF, NULL, netbuf::p, pbuf_free(), netbuf::ptr, netconn::recvmbox, SYS_MBOX_NULL, and sys_mbox_post().

Referenced by do_bind(), and do_connect().

static err_t sent_tcp | ( | void * | arg,
|  | struct tcp_pcb * | pcb,
|  | uInt16 | len |
| ) |  |  | `[static]`

Definition at line 110 of file api_msg.c.

References ERR_OK, NULL, netconn::sem, SYS_SEM_NULL, and sys_sem_signal().

Referenced by setup_tcp().

static void setup_tcp | ( | struct netconn * | conn | ) | `[static]`

Definition at line 147 of file api_msg.c.

References err_tcp(), netconn::pcb, poll_tcp(), recv_tcp(), sent_tcp(), netconn::tcp, tcp_arg(), tcp_err(), tcp_poll(), tcp_recv(), and tcp_sent().

Referenced by accept_function(), do_bind(), do_connect(), and do_connected().

## Variable Documentation

api_msg_decode decode[API_MSG_MAX]`[static]`

Initial value:

     {
      do_newconn,
      do_delconn,
      do_bind,
      do_connect,
      do_listen,
      do_accept,
      do_send,
      do_recv,
      do_write,
      do_close
      }

Definition at line 504 of file api_msg.c.

Referenced by api_msg_input().