webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Macros | Typedefs | Functions | Variables
user_mbuf.h File Reference
#include <stdio.h>
#include "umem.h"
#include "user_malloc.h"
#include "netinet/sctp_os_userspace.h"

Go to the source code of this file.

Classes

struct  mb_args
 
struct  clust_args
 
struct  mbstat
 
struct  m_hdr
 
struct  m_tag
 
struct  pkthdr
 
struct  m_ext
 
struct  mbuf
 

Macros

#define USING_MBUF_CONSTRUCTOR   0
 
#define MSIZE   256
 
#define MCLBYTES   2048
 
#define M_MOVE_PKTHDR(to, from)   m_move_pkthdr((to), (from))
 
#define MGET(m, how, type)   ((m) = m_get((how), (type)))
 
#define MGETHDR(m, how, type)   ((m) = m_gethdr((how), (type)))
 
#define MCLGET(m, how)   m_clget((m), (how))
 
#define M_HDR_PAD   ((sizeof(intptr_t)==4) ? 2 : 6) /* modified for __Userspace__ */
 
#define M_COPYALL   1000000000
 
#define mtod(m, t)   ((t)((m)->m_data))
 
#define dtom(x)   ((struct mbuf *)((intptr_t)(x) & ~(MSIZE-1)))
 
#define MBUF_MEM_NAME   "mbuf"
 
#define MBUF_CLUSTER_MEM_NAME   "mbuf_cluster"
 
#define MBUF_EXTREFCNT_MEM_NAME   "mbuf_ext_refcnt"
 
#define MT_NOINIT
 
#define MLEN   ((int)(MSIZE - sizeof(struct m_hdr))) /* normal data len */
 
#define MHLEN   ((int)(MLEN - sizeof(struct pkthdr))) /* data len w/pkthdr */
 
#define MINCLSIZE   ((int)(MHLEN + 1)) /* smallest amount to put in cluster */
 
#define M_MAXCOMPRESS   (MHLEN / 2) /* max amount to copy for compression */
 
#define m_next   m_hdr.mh_next
 
#define m_len   m_hdr.mh_len
 
#define m_data   m_hdr.mh_data
 
#define m_type   m_hdr.mh_type
 
#define m_flags   m_hdr.mh_flags
 
#define m_nextpkt   m_hdr.mh_nextpkt
 
#define m_act   m_nextpkt
 
#define m_pkthdr   M_dat.MH.MH_pkthdr
 
#define m_ext   M_dat.MH.MH_dat.MH_ext
 
#define m_pktdat   M_dat.MH.MH_dat.MH_databuf
 
#define m_dat   M_dat.M_databuf
 
#define M_EXT   0x0001 /* has associated external storage */
 
#define M_PKTHDR   0x0002 /* start of record */
 
#define M_EOR   0x0004 /* end of record */
 
#define M_RDONLY   0x0008 /* associated data is marked read-only */
 
#define M_PROTO1   0x0010 /* protocol-specific */
 
#define M_PROTO2   0x0020 /* protocol-specific */
 
#define M_PROTO3   0x0040 /* protocol-specific */
 
#define M_PROTO4   0x0080 /* protocol-specific */
 
#define M_PROTO5   0x0100 /* protocol-specific */
 
#define M_FREELIST   0x8000 /* mbuf is on the free list */
 
#define M_COPYFLAGS
 
#define M_BCAST   0x0200 /* send/received as link-level broadcast */
 
#define M_MCAST   0x0400 /* send/received as link-level multicast */
 
#define M_FRAG   0x0800 /* packet is a fragment of a larger packet */
 
#define M_FIRSTFRAG   0x1000 /* packet is first fragment */
 
#define M_LASTFRAG   0x2000 /* packet is last fragment */
 
#define M_VLANTAG   0x10000 /* ether_vtag is valid */
 
#define M_PROMISC   0x20000 /* packet was not for us */
 
#define M_NOFREE   0x40000 /* do not free mbuf - it is embedded in the cluster */
 
