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.\" ngatmbase(4) man page 30.\" 31.Dd March 3, 2023 32.Dt NGATMBASE 4 33.Os 34.Sh DEPRECATION NOTICE 35.Nm 36is deprecated and may not be available in 37.Fx 14.0 38and later. 39.Sh NAME 40.Nm ngatmbase 41.Nd netgraph ATM utility module 42.Sh SYNOPSIS 43.In netnatm/unimsg.h 44.In netgraph/atm/ngatmbase.h 45.Ft "struct mbuf *" 46.Fn uni_msg_pack_mbuf "struct uni_msg *msg" "void *hdr" "size_t len" 47.Ft "struct uni_msg *" 48.Fn uni_msg_alloc "size_t len" 49.Ft "struct uni_msg *" 50.Fn uni_msg_build "void *buf" ... 51.Ft void 52.Fn uni_msg_destroy "struct uni_msg *msg" 53.Ft int 54.Fn uni_msg_unpack_mbuf "struct mbuf *m" "struct uni_msg *msgp" 55.Sh DESCRIPTION 56This module provides utility functions for the handling of signalling 57messages to the NgATM modules. 58.Pp 59The 60.Fn uni_msg_pack_mbuf 61function 62packs a message into one or several 63.Vt mbuf Ns s 64optionally prepending a header. 65The header is given by its address 66.Fa hdr 67and length 68.Fa len . 69If 70.Fa hdr 71is 72.Dv NULL 73or 74.Fa len 75equals 0, no header is prepended. 76Either 77.Fa msg 78or 79.Fa hdr 80may be 81.Dv NULL 82but not both. 83The 84.Fn uni_msg_pack_mbuf 85function 86returns a pointer to the allocated 87.Vt mbuf 88chain or 89.Dv NULL 90in the case of an error. 91.Pp 92The 93.Fn uni_msg_alloc 94function 95allocates a new message with space for at least 96.Fa len 97bytes. 98In the case of an error 99.Dv NULL 100is returned. 101.Pp 102The 103.Fn uni_msg_build 104function constructs a message from pieces. 105Each piece is given by a pair of 106arguments, the first of type 107.Vt "void *" 108and the second a 109.Vt size_t . 110The list of pieces must be terminated by 111.Po Vt "void *" Pc Ns Dv NULL . 112.Pp 113The 114.Fn uni_msg_destroy 115function 116destroys the messages and frees all the messages's memory. 117.Pp 118The 119.Fn uni_msg_unpack_mbuf 120function 121unpacks an 122.Vt mbuf 123chain info a 124.Vt uni_msg . 125A pointer to the newly allocated message is stored in 126.Fa msgp 127and 0 is returned. 128In the case of an error (either when no packet header is found 129in the first mbuf or memory cannot be allocated) the function 130returns an appropriate error code. 131.Sh SEE ALSO 132.Xr ng_ccatm 4 , 133.Xr ng_sscfu 4 , 134.Xr ng_sscop 4 , 135.Xr ng_uni 4 136.Sh AUTHORS 137.An Harti Brandt Aq Mt harti@FreeBSD.org 138