* Whitespace cleanup. No functional change.
* Use C++ comment styles. * Use a common pointer orientation throughout the code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34693 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
fafb321062
commit
92d96f0105
@ -17,11 +17,80 @@
|
||||
|
||||
#define MINCLSIZE (MHLEN + 1)
|
||||
|
||||
#define MBTOM(how) (how)
|
||||
#define M_DONTWAIT M_NOWAIT
|
||||
#define M_TRYWAIT M_WAITOK
|
||||
#define M_WAIT M_WAITOK
|
||||
|
||||
#define MT_DATA 1
|
||||
|
||||
#define M_EXT 0x00000001
|
||||
#define M_PKTHDR 0x00000002
|
||||
#define M_RDONLY 0x00000008
|
||||
#define M_PROTO1 0x00000010
|
||||
#define M_PROTO2 0x00000020
|
||||
#define M_PROTO3 0x00000040
|
||||
#define M_PROTO4 0x00000080
|
||||
#define M_PROTO5 0x00000100
|
||||
#define M_BCAST 0x00000200
|
||||
#define M_MCAST 0x00000400
|
||||
#define M_FRAG 0x00000800
|
||||
#define M_FIRSTFRAG 0x00001000
|
||||
#define M_LASTFRAG 0x00002000
|
||||
#define M_VLANTAG 0x00010000
|
||||
#define M_PROTO6 0x00080000
|
||||
#define M_PROTO7 0x00100000
|
||||
#define M_PROTO8 0x00200000
|
||||
|
||||
#define M_COPYFLAGS (M_PKTHDR | M_RDONLY | M_BCAST | M_MCAST | M_FRAG \
|
||||
| M_FIRSTFRAG | M_LASTFRAG | M_VLANTAG)
|
||||
// Flags preserved when copying m_pkthdr
|
||||
|
||||
#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 mtod(m, type) ((type)((m)->m_data))
|
||||
|
||||
// Check if the supplied mbuf has a packet header, or else panic.
|
||||
#define M_ASSERTPKTHDR(m) KASSERT(m != NULL && m->m_flags & M_PKTHDR, \
|
||||
("%s: no mbuf packet header!", __func__))
|
||||
|
||||
#define MBUF_CHECKSLEEP(how) do { } while (0)
|
||||
|
||||
#define MTAG_PERSISTENT 0x800
|
||||
|
||||
#define EXT_CLUSTER 1 // 2048 bytes
|
||||
#define EXT_JUMBOP 4 // Page size
|
||||
#define EXT_JUMBO9 5 // 9 * 1024 bytes
|
||||
#define EXT_NET_DRV 100 // custom ext_buf provided by net driver
|
||||
|
||||
#define CSUM_IP 0x0001
|
||||
#define CSUM_TCP 0x0002
|
||||
#define CSUM_UDP 0x0004
|
||||
#define CSUM_TSO 0x0020
|
||||
#define CSUM_IP_CHECKED 0x0100
|
||||
#define CSUM_IP_VALID 0x0200
|
||||
#define CSUM_DATA_VALID 0x0400
|
||||
#define CSUM_PSEUDO_HDR 0x0800
|
||||
#define CSUM_DELAY_DATA (CSUM_TCP | CSUM_UDP)
|
||||
|
||||
// TODO After all network driver are updated to the FreeBSD 8 version this can
|
||||
// changed
|
||||
#if __FreeBSD_version__ >= 8
|
||||
#define MEXTADD(m, buf, size, free, arg1, arg2, flags, type) \
|
||||
m_extadd((m), (caddr_t)(buf), (size), (free),(arg1),(arg2),(flags), (type))
|
||||
#else
|
||||
#define MEXTADD(m, buf, size, free, args, flags, type) \
|
||||
m_extadd((m), (caddr_t)(buf), (size), (free),(args),(flags), (type))
|
||||
#endif
|
||||
|
||||
|
||||
extern int max_linkhdr;
|
||||
extern int max_protohdr;
|
||||
extern int max_hdr;
|
||||
extern int max_datalen; /* MHLEN - max_hdr */
|
||||
extern int max_datalen; // MHLEN - max_hdr
|
||||
|
||||
|
||||
struct m_hdr {
|
||||
@ -44,11 +113,11 @@ struct pkthdr {
|
||||
};
|
||||
|
||||
struct m_tag {
|
||||
SLIST_ENTRY(m_tag) m_tag_link; /* List of packet tags */
|
||||
u_int16_t m_tag_id; /* Tag ID */
|
||||
u_int16_t m_tag_len; /* Length of data */
|
||||
u_int32_t m_tag_cookie; /* ABI/Module ID */
|
||||
void (*m_tag_free)(struct m_tag *);
|
||||
SLIST_ENTRY(m_tag) m_tag_link; // List of packet tags
|
||||
u_int16_t m_tag_id; // Tag ID
|
||||
u_int16_t m_tag_len; // Length of data
|
||||
u_int32_t m_tag_cookie; // ABI/Module ID
|
||||
void (*m_tag_free)(struct m_tag*);
|
||||
};
|
||||
|
||||
struct m_ext {
|
||||
@ -71,172 +140,97 @@ struct mbuf {
|
||||
} M_dat;
|
||||
};
|
||||
|
||||
#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_DONTWAIT M_NOWAIT
|
||||
#define M_TRYWAIT M_WAITOK
|
||||
#define M_WAIT M_WAITOK
|
||||
#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 MT_DATA 1
|
||||
|
||||
#define M_EXT 0x00000001
|
||||
#define M_PKTHDR 0x00000002
|
||||
#define M_RDONLY 0x00000008
|
||||
#define M_PROTO1 0x00000010 /* protocol-specific */
|
||||
#define M_PROTO2 0x00000020 /* protocol-specific */
|
||||
#define M_PROTO3 0x00000040 /* protocol-specific */
|
||||
#define M_PROTO4 0x00000080 /* protocol-specific */
|
||||
#define M_PROTO5 0x00000100 /* protocol-specific */
|
||||
#define M_BCAST 0x00000200
|
||||
#define M_MCAST 0x00000400
|
||||
#define M_FRAG 0x00000800
|
||||
#define M_FIRSTFRAG 0x00001000
|
||||
#define M_LASTFRAG 0x00002000
|
||||
#define M_VLANTAG 0x00010000
|
||||
#define M_PROTO6 0x00080000 /* protocol-specific */
|
||||
#define M_PROTO7 0x00100000 /* protocol-specific */
|
||||
#define M_PROTO8 0x00200000 /* protocol-specific */
|
||||
|
||||
/*
|
||||
* Flags preserved when copying m_pkthdr.
|
||||
*/
|
||||
#define M_COPYFLAGS \
|
||||
(M_PKTHDR|M_RDONLY|M_BCAST|M_MCAST|\
|
||||
M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG)
|
||||
|
||||
#define EXT_CLUSTER 1 /* 2048 bytes */
|
||||
#define EXT_JUMBOP 4 /* Page size */
|
||||
#define EXT_JUMBO9 5 /* 9 * 1024 bytes */
|
||||
#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver */
|
||||
|
||||
#define CSUM_IP 0x0001
|
||||
#define CSUM_TCP 0x0002
|
||||
#define CSUM_UDP 0x0004
|
||||
#define CSUM_TSO 0x0020
|
||||
#define CSUM_IP_CHECKED 0x0100
|
||||
#define CSUM_IP_VALID 0x0200
|
||||
#define CSUM_DATA_VALID 0x0400
|
||||
#define CSUM_PSEUDO_HDR 0x0800
|
||||
#define CSUM_DELAY_DATA (CSUM_TCP | CSUM_UDP)
|
||||
|
||||
#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 mtod(m, type) ((type)((m)->m_data))
|
||||
|
||||
/* Check if the supplied mbuf has a packet header, or else panic. */
|
||||
#define M_ASSERTPKTHDR(m) \
|
||||
KASSERT(m != NULL && m->m_flags & M_PKTHDR, \
|
||||
("%s: no mbuf packet header!", __func__))
|
||||
|
||||
#define MBUF_CHECKSLEEP(how) do { } while (0)
|
||||
#define MBTOM(how) (how)
|
||||
|
||||
#define MTAG_PERSISTENT 0x800
|
||||
|
||||
// TODO After all network driver are updated to the FreeBSD 8 version this can
|
||||
// changed
|
||||
#if __FreeBSD_version__ >= 8
|
||||
#define MEXTADD(m, buf, size, free, arg1, arg2, flags, type) \
|
||||
m_extadd((m), (caddr_t)(buf), (size), (free),(arg1),(arg2),(flags), (type))
|
||||
#else
|
||||
#define MEXTADD(m, buf, size, free, args, flags, type) \
|
||||
m_extadd((m), (caddr_t)(buf), (size), (free),(args),(flags), (type))
|
||||
#endif
|
||||
|
||||
void m_adj(struct mbuf*, int);
|
||||
void m_align(struct mbuf*, int);
|
||||
void m_cat(struct mbuf*, struct mbuf*);
|
||||
void m_clget(struct mbuf*, int);
|
||||
void m_clget(struct mbuf*, int);
|
||||
void* m_cljget(struct mbuf*, int, int);
|
||||
struct mbuf* m_collapse(struct mbuf*, int, int);
|
||||
void m_copyback(struct mbuf*, int, int, caddr_t);
|
||||
void m_copydata(const struct mbuf*, int, int, caddr_t);
|
||||
struct mbuf* m_collapse(struct mbuf*, int, int);
|
||||
void m_copyback(struct mbuf*, int, int, caddr_t);
|
||||
void m_copydata(const struct mbuf*, int, int, caddr_t);
|
||||
struct mbuf* m_copypacket(struct mbuf*, int);
|
||||
struct mbuf* m_defrag(struct mbuf*, int);
|
||||
struct mbuf* m_defrag(struct mbuf*, int);
|
||||
struct mbuf* m_devget(char*, int, int, struct ifnet*,
|
||||
void(*) (char*, caddr_t, u_int));
|
||||
void(*) (char*, caddr_t, u_int));
|
||||
|
||||
struct mbuf* m_dup(struct mbuf*, int);
|
||||
int m_dup_pkthdr(struct mbuf*, struct mbuf*, int);
|
||||
int m_dup_pkthdr(struct mbuf*, struct mbuf*, int);
|
||||
|
||||
// TODO After all network driver are updated to the FreeBSD 8 version this can
|
||||
// changed
|
||||
#if __FreeBSD_version__ >= 8
|
||||
void m_extadd(struct mbuf*, caddr_t, u_int,
|
||||
void(*) (void*, void*), void*, void*, int, int);
|
||||
void m_extadd(struct mbuf*, caddr_t, u_int, void(*) (void*, void*),
|
||||
void*, void*, int, int);
|
||||
#else
|
||||
void m_extadd(struct mbuf*, caddr_t, u_int,
|
||||
void(*) (void*, void*), void*, int, int);
|
||||
void m_extadd(struct mbuf*, caddr_t, u_int, void(*) (void*, void*),
|
||||
void*, int, int);
|
||||
#endif
|
||||
|
||||
u_int m_fixhdr(struct mbuf*);
|
||||
struct mbuf* m_free(struct mbuf*);
|
||||
void m_freem(struct mbuf*);
|
||||
u_int m_fixhdr(struct mbuf*);
|
||||
struct mbuf* m_free(struct mbuf*);
|
||||
void m_freem(struct mbuf*);
|
||||
struct mbuf* m_get(int, short);
|
||||
struct mbuf* m_gethdr(int, short);
|
||||
struct mbuf* m_getjcl(int, short, int, int);
|
||||
u_int m_length(struct mbuf*, struct mbuf**);
|
||||
struct mbuf* m_getcl(int, short, int);
|
||||
void m_move_pkthdr(struct mbuf*, struct mbuf*);
|
||||
struct mbuf* m_prepend(struct mbuf *, int, int);
|
||||
u_int m_length(struct mbuf*, struct mbuf**);
|
||||
struct mbuf* m_getcl(int, short, int);
|
||||
void m_move_pkthdr(struct mbuf*, struct mbuf*);
|
||||
struct mbuf* m_prepend(struct mbuf*, int, int);
|
||||
struct mbuf* m_pulldown(struct mbuf*, int, int, int*);
|
||||
struct mbuf* m_pullup(struct mbuf*, int);
|
||||
struct mbuf* m_split(struct mbuf*, int, int);
|
||||
struct mbuf* m_unshare(struct mbuf*, int);
|
||||
|
||||
/* Packet tag routines. */
|
||||
struct m_tag* m_tag_alloc(u_int32_t, int, int, int);
|
||||
void m_tag_delete(struct mbuf*, struct m_tag*);
|
||||
void m_tag_delete_chain(struct mbuf*, struct m_tag*);
|
||||
void m_tag_free_default(struct m_tag*);
|
||||
struct m_tag* m_tag_locate(struct mbuf*, u_int32_t, int, struct m_tag*);
|
||||
struct m_tag* m_tag_copy(struct m_tag*, int);
|
||||
int m_tag_copy_chain(struct mbuf*, struct mbuf*, int);
|
||||
void m_tag_delete_nonpersistent(struct mbuf*);
|
||||
void m_tag_delete(struct mbuf*, struct m_tag*);
|
||||
void m_tag_delete_chain(struct mbuf*, struct m_tag*);
|
||||
void m_tag_free_default(struct m_tag*);
|
||||
struct m_tag* m_tag_locate(struct mbuf*, u_int32_t, int, struct m_tag*);
|
||||
struct m_tag* m_tag_copy(struct m_tag*, int);
|
||||
int m_tag_copy_chain(struct mbuf*, struct mbuf*, int);
|
||||
void m_tag_delete_nonpersistent(struct mbuf*);
|
||||
|
||||
|
||||
static __inline void
|
||||
static inline void
|
||||
m_tag_setup(struct m_tag* tagPointer, u_int32_t cookie, int type, int length)
|
||||
{
|
||||
|
||||
tagPointer->m_tag_id = type;
|
||||
tagPointer->m_tag_len = length;
|
||||
tagPointer->m_tag_cookie = cookie;
|
||||
}
|
||||
|
||||
|
||||
static __inline void
|
||||
static inline void
|
||||
m_tag_free(struct m_tag* tag)
|
||||
{
|
||||
|
||||
(*tag->m_tag_free)(tag);
|
||||
}
|
||||
|
||||
|
||||
static __inline void
|
||||
static inline void
|
||||
m_tag_prepend(struct mbuf* memoryBuffer, struct m_tag* tag)
|
||||
{
|
||||
|
||||
SLIST_INSERT_HEAD(&memoryBuffer->m_pkthdr.tags, tag, m_tag_link);
|
||||
}
|
||||
|
||||
|
||||
static __inline void
|
||||
static inline void
|
||||
m_tag_unlink(struct mbuf* memoryBuffer, struct m_tag* tag)
|
||||
{
|
||||
|
||||
SLIST_REMOVE(&memoryBuffer->m_pkthdr.tags, tag, m_tag, m_tag_link);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user