#define EXT_CLUSTER   1 /* mbuf cluster */
 
#define EXT_SFBUF   2 /* sendfile(2)'s sf_bufs */
 
#define EXT_JUMBOP   3 /* jumbo cluster 4096 bytes */
 
#define EXT_JUMBO9   4 /* jumbo cluster 9216 bytes */
 
#define EXT_JUMBO16   5 /* jumbo cluster 16184 bytes */
 
#define EXT_PACKET   6 /* mbuf+cluster from packet zone */
 
#define EXT_MBUF   7 /* external mbuf reference (M_IOVEC) */
 
#define EXT_NET_DRV   100 /* custom ext_buf provided by net driver(s) */
 
#define EXT_MOD_TYPE   200 /* custom module's ext_buf type */
 
#define EXT_DISPOSABLE   300 /* can throw this buffer away w/page flipping */
 
#define EXT_EXTREF   400 /* has externally maintained ref_cnt ptr */
 
#define MT_NOTMBUF   0 /* USED INTERNALLY ONLY! Object is not mbuf */
 
#define MT_DATA   1 /* dynamic (data) allocation */
 
#define MT_HEADER   MT_DATA /* packet header, use M_PKTHDR instead */
 
#define MT_SONAME   8 /* socket name */
 
#define MT_CONTROL   14 /* extra-data protocol message */
 
#define MT_OOBDATA   15 /* expedited data */
 
#define MT_NTYPES   16 /* number of mbuf types for mbtypes[] */
 
#define MT_NOINIT
 
#define MBTOM(how)   (how)
 
#define M_WRITABLE(m)
 
#define M_LEADINGSPACE(m)
 
#define M_TRAILINGSPACE(m)
 
#define M_PREPEND(m, plen, how)
 
#define M_ALIGN(m, len)
 
#define MH_ALIGN(m, len)
 

Typedefs

typedef umem_cache_t * sctp_zone_t
 

Functions

struct mbufm_gethdr (int how, short type)
 
struct mbufm_get (int how, short type)
 
struct mbufm_free (struct mbuf *m)
 
void m_clget (struct mbuf *m, int how)
 
void mbuf_init (void *)
 
struct mbufm_split (struct mbuf *, int, int)
 
void m_cat (struct mbuf *m, struct mbuf *n)
 
void m_adj (struct mbuf *, int)
 
void mb_free_ext (struct mbuf *)
 
void m_freem (struct mbuf *)
 
struct m_tagm_tag_alloc (u_int32_t, int, int, int)
 
struct mbufm_copym (struct mbuf *, int, int, int)
 
void m_copyback (struct mbuf *, int, int, caddr_t)
 
struct mbufm_pullup (struct mbuf *, int)
 
struct mbufm_pulldown (struct mbuf *, int off, int len, int *offp)
 
int m_dup_pkthdr (struct mbuf *, struct mbuf *, int)
 
struct m_tagm_tag_copy (struct m_tag *, int)
 
int m_tag_copy_chain (struct mbuf *, struct mbuf *, int)
 
struct mbufm_prepend (struct mbuf *, int, int)
 
void m_copydata (const struct mbuf *, int, int, caddr_t)
 
void m_tag_delete (struct mbuf *, struct m_tag *)
 
void m_tag_delete_chain (struct mbuf *, struct m_tag *)
 
void m_move_pkthdr (struct mbuf *, struct mbuf *)
 
void m_tag_free_default (struct m_tag *)
 

Variables

sctp_zone_t zone_mbuf
 
sctp_zone_t zone_clust
 
sctp_zone_t zone_ext_refcnt
 
int max_linkhdr
 
int max_protohdr
 
struct mbstat mbstat
 

Macro Definition Documentation

◆ dtom

#define dtom (   x)    ((struct mbuf *)((intptr_t)(x) & ~(MSIZE-1)))

◆ EXT_CLUSTER

#define EXT_CLUSTER   1 /* mbuf cluster */

