# api.h File Reference

`#include "net/opt.h"`
`#include "net/pbuf.h"`
`#include "net/sys.h"`
`#include "net/ipv4/ip.h"`
`#include "net/udp.h"`
`#include "net/tcp.h"`
`#include "net/err.h"`

Go to the source code of this file.

## Data Structures
struct | netbuf
struct | netconn
## Defines
#define | NETCONN_NOCOPY 0x00
#define | NETCONN_COPY 0x01
## Enumerations
enum | netconn_type { NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM }
enum | netconn_state { NETCONN_NONE, NETCONN_WRITE, NETCONN_ACCEPT, NETCONN_RECV, NETCONN_CONNECT, NETCONN_CLOSE }
## Functions
netbuf * | netbuf_new (void)
void | netbuf_delete (struct netbuf *buf)
void * | netbuf_alloc (struct netbuf *buf, uInt16 size)
void | netbuf_free (struct netbuf *buf)
void | netbuf_ref (struct netbuf *buf, void *dataptr, uInt16 size)
void | netbuf_chain (struct netbuf *head, struct netbuf *tail)
uInt16 | netbuf_len (struct netbuf *buf)
err_t | netbuf_data (struct netbuf *buf, void **dataptr, uInt16 *len)
Int8 | netbuf_next (struct netbuf *buf)
void | netbuf_first (struct netbuf *buf)
void | netbuf_copy (struct netbuf *buf, void *dataptr, uInt16 len)
ip_addr * | netbuf_fromaddr (struct netbuf *buf)
uInt16 | netbuf_fromport (struct netbuf *buf)
netconn * | netconn_new (enum netconn_type type)
err_t | netconn_delete (struct netconn *conn)
enum netconn_type | netconn_type (struct netconn *conn)
err_t | netconn_peer (struct netconn *conn, struct ip_addr **addr, uInt16 *port)
err_t | netconn_addr (struct netconn *conn, struct ip_addr **addr, uInt16 *port)
err_t | netconn_bind (struct netconn *conn, struct ip_addr *addr, uInt16 port)
err_t | netconn_connect (struct netconn *conn, struct ip_addr *addr, uInt16 port)
err_t | netconn_listen (struct netconn *conn)
netconn * | netconn_accept (struct netconn *conn)
netbuf * | netconn_recv (struct netconn *conn)
err_t | netconn_send (struct netconn *conn, struct netbuf *buf)
err_t | netconn_write (struct netconn *conn, void *dataptr, uInt16 size, uInt8 copy)
err_t | netconn_close (struct netconn *conn)
err_t | netconn_err (struct netconn *conn)
void | netbuf_copy_partial (struct netbuf *buf, void *dataptr, uInt16 len, uInt16 offset)

## Define Documentation

#define NETCONN_COPY 0x01

#define NETCONN_NOCOPY 0x00

## Enumeration Type Documentation

enum netconn_state

  | Enumeration values:
  NETCONN_NONE |
  NETCONN_WRITE |
  NETCONN_ACCEPT |
  NETCONN_RECV |
  NETCONN_CONNECT |
  NETCONN_CLOSE |

enum netconn_type

  | Enumeration values:
  NETCONN_TCP |
  NETCONN_UDP |
  NETCONN_UDPLITE |
  NETCONN_UDPNOCHKSUM |

## Function Documentation

void* netbuf_alloc | ( | struct netbuf * | buf,
|  | uInt16 | size
| ) |

void netbuf_chain | ( | struct netbuf * | head,
|  | struct netbuf * | tail
| ) |

void netbuf_copy | ( | struct netbuf * | buf,
|  | void * | dataptr,
|  | uInt16 | len
| ) |

void netbuf_copy_partial | ( | struct netbuf * | buf,
|  | void * | dataptr,
|  | uInt16 | len,
|  | uInt16 | offset
| ) |

err_t netbuf_data | ( | struct netbuf * | buf,
|  | void ** | dataptr,
|  | uInt16 * | len
| ) |

void netbuf_delete | ( | struct netbuf * | buf | ) |

void netbuf_first | ( | struct netbuf * | buf | ) |

void netbuf_free | ( | struct netbuf * | buf | ) |

struct ip_addr* netbuf_fromaddr | ( | struct netbuf * | buf | ) |

uInt16 netbuf_fromport | ( | struct netbuf * | buf | ) |

uInt16 netbuf_len | ( | struct netbuf * | buf | ) |

struct netbuf* netbuf_new | ( | void |  | ) |

Int8 netbuf_next | ( | struct netbuf * | buf | ) |

void netbuf_ref | ( | struct netbuf * | buf,
|  | void * | dataptr,
|  | uInt16 | size
| ) |

struct netconn* netconn_accept | ( | struct netconn * | conn | ) |

err_t netconn_addr | ( | struct netconn * | conn,
|  | struct ip_addr ** | addr,
|  | uInt16 * | port
| ) |

err_t netconn_bind | ( | struct netconn * | conn,
|  | struct ip_addr * | addr,
|  | uInt16 | port
| ) |

err_t netconn_close | ( | struct netconn * | conn | ) |

err_t netconn_connect | ( | struct netconn * | conn,
|  | struct ip_addr * | addr,
|  | uInt16 | port
| ) |

err_t netconn_delete | ( | struct netconn * | conn | ) |

err_t netconn_err | ( | struct netconn * | conn | ) |

err_t netconn_listen | ( | struct netconn * | conn | ) |

struct netconn* netconn_new | ( | enum netconn_type | type | ) |

err_t netconn_peer | ( | struct netconn * | conn,
|  | struct ip_addr ** | addr,
|  | uInt16 * | port
| ) |

struct netbuf* netconn_recv | ( | struct netconn * | conn | ) |

err_t netconn_send | ( | struct netconn * | conn,
|  | struct netbuf * | buf
| ) |

enum netconn_type netconn_type | ( | struct netconn * | conn | ) |

err_t netconn_write | ( | struct netconn * | conn,
|  | void * | dataptr,
|  | uInt16 | size,
|  | uInt8 | copy
| ) |