]>
git.saurik.com Git - apple/xnu.git/blob - bsd/net/pf_pbuf.h
2 * Copyright (c) 2016 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
39 #define PBUF_ACTION_RV_SUCCESS 0
40 #define PBUF_ACTION_RV_FAILURE (-1)
43 uint8_t *pm_buffer
; // Pointer to start of buffer
44 u_int pm_buffer_len
; // Total length of buffer
45 u_int pm_offset
; // Offset to start of payload
46 u_int pm_len
; // Length of payload
47 uint32_t pm_csum_flags
;
48 uint32_t pm_csum_data
;
53 struct pf_mtag pm_pftag
;
54 int (*pm_action
)(struct pbuf_memory
*, enum pbuf_action
);
55 void *pm_action_cookie
;
59 enum pbuf_type pb_type
;
61 struct mbuf
*pbu_mbuf
;
62 struct pbuf_memory pbu_memory
;
64 #define pb_mbuf pb_u.pbu_mbuf
65 #define pb_memory pb_u.pbu_memory
68 uint32_t pb_packet_len
;
69 uint32_t pb_contig_len
;
70 uint32_t *pb_csum_flags
;
71 uint32_t *pb_csum_data
;
76 struct pf_mtag
*pb_pftag
;
81 #define pbuf_is_valid(pb) (!((pb) == NULL || (pb)->pb_type == PBUF_TYPE_ZOMBIE))
83 void pbuf_init_mbuf(pbuf_t
*, struct mbuf
*, struct ifnet
*);
84 void pbuf_init_memory(pbuf_t
*, const struct pbuf_memory
*,
86 void pbuf_destroy(pbuf_t
*);
87 void pbuf_sync(pbuf_t
*);
89 struct mbuf
*pbuf_to_mbuf(pbuf_t
*, boolean_t
);
90 struct mbuf
*pbuf_clone_to_mbuf(pbuf_t
*);
92 void * pbuf_ensure_contig(pbuf_t
*, size_t);
93 void * pbuf_ensure_writable(pbuf_t
*, size_t);
95 void * pbuf_resize_segment(pbuf_t
*, int off
, int olen
, int nlen
);
96 void * pbuf_contig_segment(pbuf_t
*, int off
, int len
);
98 void pbuf_copy_data(pbuf_t
*, int, int, void *);
99 void pbuf_copy_back(pbuf_t
*, int, int, void *);
101 uint16_t pbuf_inet_cksum(const pbuf_t
*, uint32_t, uint32_t, uint32_t);
102 uint16_t pbuf_inet6_cksum(const pbuf_t
*, uint32_t, uint32_t, uint32_t);
104 mbuf_svc_class_t
pbuf_get_service_class(const pbuf_t
*);
106 #endif /* __PBUF_H__ */