◆ EXT_DISPOSABLE

#define EXT_DISPOSABLE   300 /* can throw this buffer away w/page flipping */

◆ EXT_EXTREF

#define EXT_EXTREF   400 /* has externally maintained ref_cnt ptr */

◆ EXT_JUMBO16

#define EXT_JUMBO16   5 /* jumbo cluster 16184 bytes */

◆ EXT_JUMBO9

#define EXT_JUMBO9   4 /* jumbo cluster 9216 bytes */

◆ EXT_JUMBOP

#define EXT_JUMBOP   3 /* jumbo cluster 4096 bytes */

◆ EXT_MBUF

#define EXT_MBUF   7 /* external mbuf reference (M_IOVEC) */

◆ EXT_MOD_TYPE

#define EXT_MOD_TYPE   200 /* custom module's ext_buf type */

◆ EXT_NET_DRV

#define EXT_NET_DRV   100 /* custom ext_buf provided by net driver(s) */

◆ EXT_PACKET

#define EXT_PACKET   6 /* mbuf+cluster from packet zone */

◆ EXT_SFBUF

#define EXT_SFBUF   2 /* sendfile(2)'s sf_bufs */

◆ m_act

#define m_act   m_nextpkt

◆ M_ALIGN

#define M_ALIGN (   m,
  len 
)
Value:
do { \
KASSERT(!((m)->m_flags & (M_PKTHDR|M_EXT)), \
("%s: M_ALIGN not normal mbuf", __func__)); \
KASSERT((m)->m_data == (m)->m_dat, \
("%s: M_ALIGN not a virgin mbuf", __func__)); \
(m)->m_data += (MLEN - (len)) & ~(sizeof(long) - 1); \
} while (0)
#define m_flags
Definition: user_mbuf.h:249
const GLfloat * m
Definition: gl2ext.h:850
OPENSSL_EXPORT const ASN1_OBJECT int const unsigned char int len
Definition: x509.h:1053
#define M_PKTHDR
Definition: user_mbuf.h:262
#define M_EXT
Definition: user_mbuf.h:261
#define m_data
Definition: user_mbuf.h:247
#define m_dat
Definition: user_mbuf.h:255
#define MLEN
Definition: user_mbuf.h:166

◆ M_BCAST

#define M_BCAST   0x0200 /* send/received as link-level broadcast */

◆ M_COPYALL

#define M_COPYALL   1000000000

◆ M_COPYFLAGS

#define M_COPYFLAGS
Value:
M_PROTO3|M_PROTO4|M_PROTO5|\
M_VLANTAG|M_PROMISC)
#define M_PROTO1
Definition: user_mbuf.h:265
#define M_PROTO4
Definition: user_mbuf.h:268
#define M_RDONLY
Definition: user_mbuf.h:264
#define M_EOR
Definition: user_mbuf.h:263
#define M_MCAST
Definition: user_mbuf.h:286
#define M_PKTHDR
Definition: user_mbuf.h:262
#define M_PROTO5
Definition: user_mbuf.h:269
#define M_FRAG
Definition: user_mbuf.h:287
#define M_PROTO2
Definition: user_mbuf.h:266
#define M_PROMISC
Definition: user_mbuf.h:291
#define M_FIRSTFRAG
Definition: user_mbuf.h:288
#define M_LASTFRAG
Definition: user_mbuf.h:289

◆ m_dat

#define m_dat   M_dat.M_databuf

◆ m_data

#define m_data   m_hdr.mh_data

◆ M_EOR

#define M_EOR   0x0004 /* end of record */

◆ m_ext

#define m_ext   M_dat.MH.MH_dat.MH_ext

◆ M_EXT

#define M_EXT   0x0001 /* has associated external storage */

◆ M_FIRSTFRAG

#define M_FIRSTFRAG   0x1000 /* packet is first fragment */

◆ m_flags

#define m_flags   m_hdr.mh_flags

◆ M_FRAG

