1.\" 2.\" Copyright (c) 2004 3.\" Hartmut Brandt. 4.\" All rights reserved. 5.\" 6.\" Author: Hartmut Brandt <harti@FreeBSD.org> 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" SUCH DAMAGE. 28.\" 29.\" $FreeBSD$ 30.\" 31.\" ngatmbase(4) man page 32.\" 33.Dd August 24, 2004 34.Dt NGATMBASE 4 35.Os 36.Sh NAME 37.Nm ngatmbase 38.Nd netgraph ATM utility module 39.Sh SYNOPSIS 40.In netnatm/unimsg.h 41.In netgraph/atm/ngatmbase.h 42.Ft "struct mbuf *" 43.Fn uni_msg_pack_mbuf "struct uni_msg *msg" "void *hdr" "size_t len" 44.Ft "struct uni_msg *" 45.Fn uni_msg_alloc "size_t len" 46.Ft "struct uni_msg *" 47.Fn uni_msg_build "void *buf" ... 48.Ft void 49.Fn uni_msg_destroy "struct uni_msg *msg" 50.Ft int 51.Fn uni_msg_unpack_mbuf "struct mbuf *m" "struct uni_msg *msgp" 52.Sh DESCRIPTION 53This module provides utility functions for the handling of signalling 54messages to the NgATM modules. 55.Pp 56The 57.Fn uni_msg_pack_mbuf 58function 59packs a message into one or several 60.Vt mbuf Ns s 61optionally prepending a header. 62The header is given by its address 63.Fa hdr 64and length 65.Fa len . 66If 67.Fa hdr 68is 69.Dv NULL 70or 71.Fa len 72equals 0, no header is prepended. 73Either 74.Fa msg 75or 76.Fa hdr 77may be 78.Dv NULL 79but not both. 80The 81.Fn uni_msg_pack_mbuf 82function 83returns a pointer to the allocated 84.Vt mbuf 85chain or 86.Dv NULL 87in the case of an error. 88.Pp 89The 90.Fn uni_msg_alloc 91function 92allocates a new message with space for at least 93.Fa len 94bytes. 95In the case of an error 96.Dv NULL 97is returned. 98.Pp 99The 100.Fn uni_msg_build 101function constructs a message from pieces. 102Each piece is given by a pair of 103arguments, the first of type 104.Vt "void *" 105and the second a 106.Vt size_t . 107The list of pieces must be terminated by 108.Po Vt "void *" Pc Ns Dv NULL . 109.Pp 110The 111.Fn uni_msg_destroy 112function 113destroys the messages and frees all the messages's memory. 114.Pp 115The 116.Fn uni_msg_unpack_mbuf 117function 118unpacks an 119.Vt mbuf 120chain info a 121.Vt uni_msg . 122A pointer to the newly allocated message is stored in 123.Fa msgp 124and 0 is returned. 125In the case of an error (either when no packet header is found 126in the first mbuf or memory cannot be allocated) the function 127returns an appropriate error code. 128.Sh SEE ALSO 129.Xr ng_ccatm 4 , 130.Xr ng_sscfu 4 , 131.Xr ng_sscop 4 , 132.Xr ng_uni 4 133.Sh AUTHORS 134.An Harti Brandt Aq Mt harti@FreeBSD.org 135