Deleted Added
full compact
ng_message.h (67506) ng_message.h (68876)
1
2/*
3 * ng_message.h
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Julian Elischer <julian@freebsd.org>
38 *
1
2/*
3 * ng_message.h
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Julian Elischer <julian@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_message.h 67506 2000-10-24 17:32:45Z julian $
39 * $FreeBSD: head/sys/netgraph/ng_message.h 68876 2000-11-18 15:17:43Z dwmalone $
40 * $Whistle: ng_message.h,v 1.12 1999/01/25 01:17:44 archie Exp $
41 */
42
43#ifndef _NETGRAPH_NG_MESSAGE_H_
44#define _NETGRAPH_NG_MESSAGE_H_ 1
45
46/* ASCII string size limits */
47#define NG_TYPELEN 15 /* max type name len (16 with null) */

--- 239 unchanged lines hidden (view full) ---

287/*
288 * Allocate and initialize a netgraph message "msg" with "len"
289 * extra bytes of argument. Sets "msg" to NULL if fails.
290 * Does not initialize token.
291 */
292#define NG_MKMESSAGE(msg, cookie, cmdid, len, how) \
293 do { \
294 MALLOC((msg), struct ng_mesg *, sizeof(struct ng_mesg) \
40 * $Whistle: ng_message.h,v 1.12 1999/01/25 01:17:44 archie Exp $
41 */
42
43#ifndef _NETGRAPH_NG_MESSAGE_H_
44#define _NETGRAPH_NG_MESSAGE_H_ 1
45
46/* ASCII string size limits */
47#define NG_TYPELEN 15 /* max type name len (16 with null) */

--- 239 unchanged lines hidden (view full) ---

287/*
288 * Allocate and initialize a netgraph message "msg" with "len"
289 * extra bytes of argument. Sets "msg" to NULL if fails.
290 * Does not initialize token.
291 */
292#define NG_MKMESSAGE(msg, cookie, cmdid, len, how) \
293 do { \
294 MALLOC((msg), struct ng_mesg *, sizeof(struct ng_mesg) \
295 + (len), M_NETGRAPH, (how)); \
295 + (len), M_NETGRAPH, (how) | M_ZERO); \
296 if ((msg) == NULL) \
297 break; \
296 if ((msg) == NULL) \
297 break; \
298 bzero((msg), sizeof(struct ng_mesg) + (len)); \
299 (msg)->header.version = NG_VERSION; \
300 (msg)->header.typecookie = (cookie); \
301 (msg)->header.cmd = (cmdid); \
302 (msg)->header.arglen = (len); \
303 strncpy((msg)->header.cmdstr, #cmdid, \
304 sizeof((msg)->header.cmdstr) - 1); \
305 } while (0)
306
307/*
308 * Allocate and initialize a response "rsp" to a message "msg"
309 * with "len" extra bytes of argument. Sets "rsp" to NULL if fails.
310 */
311#define NG_MKRESPONSE(rsp, msg, len, how) \
312 do { \
313 MALLOC((rsp), struct ng_mesg *, sizeof(struct ng_mesg) \
298 (msg)->header.version = NG_VERSION; \
299 (msg)->header.typecookie = (cookie); \
300 (msg)->header.cmd = (cmdid); \
301 (msg)->header.arglen = (len); \
302 strncpy((msg)->header.cmdstr, #cmdid, \
303 sizeof((msg)->header.cmdstr) - 1); \
304 } while (0)
305
306/*
307 * Allocate and initialize a response "rsp" to a message "msg"
308 * with "len" extra bytes of argument. Sets "rsp" to NULL if fails.
309 */
310#define NG_MKRESPONSE(rsp, msg, len, how) \
311 do { \
312 MALLOC((rsp), struct ng_mesg *, sizeof(struct ng_mesg) \
314 + (len), M_NETGRAPH, (how)); \
313 + (len), M_NETGRAPH, (how) | M_ZERO); \
315 if ((rsp) == NULL) \
316 break; \
314 if ((rsp) == NULL) \
315 break; \
317 bzero((rsp), sizeof(struct ng_mesg) + (len)); \
318 (rsp)->header.version = NG_VERSION; \
319 (rsp)->header.arglen = (len); \
320 (rsp)->header.token = (msg)->header.token; \
321 (rsp)->header.typecookie = (msg)->header.typecookie; \
322 (rsp)->header.cmd = (msg)->header.cmd; \
323 bcopy((msg)->header.cmdstr, (rsp)->header.cmdstr, \
324 sizeof((rsp)->header.cmdstr)); \
325 (rsp)->header.flags |= NGF_RESP; \
326 } while (0)
327#endif /* _KERNEL */
328
329#endif /* _NETGRAPH_NG_MESSAGE_H_ */
330
316 (rsp)->header.version = NG_VERSION; \
317 (rsp)->header.arglen = (len); \
318 (rsp)->header.token = (msg)->header.token; \
319 (rsp)->header.typecookie = (msg)->header.typecookie; \
320 (rsp)->header.cmd = (msg)->header.cmd; \
321 bcopy((msg)->header.cmdstr, (rsp)->header.cmdstr, \
322 sizeof((rsp)->header.cmdstr)); \
323 (rsp)->header.flags |= NGF_RESP; \
324 } while (0)
325#endif /* _KERNEL */
326
327#endif /* _NETGRAPH_NG_MESSAGE_H_ */
328