#define M_FRAG   0x0800 /* packet is a fragment of a larger packet */

◆ M_FREELIST

#define M_FREELIST   0x8000 /* mbuf is on the free list */

◆ M_HDR_PAD

#define M_HDR_PAD   ((sizeof(intptr_t)==4) ? 2 : 6) /* modified for __Userspace__ */

◆ M_LASTFRAG

#define M_LASTFRAG   0x2000 /* packet is last fragment */

◆ M_LEADINGSPACE

#define M_LEADINGSPACE (   m)
Value:
((m)->m_flags & M_EXT ? \
(M_WRITABLE(m) ? (m)->m_data - (m)->m_ext.ext_buf : 0): \
(m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
(m)->m_data - (m)->m_dat)
#define m_flags
Definition: user_mbuf.h:249
const GLfloat * m
Definition: gl2ext.h:850
#define M_PKTHDR
Definition: user_mbuf.h:262
#define M_EXT
Definition: user_mbuf.h:261
#define m_data
Definition: user_mbuf.h:247
#define M_WRITABLE(m)
Definition: user_mbuf.h:360

◆ m_len

#define m_len   m_hdr.mh_len

◆ M_MAXCOMPRESS

#define M_MAXCOMPRESS   (MHLEN / 2) /* max amount to copy for compression */

◆ M_MCAST

#define M_MCAST   0x0400 /* send/received as link-level multicast */

◆ M_MOVE_PKTHDR

#define M_MOVE_PKTHDR (   to,
  from 
)    m_move_pkthdr((to), (from))

◆ m_next

#define m_next   m_hdr.mh_next

◆ m_nextpkt

#define m_nextpkt   m_hdr.mh_nextpkt

◆ M_NOFREE

#define M_NOFREE   0x40000 /* do not free mbuf - it is embedded in the cluster */

◆ m_pktdat

#define m_pktdat   M_dat.MH.MH_dat.MH_databuf

◆ m_pkthdr

#define m_pkthdr   M_dat.MH.MH_pkthdr

◆ M_PKTHDR

#define M_PKTHDR   0x0002 /* start of record */

◆ M_PREPEND

#define M_PREPEND (   m,
  plen,
  how 
)
Value:
do { \
struct mbuf **_mmp = &(m); \
struct mbuf *_mm = *_mmp; \
int _mplen = (plen); \
int __mhow = (how); \
if (M_LEADINGSPACE(_mm) >= _mplen) { \
_mm->m_data -= _mplen; \
_mm->m_len += _mplen; \
} else \
_mm = m_prepend(_mm, _mplen, __mhow); \
if (_mm != NULL && _mm->m_flags & M_PKTHDR) \
_mm->m_pkthdr.len += _mplen; \
*_mmp = _mm; \
} while (0)
#define M_LEADINGSPACE(m)
Definition: user_mbuf.h:372
const GLfloat * m
Definition: gl2ext.h:850
if(!isset( $GET[ 'random_id']))
Definition: cacheable-random-text.php:7
struct mbuf * m_prepend(struct mbuf *, int, int)
Definition: user_mbuf.c:1187
#define M_PKTHDR
Definition: user_mbuf.h:262
Definition: user_mbuf.h:231
#define NULL
Definition: common_types.h:41
plen
Definition: parse_delay_file.m:33

◆ M_PROMISC

#define M_PROMISC   0x20000 /* packet was not for us */

◆ M_PROTO1

#define M_PROTO1   0x0010 /* protocol-specific */

◆ M_PROTO2

#define M_PROTO2   0x0020 /* protocol-specific */

◆ M_PROTO3

#define M_PROTO3   0x0040 /* protocol-specific */

◆ M_PROTO4

#define M_PROTO4   0x0080 /* protocol-specific */

◆ M_PROTO5

#define M_PROTO5   0x0100 /* protocol-specific */

◆ M_RDONLY

#define M_RDONLY   0x0008 /* associated data is marked read-only */

◆ M_TRAILINGSPACE

