ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

pbuf.c File Reference
#include "lwip/opt.h"
#include "lwip/stats.h"
#include "lwip/def.h"
#include "lwip/mem.h"
#include "lwip/memp.h"
#include "lwip/pbuf.h"
#include "lwip/sys.h"
#include "arch/perf.h"
#include <string.h>

Go to the source code of this file.

Defines

#define SIZEOF_STRUCT_PBUF   LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf))
#define PBUF_POOL_BUFSIZE_ALIGNED   LWIP_MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE)
#define PBUF_POOL_IS_EMPTY()

Functions

struct pbufpbuf_alloc (pbuf_layer layer, u16_t length, pbuf_type type)
void pbuf_realloc (struct pbuf *p, u16_t new_len)
u8_t pbuf_header (struct pbuf *p, s16_t header_size_increment)
u8_t pbuf_free (struct pbuf *p)
u8_t pbuf_clen (struct pbuf *p)
void pbuf_ref (struct pbuf *p)
void pbuf_cat (struct pbuf *h, struct pbuf *t)
void pbuf_chain (struct pbuf *h, struct pbuf *t)
struct pbufpbuf_dechain (struct pbuf *p)
err_t pbuf_copy (struct pbuf *p_to, struct pbuf *p_from)
u16_t pbuf_copy_partial (struct pbuf *buf, void *dataptr, u16_t len, u16_t offset)
err_t pbuf_take (struct pbuf *buf, const void *dataptr, u16_t len)
struct pbufpbuf_coalesce (struct pbuf *p, pbuf_layer layer)
u8_t pbuf_get_at (struct pbuf *p, u16_t offset)
u16_t pbuf_memcmp (struct pbuf *p, u16_t offset, const void *s2, u16_t n)
u16_t pbuf_memfind (struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset)
u16_t pbuf_strstr (struct pbuf *p, const char *substr)

Detailed Description

Packet buffer management

Packets are built from the pbuf data structure. It supports dynamic memory allocation for packet contents or can reference externally managed packet contents both in RAM and ROM. Quick allocation for incoming packets is provided through pools with fixed sized pbufs.

A packet may span over multiple pbufs, chained as a singly linked list. This is called a "pbuf chain".

Multiple packets may be queued, also using this singly linked list. This is called a "packet queue".

So, a packet queue consists of one or more pbuf chains, each of which consist of one or more pbufs. CURRENTLY, PACKET QUEUES ARE NOT SUPPORTED!!! Use helper structs to queue multiple packets.

The differences between a pbuf chain and a packet queue are very precise but subtle.

The last pbuf of a packet has a ->tot_len field that equals the ->len field. It can be found by traversing the list. If the last pbuf of a packet has a ->next field other than NULL, more packets are on the queue.

Therefore, looping through a pbuf of a single packet, has an loop end condition (tot_len == p->len), NOT (next == NULL).

Definition in file pbuf.c.


Generated on Sat May 26 2012 06:02:59 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.