]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ngatm/man/uniaddr.3
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ngatm / man / uniaddr.3
1 .\"
2 .\" Copyright (c) 2004-2005
3 .\"     Hartmut Brandt.
4 .\"     All rights reserved.
5 .\" Copyright (c) 2001-2003
6 .\"     Fraunhofer Institute for Open Communication Systems (FhG Fokus).
7 .\"     All rights reserved.
8 .\"
9 .\" Author: Hartmut Brandt <harti@FreeBSD.org>
10 .\"
11 .\" Redistribution and use in source and binary forms, with or without
12 .\" modification, are permitted provided that the following conditions
13 .\" are met:
14 .\" 1. Redistributions of source code must retain the above copyright
15 .\"    notice, this list of conditions and the following disclaimer.
16 .\" 2. Redistributions in binary form must reproduce the above copyright
17 .\"    notice, this list of conditions and the following disclaimer in the
18 .\"    documentation and/or other materials provided with the distribution.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" $Begemot: libunimsg/man/uniaddr.3,v 1.6 2005/06/15 11:37:08 brandt_h Exp $
33 .\"
34 .Dd June 14, 2005
35 .Dt UNIADDR 3
36 .Os
37 .Sh NAME
38 .Nm unimsg ,
39 .Nm uni_str2nsap ,
40 .Nm uni_nsap2str ,
41 .Nm uni_prefix2str ,
42 .Nm uni_e1642nsap ,
43 .Nm uni_nsap2e164
44 .Nd "ATM signalling library - address handling"
45 .Sh LIBRARY
46 Begemot ATM signalling library
47 .Pq libunimsg, -lunimsg
48 .Sh SYNOPSIS
49 .In netnatm/addr.h
50 .Ft int
51 .Fn uni_str2nsap "u_char *nsap" "const char *str"
52 .Ft void
53 .Fn uni_nsap2str "char *str" "const u_char *nsap" "int dots"
54 .Ft void
55 .Fn uni_prefix2str "char *str" "const u_char *prefix" "u_int len" "int dots"
56 .Ft int
57 .Fn uni_e1642nsap "u_char *nsap" "const char *e164"
58 .Ft int
59 .Fn uni_nsap2e164 "char *e164" "const u_char *nsap" "int check"
60 .Sh DESCRIPTION
61 The UNI message library contains a number of utility functions to handle
62 NSAP and E.164 addresses.
63 .Pp
64 The function
65 .Fn uni_str2nsap
66 parses a string and interprets it as an NSAP address.
67 The string should consist of exact 40 hexadecimal digits
68 (upper and lower case are allowed) and any
69 number of dots at any position.
70 Any other character is illegal.
71 The resulting NSAP address is written to the buffer pointed to by
72 .Fa nsap .
73 This buffer should be at least 20 bytes.
74 On success the funtion returns 0.
75 If an parsing error happens -1 is returned.
76 .Pp
77 The function
78 .Fn uni_nsap2str
79 converts the NSAP address pointed to by
80 .Fa nsap
81 into a string.
82 For some commonly used NSAP formats (those with leading
83 octets 0x39, 0x45 or 0x47) dots may be inserted to make the address more
84 readable by passing a non-0 value in
85 .Fa dots .
86 The buffer pointed to by
87 .Fa str
88 should be large enough to hold the resulting string plus the terminating NUL.
89 A size of 80 byte is large enough for all cases.
90 .Pp
91 The function
92 .Fn uni_prefix2str
93 converts an NSAP prefix to a string.
94 The length of the NSAP prefix in bytes is passed in
95 .Fa len .
96 .Li "uni_nsap2str(str, nsap, dots)"
97 is equivalent to
98 .Li "uni_prefix2str(str, nsap, 20, dots)" .
99 .Pp
100 The function
101 .Fn uni_e1642nsap
102 converts an E.164 address given as an ASCII string to an embedded E.164 NSAP
103 address.
104 The string pointed to by
105 .Fa e164
106 must consist of at least 1 and not more than 15 ASCII digits.
107 The function returns 0 on success and -1 if the E.164 address was malformed.
108 .Pp
109 The function
110 .Fn uni_nsap2e164
111 extracts the E.164 address from an embedded E.164 NSAP address.
112 The argument
113 .Fa check
114 specifies whether the NSAP address should be checked for correct syntax.
115 If
116 .Fa check
117 is 0 the last 11 bytes of the address are ignored.
118 If
119 .Fa check
120 is 1 the last 11 bytes except the selector byte must be zero.
121 If
122 .Fa check
123 is 2 the last 11 bytes must be zero.
124 The function returns 0 on success and -1 when the NSAP address was not an
125 embedded E.164 NSAP or one of the additional checks failed.
126 .Sh SEE ALSO
127 .Xr libngatm 3
128 .Sh AUTHORS
129 .An Hartmut Brandt Aq harti@FreeBSD.org