#define M_TRAILINGSPACE (   m)
Value:
((m)->m_flags & M_EXT ? \
(M_WRITABLE(m) ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size \
- ((m)->m_data + (m)->m_len) : 0) : \
&(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
#define m_len
Definition: user_mbuf.h:246
#define m_flags
Definition: user_mbuf.h:249
const GLfloat * m
Definition: gl2ext.h:850
#define M_EXT
Definition: user_mbuf.h:261
Definition: user_mbuf.h:216
#define m_data
Definition: user_mbuf.h:247
caddr_t ext_buf
Definition: user_mbuf.h:217
#define m_dat
Definition: user_mbuf.h:255
#define M_WRITABLE(m)
Definition: user_mbuf.h:360
#define MLEN
Definition: user_mbuf.h:166

◆ m_type

#define m_type   m_hdr.mh_type

◆ M_VLANTAG

#define M_VLANTAG   0x10000 /* ether_vtag is valid */

◆ M_WRITABLE

#define M_WRITABLE (   m)
Value:
(!((m)->m_flags & M_RDONLY) && \
(!(((m)->m_flags & M_EXT)) || \
(*((m)->m_ext.ref_cnt) == 1)) ) \
#define m_flags
Definition: user_mbuf.h:249
const GLfloat * m
Definition: gl2ext.h:850
#define M_RDONLY
Definition: user_mbuf.h:264
#define M_EXT
Definition: user_mbuf.h:261

◆ MBTOM

#define MBTOM (   how)    (how)

◆ MBUF_CLUSTER_MEM_NAME

#define MBUF_CLUSTER_MEM_NAME   "mbuf_cluster"

◆ MBUF_EXTREFCNT_MEM_NAME

#define MBUF_EXTREFCNT_MEM_NAME   "mbuf_ext_refcnt"

◆ MBUF_MEM_NAME

#define MBUF_MEM_NAME   "mbuf"

◆ MCLBYTES

#define MCLBYTES   2048

◆ MCLGET

#define MCLGET (   m,
  how 
)    m_clget((m), (how))

◆ MGET

#define MGET (   m,
  how,
  type 
)    ((m) = m_get((how), (type)))

◆ MGETHDR

#define MGETHDR (   m,
  how,
  type 
)    ((m) = m_gethdr((how), (type)))

◆ MH_ALIGN

#define MH_ALIGN (   m,
  len 
)
Value:
do { \
KASSERT((m)->m_flags & M_PKTHDR && !((m)->m_flags & M_EXT), \
("%s: MH_ALIGN not PKTHDR mbuf", __func__)); \
KASSERT((m)->m_data == (m)->m_pktdat, \
("%s: MH_ALIGN not a virgin mbuf", __func__)); \
(m)->m_data += (MHLEN - (len)) & ~(sizeof(long) - 1); \
} while (0)
#define MHLEN
Definition: user_mbuf.h:167
#define m_flags
Definition: user_mbuf.h:249
const GLfloat * m
Definition: gl2ext.h:850
#define m_pktdat
Definition: user_mbuf.h:254
OPENSSL_EXPORT const ASN1_OBJECT int const unsigned char int len
Definition: x509.h:1053
#define M_PKTHDR
Definition: user_mbuf.h:262
#define M_EXT
Definition: user_mbuf.h:261
#define m_data
Definition: user_mbuf.h:247

◆ MHLEN

#define MHLEN   ((int)(MLEN - sizeof(struct pkthdr))) /* data len w/pkthdr */

◆ MINCLSIZE

#define MINCLSIZE   ((int)(MHLEN + 1)) /* smallest amount to put in cluster */

◆ MLEN

#define MLEN   ((int)(MSIZE - sizeof(struct m_hdr))) /* normal data len */

◆ MSIZE

#define MSIZE   256

◆ MT_CONTROL

#define MT_CONTROL   14 /* extra-data protocol message */

◆ MT_DATA

#define MT_DATA   1 /* dynamic (data) allocation */

◆ MT_HEADER

#define MT_HEADER   MT_DATA /* packet header, use M_PKTHDR instead */

◆ MT_NOINIT [1/2]

#define MT_NOINIT
Value:
255 /* Not a type but a flag to allocate
a non-initialized mbuf */

◆ MT_NOINIT [2/2]

#define MT_NOINIT
Value:
255 /* Not a type but a flag to allocate
a non-initialized mbuf */

◆ MT_NOTMBUF

#define MT_NOTMBUF   0 /* USED INTERNALLY ONLY! Object is not mbuf */

◆ MT_NTYPES

#define MT_NTYPES   16 /* number of mbuf types for mbtypes[] */

◆ MT_OOBDATA

#define MT_OOBDATA   15 /* expedited data */

◆ MT_SONAME

#define MT_SONAME   8 /* socket name */

◆ mtod

#define mtod (   m,
  t 
)    ((t)((m)->m_data))

◆ USING_MBUF_CONSTRUCTOR

#define USING_MBUF_CONSTRUCTOR   0

Typedef Documentation

◆ sctp_zone_t

typedef umem_cache_t* sctp_zone_t

Function Documentation

◆ m_adj()

void m_adj ( struct mbuf ,
int   
)

◆ m_cat()

void m_cat ( struct mbuf m,
struct mbuf n 
)

◆ m_clget()

void m_clget ( struct mbuf m,
int  how 
)

◆ m_copyback()

void m_copyback ( struct mbuf ,
int  ,
int  ,
caddr_t   
)

◆ m_copydata()

void m_copydata ( const struct mbuf ,
int  ,
int  ,
caddr_t   
)

◆ m_copym()

struct mbuf* m_copym ( struct mbuf ,
int  ,
int  ,
int   
)

◆ m_dup_pkthdr()

int m_dup_pkthdr ( struct mbuf ,
struct mbuf ,
int   
)

◆ m_free()

struct mbuf* m_free ( struct mbuf m)

◆ m_freem()

void m_freem ( struct mbuf )

◆ m_get()

struct mbuf* m_get ( int  how,
short  type 
)

◆ m_gethdr()

struct mbuf* m_gethdr ( int  how,
short  type 
)

◆ m_move_pkthdr()

void m_move_pkthdr ( struct mbuf ,
struct mbuf  
)

◆ m_prepend()

struct mbuf* m_prepend ( struct mbuf ,
int  ,
int   
)

◆ m_pulldown()

struct mbuf* m_pulldown ( struct mbuf ,
int  off,
int  len,
int *  offp 
)

◆ m_pullup()

struct mbuf* m_pullup ( struct mbuf ,
int   
)

◆ m_split()

struct mbuf* m_split ( struct mbuf ,
int  ,
int   
)

◆ m_tag_alloc()

struct m_tag* m_tag_alloc ( u_int32_t  ,
int  ,
int  ,
int   
)

◆ m_tag_copy()

struct m_tag* m_tag_copy ( struct m_tag ,
int   
)

◆ m_tag_copy_chain()

int m_tag_copy_chain ( struct mbuf ,
struct mbuf ,
int   
)

◆ m_tag_delete()

void m_tag_delete ( struct mbuf ,
struct m_tag  
)

◆ m_tag_delete_chain()

void m_tag_delete_chain ( struct mbuf ,
struct m_tag  
)

◆ m_tag_free_default()

void m_tag_free_default ( struct m_tag )

◆ mb_free_ext()

void mb_free_ext ( struct mbuf )

◆ mbuf_init()

void mbuf_init ( void )

Variable Documentation

◆ max_linkhdr

int max_linkhdr

◆ max_protohdr

int max_protohdr

◆ mbstat

struct mbstat mbstat

◆ zone_clust

sctp_zone_t zone_clust

◆ zone_ext_refcnt

sctp_zone_t zone_ext_refcnt

◆ zone_mbuf

sctp_zone_t zone_mbuf