aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2023-03-09 18:04:02 +0000
committerBrooks Davis <brooks@FreeBSD.org>2023-03-09 18:04:02 +0000
commitaf0cc0b22362153357d7b6783f64c4a11b1b03fe (patch)
tree4a31f771ca76cb2339ecf965dee700ba04d13827
parentb2654064c2d11a1ee36667b3ff8b0f4d2536af74 (diff)
downloadsrc-af0cc0b22362153357d7b6783f64c4a11b1b03fe.tar.gz
src-af0cc0b22362153357d7b6783f64c4a11b1b03fe.zip
NgATM: Remove netgraph ATM support
Most ATM support was removed prior to FreeBSD 12. The netgraph support was kept as it was less intrusive, but it is presumed to be unused. Reviewed by: manu Relnotes: yes Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D38879
-rw-r--r--ObsoleteFiles.inc43
-rw-r--r--contrib/ngatm/FREEBSD-Xlist13
-rw-r--r--contrib/ngatm/FREEBSD-upgrade13
-rw-r--r--contrib/ngatm/libngatm/cccust.h49
-rw-r--r--contrib/ngatm/libngatm/net_in.fig74
-rw-r--r--contrib/ngatm/libngatm/net_out.fig76
-rw-r--r--contrib/ngatm/libngatm/sscfucust.h108
-rw-r--r--contrib/ngatm/libngatm/sscopcust.h255
-rw-r--r--contrib/ngatm/libngatm/unicust.h123
-rw-r--r--contrib/ngatm/libngatm/unimsg.c245
-rw-r--r--contrib/ngatm/man/libngatm.375
-rw-r--r--contrib/ngatm/man/uniaddr.3129
-rw-r--r--contrib/ngatm/man/unifunc.3255
-rw-r--r--contrib/ngatm/man/unimsg.3249
-rw-r--r--contrib/ngatm/man/unisap.3265
-rw-r--r--contrib/ngatm/man/unistruct.3323
-rw-r--r--contrib/ngatm/snmp_atm/BEGEMOT-ATM.txt301
-rw-r--r--contrib/ngatm/snmp_atm/atm.h96
-rw-r--r--contrib/ngatm/snmp_atm/atm_tree.def75
-rw-r--r--contrib/ngatm/snmp_atm/snmp_atm.3218
-rw-r--r--contrib/ngatm/snmp_atm/snmp_atm.c623
-rw-r--r--contrib/ngatm/snmp_atm/snmp_atm.h102
-rw-r--r--contrib/ngatm/sscop/common.c456
-rw-r--r--contrib/ngatm/sscop/common.h82
-rw-r--r--contrib/ngatm/sscop/sscop.1169
-rw-r--r--contrib/ngatm/sscop/sscop_main.c478
-rw-r--r--etc/mtree/BSD.include.dist10
-rw-r--r--lib/Makefile1
-rw-r--r--lib/libngatm/Makefile53
-rw-r--r--lib/libngatm/Makefile.depend17
-rw-r--r--share/man/man4/Makefile5
-rw-r--r--share/man/man4/netgraph.43
-rw-r--r--share/man/man4/ng_ccatm.4328
-rw-r--r--share/man/man4/ng_sscfu.4166
-rw-r--r--share/man/man4/ng_sscop.4408
-rw-r--r--share/man/man4/ng_uni.4425
-rw-r--r--share/man/man4/ngatmbase.4139
-rw-r--r--sys/conf/NOTES7
-rw-r--r--sys/conf/files54
-rw-r--r--sys/conf/options7
-rw-r--r--sys/contrib/ngatm/FREEBSD-Xlist15
-rw-r--r--sys/contrib/ngatm/FREEBSD-upgrade26
-rw-r--r--sys/contrib/ngatm/netnatm/addr.h42
-rw-r--r--sys/contrib/ngatm/netnatm/api/atmapi.h291
-rw-r--r--sys/contrib/ngatm/netnatm/api/cc_conn.c2096
-rw-r--r--sys/contrib/ngatm/netnatm/api/cc_data.c226
-rw-r--r--sys/contrib/ngatm/netnatm/api/cc_dump.c334
-rw-r--r--sys/contrib/ngatm/netnatm/api/cc_port.c923
-rw-r--r--sys/contrib/ngatm/netnatm/api/cc_sig.c350
-rw-r--r--sys/contrib/ngatm/netnatm/api/cc_user.c1922
-rw-r--r--sys/contrib/ngatm/netnatm/api/ccatm.h154
-rw-r--r--sys/contrib/ngatm/netnatm/api/ccpriv.h562
-rw-r--r--sys/contrib/ngatm/netnatm/api/unisap.c415
-rw-r--r--sys/contrib/ngatm/netnatm/api/unisap.h130
-rw-r--r--sys/contrib/ngatm/netnatm/genfiles15
-rw-r--r--sys/contrib/ngatm/netnatm/misc/straddr.c235
-rw-r--r--sys/contrib/ngatm/netnatm/misc/unimsg_common.c54
-rw-r--r--sys/contrib/ngatm/netnatm/msg/geniec.awk110
-rw-r--r--sys/contrib/ngatm/netnatm/msg/genieh.awk61
-rw-r--r--sys/contrib/ngatm/netnatm/msg/genmsgc.awk274
-rw-r--r--sys/contrib/ngatm/netnatm/msg/genmsgh.awk80
-rw-r--r--sys/contrib/ngatm/netnatm/msg/ie.def84
-rw-r--r--sys/contrib/ngatm/netnatm/msg/msg.def582
-rw-r--r--sys/contrib/ngatm/netnatm/msg/parseie.awk150
-rw-r--r--sys/contrib/ngatm/netnatm/msg/parsemsg.awk138
-rw-r--r--sys/contrib/ngatm/netnatm/msg/priv.h119
-rw-r--r--sys/contrib/ngatm/netnatm/msg/privmsg.c277
-rw-r--r--sys/contrib/ngatm/netnatm/msg/traffic.c406
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uni_config.h70
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uni_hdr.h220
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uni_ie.c7168
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uni_ie.h57
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uni_ietab.h958
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uni_msg.c4901
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uni_msg.h342
-rw-r--r--sys/contrib/ngatm/netnatm/msg/unimsglib.h168
-rw-r--r--sys/contrib/ngatm/netnatm/msg/uniprint.h72
-rw-r--r--sys/contrib/ngatm/netnatm/msg/unistruct.h1371
-rw-r--r--sys/contrib/ngatm/netnatm/saal/saal_sscfu.c577
-rw-r--r--sys/contrib/ngatm/netnatm/saal/saal_sscop.c4946
-rw-r--r--sys/contrib/ngatm/netnatm/saal/sscfu.h103
-rw-r--r--sys/contrib/ngatm/netnatm/saal/sscfudef.h73
-rw-r--r--sys/contrib/ngatm/netnatm/saal/sscfupriv.h66
-rw-r--r--sys/contrib/ngatm/netnatm/saal/sscop.h126
-rw-r--r--sys/contrib/ngatm/netnatm/saal/sscopdef.h159
-rw-r--r--sys/contrib/ngatm/netnatm/saal/sscoppriv.h318
-rw-r--r--sys/contrib/ngatm/netnatm/sig/genmsgcpyc.awk80
-rw-r--r--sys/contrib/ngatm/netnatm/sig/genmsgcpyh.awk55
-rw-r--r--sys/contrib/ngatm/netnatm/sig/sig_call.c4310
-rw-r--r--sys/contrib/ngatm/netnatm/sig/sig_coord.c1171
-rw-r--r--sys/contrib/ngatm/netnatm/sig/sig_party.c1353
-rw-r--r--sys/contrib/ngatm/netnatm/sig/sig_print.c622
-rw-r--r--sys/contrib/ngatm/netnatm/sig/sig_reset.c827
-rw-r--r--sys/contrib/ngatm/netnatm/sig/sig_uni.c749
-rw-r--r--sys/contrib/ngatm/netnatm/sig/sig_unimsgcpy.c594
-rw-r--r--sys/contrib/ngatm/netnatm/sig/sig_verify.c442
-rw-r--r--sys/contrib/ngatm/netnatm/sig/uni.h106
-rw-r--r--sys/contrib/ngatm/netnatm/sig/unidef.h480
-rw-r--r--sys/contrib/ngatm/netnatm/sig/unimkmsg.h159
-rw-r--r--sys/contrib/ngatm/netnatm/sig/unimsgcpy.h113
-rw-r--r--sys/contrib/ngatm/netnatm/sig/unipriv.h563
-rw-r--r--sys/contrib/ngatm/netnatm/sig/unisig.h49
-rw-r--r--sys/contrib/ngatm/netnatm/unimsg.h92
-rw-r--r--sys/modules/netgraph/Makefile1
-rw-r--r--sys/modules/netgraph/atm/Makefile10
-rw-r--r--sys/modules/netgraph/atm/Makefile.inc3
-rw-r--r--sys/modules/netgraph/atm/atmbase/Makefile20
-rw-r--r--sys/modules/netgraph/atm/ccatm/Makefile17
-rw-r--r--sys/modules/netgraph/atm/sscfu/Makefile14
-rw-r--r--sys/modules/netgraph/atm/sscop/Makefile13
-rw-r--r--sys/modules/netgraph/atm/uni/Makefile17
-rw-r--r--sys/netgraph/atm/ccatm/ng_ccatm.c1193
-rw-r--r--sys/netgraph/atm/ccatm/ng_ccatm_cust.h56
-rw-r--r--sys/netgraph/atm/ng_ccatm.h171
-rw-r--r--sys/netgraph/atm/ng_sscfu.h70
-rw-r--r--sys/netgraph/atm/ng_sscop.h111
-rw-r--r--sys/netgraph/atm/ng_uni.h121
-rw-r--r--sys/netgraph/atm/ngatmbase.c502
-rw-r--r--sys/netgraph/atm/ngatmbase.h64
-rw-r--r--sys/netgraph/atm/sscfu/ng_sscfu.c604
-rw-r--r--sys/netgraph/atm/sscfu/ng_sscfu_cust.h131
-rw-r--r--sys/netgraph/atm/sscop/ng_sscop.c874
-rw-r--r--sys/netgraph/atm/sscop/ng_sscop_cust.h344
-rw-r--r--sys/netgraph/atm/uni/ng_uni.c922
-rw-r--r--sys/netgraph/atm/uni/ng_uni_cust.h150
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc40
-rw-r--r--tools/regression/atm/Funcs.sh53
-rw-r--r--tools/regression/atm/README14
-rw-r--r--tools/regression/atm/RunTest.sh45
-rw-r--r--tools/regression/atm/proto_cc/RunTest.sh10
-rw-r--r--tools/regression/atm/proto_sscfu/RunTest.sh11
-rw-r--r--tools/regression/atm/proto_sscop/RunTest.sh10
-rw-r--r--tools/regression/atm/proto_uni/RunTest.sh12
-rw-r--r--usr.bin/Makefile1
-rw-r--r--usr.bin/atm/Makefile5
-rw-r--r--usr.bin/atm/Makefile.inc3
-rw-r--r--usr.bin/atm/sscop/Makefile13
-rw-r--r--usr.bin/atm/sscop/Makefile.depend19
138 files changed, 43 insertions, 55650 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 7bbd91525cd5..4da87568a0cc 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -52,6 +52,49 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20230309: remove remaining ATM support
+OLD_FILES+=usr/bin/sscop
+OLD_FILES+=usr/include/netnatm/addr.h
+OLD_FILES+=usr/include/netnatm/api/atmapi.h
+OLD_FILES+=usr/include/netnatm/api/ccatm.h
+OLD_FILES+=usr/include/netnatm/api/unisap.h
+OLD_DIRS+=usr/include/netnatm/api
+OLD_FILES+=usr/include/netnatm/msg/uni_config.h
+OLD_FILES+=usr/include/netnatm/msg/uni_hdr.h
+OLD_FILES+=usr/include/netnatm/msg/uni_ie.h
+OLD_FILES+=usr/include/netnatm/msg/uni_msg.h
+OLD_FILES+=usr/include/netnatm/msg/unimsglib.h
+OLD_FILES+=usr/include/netnatm/msg/uniprint.h
+OLD_FILES+=usr/include/netnatm/msg/unistruct.h
+OLD_DIRS+=usr/include/netnatm/msg
+OLD_FILES+=usr/include/netnatm/saal/sscfu.h
+OLD_FILES+=usr/include/netnatm/saal/sscfudef.h
+OLD_FILES+=usr/include/netnatm/saal/sscop.h
+OLD_FILES+=usr/include/netnatm/saal/sscopdef.h
+OLD_DIRS+=usr/include/netnatm/saal
+OLD_FILES+=usr/include/netnatm/sig/uni.h
+OLD_FILES+=usr/include/netnatm/sig/unidef.h
+OLD_FILES+=usr/include/netnatm/sig/unisig.h
+OLD_DIRS+=usr/include/netnatm/sig
+OLD_FILES+=usr/include/netnatm/unimsg.h
+OLD_DIRS+=usr/include/netnatm
+OLD_FILES+=usr/lib/libngatm.a
+OLD_FILES+=usr/lib/libngatm.so
+OLD_LIBS+=usr/lib/libngatm.so.4
+OLD_FILES+=usr/lib/libngatm_p.a
+OLD_FILES+=usr/share/man/man1/sscop.1.gz
+OLD_FILES+=usr/share/man/man3/libngatm.3.gz
+OLD_FILES+=usr/share/man/man3/uniaddr.3.gz
+OLD_FILES+=usr/share/man/man3/unifunc.3.gz
+OLD_FILES+=usr/share/man/man3/unimsg.3.gz
+OLD_FILES+=usr/share/man/man3/unisap.3.gz
+OLD_FILES+=usr/share/man/man3/unistruct.3.gz
+OLD_FILES+=usr/share/man/man4/ng_ccatm.4.gz
+OLD_FILES+=usr/share/man/man4/ng_sscfu.4.gz
+OLD_FILES+=usr/share/man/man4/ng_sscop.4.gz
+OLD_FILES+=usr/share/man/man4/ng_uni.4.gz
+OLD_FILES+=usr/share/man/man4/ngatmbase.4.gz
+
# 20230308: machine-id merged into hostid_save
OLD_FILES+=etc/rc.d/machine-id
diff --git a/contrib/ngatm/FREEBSD-Xlist b/contrib/ngatm/FREEBSD-Xlist
deleted file mode 100644
index 32e28ddb55fb..000000000000
--- a/contrib/ngatm/FREEBSD-Xlist
+++ /dev/null
@@ -1,13 +0,0 @@
-#$FreeBSD$
-*/VERSION
-*/README
-*/Makefile.in
-*/Makefile.pre
-*/Makefile.post
-*/aclocal.m4
-*/config
-*/configure
-*/configure.ac
-*/netnatm
-*/snmp_atm/atm_sys.c
-*/snmp_ilmid
diff --git a/contrib/ngatm/FREEBSD-upgrade b/contrib/ngatm/FREEBSD-upgrade
deleted file mode 100644
index 4557bf72bad2..000000000000
--- a/contrib/ngatm/FREEBSD-upgrade
+++ /dev/null
@@ -1,13 +0,0 @@
-$FreeBSD$
-
-This is the user part of the NgATM stuff. Be careful to feed changes
-back to the maintainer <harti@freebsd.org>, because the code here is
-actually shared with other environments besides FreeBSD.
-
-Import should be done by:
-
- cvs import \
- -m "Virgin import of NgATM user part X.Y" \
- src/contrib/ngatm BEGEMOT NGATM_X_Y
-
-harti
diff --git a/contrib/ngatm/libngatm/cccust.h b/contrib/ngatm/libngatm/cccust.h
deleted file mode 100644
index d67b12049cca..000000000000
--- a/contrib/ngatm/libngatm/cccust.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2004
- * Hartmut Brandt
- * All rights reserved.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/libngatm/cccust.h,v 1.2 2004/07/16 18:48:24 brandt Exp $
- *
- * Customisation of call control source to user space.
- */
-
-#include <sys/types.h>
-#include <sys/queue.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-#define CCASSERT(E, M) assert(E)
-
-#define CCMALLOC(S) (malloc((S)))
-#define CCZALLOC(S) (calloc(1, (S)))
-#define CCFREE(P) do { free(P); } while (0)
-
-#define CCGETERRNO() (errno)
diff --git a/contrib/ngatm/libngatm/net_in.fig b/contrib/ngatm/libngatm/net_in.fig
deleted file mode 100644
index 3914c1002dc9..000000000000
--- a/contrib/ngatm/libngatm/net_in.fig
+++ /dev/null
@@ -1,74 +0,0 @@
-#FIG 3.2
-Landscape
-Center
-Metric
-Letter
-100.00
-Single
--2
-1200 2
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5400 675 225 225 5400 675 5400 900
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5400 1800 225 225 5400 1800 5400 2025
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5400 2925 225 225 5400 2925 5400 3150
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5400 4050 225 225 5400 4050 5400 4275
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5408 5169 225 225 5408 5169 5408 5394
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 4281 6292 225 225 4281 6292 4281 6517
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5408 7419 225 225 5408 7419 5408 7644
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 6525 6292 225 225 6525 6292 6525 6517
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 900 5400 1575
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 2025 5400 2700
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 3150 5400 3825
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 4275 5400 4950
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 5
- 1 1 1.00 60.00 120.00
- 5625 2925 5850 2925 5850 4500 5625 4500 5400 4725
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 5
- 1 1 1.00 60.00 120.00
- 5175 1800 4725 1800 4725 3375 5175 3375 5400 3600
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 5
- 1 1 1.00 60.00 120.00
- 5175 1800 4275 1800 4275 4500 5175 4500 5400 4725
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 5400 5400 7200
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 3
- 1 1 1.00 60.00 120.00
- 5175 5175 4275 5175 4275 6075
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 3
- 1 1 1.00 60.00 120.00
- 5625 5175 6525 5175 6525 6075
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 3
- 1 1 1.00 60.00 120.00
- 4275 6525 4275 7425 5175 7425
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 3
- 1 1 1.00 60.00 120.00
- 6525 6525 6525 7425 5625 7425
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 5
- 1 1 1.00 60.00 120.00
- 5625 1800 8100 1800 8100 7875 5400 7875 5400 7650
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 720 N0\001
-4 0 9 50 0 14 12 0.0000 4 135 1680 5445 1080 SETUP.indication\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 1845 N1\001
-4 0 20 50 0 14 12 0.0000 4 150 2520 5445 2205 PROCEEDING.request (opt)\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 2970 N3\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 4095 N4\001
-4 0 20 50 0 14 12 0.0000 4 135 1680 5760 1755 RELEASE.response\001
-4 0 20 50 0 14 12 0.0000 4 135 1470 5445 4860 SETUP.response\001
-4 0 20 50 0 14 12 0.0000 4 135 1680 5445 3690 ALERTING.request\001
-4 1 0 50 0 14 12 0.0000 4 120 315 5400 5220 N10\001
-4 1 0 50 0 14 12 0.0000 4 120 315 4275 6345 N11\001
-4 1 0 50 0 14 12 0.0000 4 120 315 6525 6345 N12\001
-4 2 9 50 0 14 12 0.0000 4 135 1890 5085 5130 RELEASE.indication\001
-4 0 20 50 0 14 12 0.0000 4 135 1575 5715 5130 RELEASE.request\001
-4 2 9 50 0 14 12 0.0000 4 135 1575 5355 5715 RELEASE.confirm\001
-4 0 9 50 0 14 12 0.0000 4 135 1575 5715 7605 RELEASE.confirm\001
-4 2 20 50 0 14 12 0.0000 4 135 1680 5085 7605 RELEASE.response\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 7470 N0\001
diff --git a/contrib/ngatm/libngatm/net_out.fig b/contrib/ngatm/libngatm/net_out.fig
deleted file mode 100644
index c46356d0600f..000000000000
--- a/contrib/ngatm/libngatm/net_out.fig
+++ /dev/null
@@ -1,76 +0,0 @@
-#FIG 3.2
-Landscape
-Center
-Metric
-Letter
-100.00
-Single
--2
-1200 2
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5400 675 225 225 5400 675 5400 900
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5400 1800 225 225 5400 1800 5400 2025
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5400 2925 225 225 5400 2925 5400 3150
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5400 4050 225 225 5400 4050 5400 4275
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5416 5181 225 225 5416 5181 5416 5406
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5408 6294 225 225 5408 6294 5408 6519
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 4281 7417 225 225 4281 7417 4281 7642
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 5408 8544 225 225 5408 8544 5408 8769
-1 3 0 1 0 7 50 0 -1 0.000 1 0.0000 6525 7417 225 225 6525 7417 6525 7642
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 900 5400 1575
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 2025 5400 2700
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 3150 5400 3825
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 4275 5400 4950
-2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 5400 5400 6075
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 5
- 1 1 1.00 60.00 120.00
- 5175 1800 4950 1800 4950 3375 5175 3375 5400 3600
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 5
- 1 1 1.00 60.00 120.00
- 5175 1800 4500 1800 4500 4500 5175 4500 5400 4725
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 5
- 1 1 1.00 60.00 120.00
- 5625 2925 5850 2925 5850 4500 5625 4500 5400 4725
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 2
- 1 1 1.00 60.00 120.00
- 5400 6525 5400 8325
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 3
- 1 1 1.00 60.00 120.00
- 5175 6300 4275 6300 4275 7200
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 3
- 1 1 1.00 60.00 120.00
- 5625 6300 6525 6300 6525 7200
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 3
- 1 1 1.00 60.00 120.00
- 4275 7650 4275 8550 5175 8550
-2 1 0 1 -1 7 50 0 -1 0.000 0 0 -1 1 0 3
- 1 1 1.00 60.00 120.00
- 6525 7650 6525 8550 5625 8550
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 720 N0\001
-4 0 20 50 0 14 12 0.0000 4 135 1365 5535 1125 SETUP.request\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 1845 N6\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 2970 N9\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 4095 N7\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 5220 N8\001
-4 1 0 50 0 14 12 0.0000 4 120 315 5400 6345 N10\001
-4 0 20 50 0 14 12 0.0000 4 135 2310 5535 5625 SETUP_COMPLETE.request\001
-4 0 9 50 0 14 12 0.0000 4 135 1995 5535 3735 ALERTING.indication\001
-4 0 9 50 0 14 12 0.0000 4 135 1365 5535 4860 SETUP.confirm\001
-4 0 9 50 0 14 12 0.0000 4 135 2205 5535 2610 PROCEEDING.indication\001
-4 1 0 50 0 14 12 0.0000 4 120 315 4275 7470 N11\001
-4 1 0 50 0 14 12 0.0000 4 120 315 6525 7470 N12\001
-4 2 9 50 0 14 12 0.0000 4 135 1890 5085 6255 RELEASE.indication\001
-4 0 20 50 0 14 12 0.0000 4 135 1575 5715 6255 RELEASE.request\001
-4 2 9 50 0 14 12 0.0000 4 135 1575 5355 6840 RELEASE.confirm\001
-4 0 9 50 0 14 12 0.0000 4 135 1575 5715 8730 RELEASE.confirm\001
-4 2 20 50 0 14 12 0.0000 4 135 1680 5085 8730 RELEASE.response\001
-4 1 0 50 0 14 12 0.0000 4 120 210 5400 8595 N0\001
diff --git a/contrib/ngatm/libngatm/sscfucust.h b/contrib/ngatm/libngatm/sscfucust.h
deleted file mode 100644
index 760fd71660f9..000000000000
--- a/contrib/ngatm/libngatm/sscfucust.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/libngatm/sscfucust.h,v 1.4 2004/07/08 08:21:40 brandt Exp $
- *
- * Customisation of the SSCFU code for the user space library.
- */
-#include <sys/types.h>
-#include <sys/queue.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#ifdef SSCFU_DEBUG
-#include <assert.h>
-#endif
-#include <netnatm/unimsg.h>
-
-/*
- * Allocate zeroed or non-zeroed memory of some size and cast it.
- * Return NULL on failure.
- */
-#define MEMINIT()
-
-#define MEMZALLOC(PTR,CAST,SIZE) do { \
- void *_m = malloc(SIZE); \
- if (_m != NULL) \
- bzero(_m, SIZE); \
- (PTR) = (CAST)_m; \
-} while(0)
-
-#define MEMFREE(PTR) \
- free(PTR)
-
-#define SIG_ALLOC(PTR) \
- MEMZALLOC(PTR, struct sscfu_sig *, sizeof(struct sscfu_sig))
-#define SIG_FREE(PTR) \
- MEMFREE(PTR)
-
-/*
- * Signal queues
- */
-typedef TAILQ_ENTRY(sscfu_sig) sscfu_sigq_link_t;
-typedef TAILQ_HEAD(sscfu_sigq, sscfu_sig) sscfu_sigq_head_t;
-#define SIGQ_INIT(Q) TAILQ_INIT(Q)
-#define SIGQ_APPEND(Q,S) TAILQ_INSERT_TAIL(Q, S, link)
-#define SIGQ_GET(Q) \
- ({ \
- struct sscfu_sig *_s = NULL; \
- \
- if(!TAILQ_EMPTY(Q)) { \
- _s = TAILQ_FIRST(Q); \
- TAILQ_REMOVE(Q, _s, link); \
- } \
- _s; \
- })
-
-#define SIGQ_CLEAR(Q) \
- do { \
- struct sscfu_sig *_s1, *_s2; \
- \
- _s1 = TAILQ_FIRST(Q); \
- while(_s1 != NULL) { \
- _s2 = TAILQ_NEXT(_s1, link); \
- if(_s1->m) \
- MBUF_FREE(_s1->m); \
- SIG_FREE(_s1); \
- _s1 = _s2; \
- } \
- TAILQ_INIT(Q); \
- } while(0)
-
-
-/*
- * Message buffers
- */
-#define MBUF_FREE(M) uni_msg_destroy(M)
-
-#ifdef SSCFU_DEBUG
-#define ASSERT(S) assert(S)
-#else
-#define ASSERT(S)
-#endif
diff --git a/contrib/ngatm/libngatm/sscopcust.h b/contrib/ngatm/libngatm/sscopcust.h
deleted file mode 100644
index 12736c26c030..000000000000
--- a/contrib/ngatm/libngatm/sscopcust.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/libngatm/sscopcust.h,v 1.4 2004/07/08 08:21:40 brandt Exp $
- *
- * Customisation of the SSCOP code for the user space library.
- */
-#include <sys/types.h>
-#include <sys/queue.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <errno.h>
-#ifdef SSCOP_DEBUG
-#include <assert.h>
-#endif
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netnatm/unimsg.h>
-
-/*
- * Allocate zeroed or non-zeroed memory of some size and cast it.
- * Return NULL on failure.
- */
-#define MEMINIT()
-
-#define MEMZALLOC(PTR,CAST,SIZE) do { \
- void *_m = malloc(SIZE); \
- if (_m != NULL) \
- bzero(_m, SIZE); \
- (PTR) = (CAST)_m; \
-} while(0)
-
-#define MEMFREE(PTR) free(PTR);
-
-#define MSG_ALLOC(PTR) \
- MEMZALLOC(PTR, struct sscop_msg *, sizeof(struct sscop_msg))
-#define MSG_FREE(PTR) \
- MEMFREE(PTR)
-
-#define SIG_ALLOC(PTR) \
- MEMZALLOC(PTR, struct sscop_sig *, sizeof(struct sscop_sig))
-#define SIG_FREE(PTR) \
- MEMFREE(PTR)
-
-/*
- * Timer support.
- */
-typedef void *sscop_timer_t;
-#define TIMER_INIT(S,T) (S)->t_##T = NULL
-#define TIMER_STOP(S,T) do { \
- if ((S)->t_##T != NULL) { \
- (S)->funcs->stop_timer((S), (S)->aarg, (S)->t_##T); \
- (S)->t_##T = NULL; \
- } \
- } while(0)
-#define TIMER_RESTART(S,T) do { \
- if ((S)->t_##T != NULL) \
- (S)->funcs->stop_timer((S), (S)->aarg, (S)->t_##T); \
- (S)->t_##T = (S)->funcs->start_timer((S), (S)->aarg, \
- (S)->timer##T, T##_func); \
- } while(0)
-#define TIMER_ISACT(S,T) ((S)->t_##T != NULL)
-
-#define TIMER_FUNC(T,N) \
-static void \
-T##_func(void *varg) \
-{ \
- struct sscop *sscop = varg; \
- VERBOSE(sscop, SSCOP_DBG_TIMER, (sscop, sscop->aarg, \
- "timer_" #T " expired")); \
- sscop->t_##T = NULL; \
- sscop_signal(sscop, SIG_T_##N, NULL); \
-}
-
-
-/*
- * Message queues
- */
-typedef TAILQ_ENTRY(sscop_msg) sscop_msgq_link_t;
-typedef TAILQ_HEAD(sscop_msgq, sscop_msg) sscop_msgq_head_t;
-#define MSGQ_EMPTY(Q) TAILQ_EMPTY(Q)
-#define MSGQ_INIT(Q) TAILQ_INIT(Q)
-#define MSGQ_FOREACH(P,Q) TAILQ_FOREACH(P,Q,link)
-#define MSGQ_REMOVE(Q,M) TAILQ_REMOVE(Q,M,link)
-#define MSGQ_INSERT_BEFORE(B,M) TAILQ_INSERT_BEFORE(B,M,link)
-#define MSGQ_APPEND(Q,M) TAILQ_INSERT_TAIL(Q,M,link)
-#define MSGQ_PEEK(Q) (TAILQ_EMPTY((Q)) ? NULL : TAILQ_FIRST((Q)))
-#define MSGQ_GET(Q) \
- ({ \
- struct sscop_msg *_m = NULL; \
- \
- if(!TAILQ_EMPTY(Q)) { \
- _m = TAILQ_FIRST(Q); \
- TAILQ_REMOVE(Q, _m, link); \
- } \
- _m; \
- })
-
-#define MSGQ_CLEAR(Q) \
- do { \
- struct sscop_msg *_m1, *_m2; \
- \
- _m1 = TAILQ_FIRST(Q); \
- while(_m1 != NULL) { \
- _m2 = TAILQ_NEXT(_m1, link); \
- SSCOP_MSG_FREE(_m1); \
- _m1 = _m2; \
- } \
- TAILQ_INIT((Q)); \
- } while(0)
-
-/*
- * Signal queues
- */
-typedef TAILQ_ENTRY(sscop_sig) sscop_sigq_link_t;
-typedef TAILQ_HEAD(sscop_sigq, sscop_sig) sscop_sigq_head_t;
-#define SIGQ_INIT(Q) TAILQ_INIT(Q)
-#define SIGQ_APPEND(Q,S) TAILQ_INSERT_TAIL(Q, S, link)
-#define SIGQ_EMPTY(Q) TAILQ_EMPTY(Q)
-#define SIGQ_GET(Q) \
- ({ \
- struct sscop_sig *_s = NULL; \
- \
- if(!TAILQ_EMPTY(Q)) { \
- _s = TAILQ_FIRST(Q); \
- TAILQ_REMOVE(Q, _s, link); \
- } \
- _s; \
- })
-
-#define SIGQ_MOVE(F,T) \
- do { \
- struct sscop_sig *_s; \
- \
- while(!TAILQ_EMPTY(F)) { \
- _s = TAILQ_FIRST(F); \
- TAILQ_REMOVE(F, _s, link); \
- TAILQ_INSERT_TAIL(T, _s, link); \
- } \
- } while(0)
-
-#define SIGQ_PREPEND(F,T) \
- do { \
- struct sscop_sig *_s; \
- \
- while(!TAILQ_EMPTY(F)) { \
- _s = TAILQ_LAST(F, sscop_sigq); \
- TAILQ_REMOVE(F, _s, link); \
- TAILQ_INSERT_HEAD(T, _s, link); \
- } \
- } while(0)
-
-#define SIGQ_CLEAR(Q) \
- do { \
- struct sscop_sig *_s1, *_s2; \
- \
- _s1 = TAILQ_FIRST(Q); \
- while(_s1 != NULL) { \
- _s2 = TAILQ_NEXT(_s1, link); \
- SSCOP_MSG_FREE(_s1->msg); \
- SIG_FREE(_s1); \
- _s1 = _s2; \
- } \
- TAILQ_INIT(Q); \
- } while(0)
-
-
-
-/*
- * Message buffers
- */
-/* Free a buffer (if there is one) */
-#define MBUF_FREE(M) do { if(M) uni_msg_destroy(M); } while(0)
-
-/* duplicate a buffer */
-#define MBUF_DUP(M) uni_msg_dup(M)
-
-/* compute current length */
-#define MBUF_LEN(M) uni_msg_len((M))
-
-/*
- * Return the i-th word counted from the end of the buffer.
- * i=-1 will return the last 32bit word, i=-2 the 2nd last.
- * Assumes that there is enough space.
- */
-#define MBUF_TRAIL32(M,I) uni_msg_trail32((M), (I))
-
-/*
- * Strip 32bit value from the end
- */
-#define MBUF_STRIP32(M) uni_msg_strip32((M))
-
-/*
- * Strip 32bit value from head
- */
-#define MBUF_GET32(M) uni_msg_get32((M))
-
-/*
- * Append a 32bit value to an mbuf. Failures are ignored.
- */
-#define MBUF_APPEND32(M,W) uni_msg_append32((M), (W))
-
-/*
- * Pad a message to a multiple of four byte and return the amount of padding
- * Failures are ignored.
- */
-#define MBUF_PAD4(M) \
- ({ \
- int _npad = 0; \
- while (uni_msg_len(M) % 4 != 0) { \
- uni_msg_append8((M), 0); \
- _npad++; \
- } \
- _npad; \
- })
-
-#define MBUF_UNPAD(M,P) do { (M)->b_wptr -= (P); } while(0)
-
-/*
- * Allocate a message that will probably hold N bytes.
- */
-#define MBUF_ALLOC(N) uni_msg_alloc(N)
-
-#ifdef SSCOP_DEBUG
-#define ASSERT(X) assert(X)
-#else
-#define ASSERT(X)
-#endif
diff --git a/contrib/ngatm/libngatm/unicust.h b/contrib/ngatm/libngatm/unicust.h
deleted file mode 100644
index ff028a65a8e6..000000000000
--- a/contrib/ngatm/libngatm/unicust.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/libngatm/unicust.h,v 1.4 2003/09/19 13:10:35 hbb Exp $
- *
- * Customisation of signalling source to user space.
- */
-#include <sys/types.h>
-#include <sys/queue.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#define ASSERT(E, M) assert(E)
-
-static __inline__ void *
-mzalloc(size_t s)
-{
- void *ptr = malloc(s);
-
- if (ptr)
- bzero(ptr, s);
- return (ptr);
-}
-
-#define INS_ALLOC() mzalloc(sizeof(struct uni))
-#define INS_FREE(P) free(P)
-
-#define UNI_ALLOC() mzalloc(sizeof(struct uni_all))
-#define UNI_FREE(P) free(P)
-
-#define SIG_ALLOC() mzalloc(sizeof(struct sig))
-#define SIG_FREE(P) free(P)
-
-#define CALL_ALLOC() mzalloc(sizeof(struct call))
-#define CALL_FREE(P) free(P)
-
-#define PARTY_ALLOC() mzalloc(sizeof(struct party))
-#define PARTY_FREE(P) free(P)
-
-/*
- * Timers
- */
-struct uni_timer {
- void *c;
-};
-
-#define _TIMER_INIT(X,T) (X)->T.c = NULL
-#define _TIMER_DESTROY(U,F) _TIMER_STOP(U,F)
-#define _TIMER_STOP(U,F) \
- do { \
- if (F.c != NULL) { \
- (U)->funcs->stop_timer(U, U->arg, F.c); \
- F.c = NULL; \
- } \
- } while(0)
-#define _TIMER_START(UNI,ARG,FIELD,DUE,FUNC) \
- (void)(FIELD.c = (UNI)->funcs->start_timer(UNI, \
- UNI->arg, DUE, FUNC, ARG))
-
-#define TIMER_ISACT(X,T) (X->T.c != NULL)
-
-#define TIMER_FUNC_UNI(T,F) \
-static void F(struct uni *); \
-static void \
-_##T##_func(void *varg) \
-{ \
- struct uni *uni = (struct uni *)varg; \
- uni->T.c = NULL; \
- (F)(uni); \
-}
-
-/*
- * Be careful: call may be invalid after the call to F
- */
-#define TIMER_FUNC_CALL(T,F) \
-static void F(struct call *); \
-static void \
-_##T##_func(void *varg) \
-{ \
- struct call *call = (struct call *)varg; \
- call->T.c = NULL; \
- (F)(call); \
-}
-
-/*
- * Be careful: call/party may be invalid after the call to F
- */
-#define TIMER_FUNC_PARTY(T,F) \
-static void F(struct party *); \
-static void \
-_##T##_func(void *varg) \
-{ \
- struct party *party = (struct party *)varg; \
- party->T.c = NULL; \
- (F)(party); \
-}
diff --git a/contrib/ngatm/libngatm/unimsg.c b/contrib/ngatm/libngatm/unimsg.c
deleted file mode 100644
index 9df02a10598c..000000000000
--- a/contrib/ngatm/libngatm/unimsg.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (c) 1996-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/libngatm/unimsg.c,v 1.4 2004/07/08 08:21:41 brandt Exp $
- *
- * User space message structure.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-#include <arpa/inet.h>
-#include <netnatm/unimsg.h>
-
-/* the amount of extra bytes to allocate */
-#define EXTRA 128
-
-/*
- * Allocate a message that can hold at least 's' bytes. Return NULL if
- * allocation fails.
- */
-struct uni_msg *
-uni_msg_alloc(size_t s)
-{
- struct uni_msg *m;
-
- s += EXTRA;
-
- if ((m = malloc(sizeof(struct uni_msg))) == NULL)
- return NULL;
- if ((m->b_buf = malloc(s)) == NULL) {
- free(m);
- return (NULL);
- }
- m->b_rptr = m->b_wptr = m->b_buf;
- m->b_lim = m->b_buf + s;
- return (m);
-}
-
-/*
- * Destroy the message and free memory
- */
-void
-uni_msg_destroy(struct uni_msg *m)
-{
- free(m->b_buf);
- free(m);
-}
-
-/*
- * Extend message by at least 's' additional bytes.
- * May reallocate the message buffer. Return -1 on errors, 0 if ok.
- * If an error occurs the message is destroyed.
- */
-int
-uni_msg_extend(struct uni_msg *m, size_t s)
-{
- u_char *b;
- size_t len, leading, newsize;
-
- len = uni_msg_len(m);
- newsize = m->b_wptr - m->b_buf + s + EXTRA;
- leading = m->b_rptr - m->b_buf;
- if ((b = realloc(m->b_buf, newsize)) == NULL) {
- free(m->b_buf);
- free(m);
- return (-1);
- }
- m->b_buf = b;
- m->b_rptr = m->b_buf + leading;
- m->b_wptr = m->b_rptr + len;
- m->b_lim = m->b_buf + newsize;
-
- return (0);
-}
-
-/*
- * Append the given buffer to the message. May reallocate the message
- * buffer. Return 0 if ok, -1 on errors.
- */
-int
-uni_msg_append(struct uni_msg *m, void *buf, size_t size)
-{
- int error;
-
- if ((error = uni_msg_ensure(m, size)))
- return (error);
- memcpy(m->b_wptr, buf, size);
- m->b_wptr += size;
-
- return (0);
-}
-
-/*
- * Construct a message from a number of pieces. The list of pieces must end
- * with a NULL pointer.
- */
-struct uni_msg *
-uni_msg_build(void *ptr, ...)
-{
- va_list ap;
- struct uni_msg *m;
- size_t len, n;
- void *p1;
-
- len = 0;
- va_start(ap, ptr);
- p1 = ptr;
- while (p1 != NULL) {
- n = va_arg(ap, size_t);
- len += n;
- p1 = va_arg(ap, void *);
- }
- va_end(ap);
-
- if ((m = uni_msg_alloc(len)) == NULL)
- return (NULL);
-
- va_start(ap, ptr);
- p1 = ptr;
- while (p1 != NULL) {
- n = va_arg(ap, size_t);
- memcpy(m->b_wptr, p1, n);
- m->b_wptr += n;
- p1 = va_arg(ap, void *);
- }
- va_end(ap);
-
- return (m);
-}
-
-/*
- * Strip the last 32 bit word from the buffer.
- * Barf if there is no word left.
- */
-u_int
-uni_msg_strip32(struct uni_msg *msg)
-{
- uint32_t w;
-
- msg->b_wptr -= 4;
- bcopy(msg->b_wptr, &w, 4);
- return (ntohl(w));
-}
-
-/*
- * Strip the first four bytes of the buffer.
- */
-u_int
-uni_msg_get32(struct uni_msg *msg)
-{
- uint32_t w;
-
- bcopy(msg->b_rptr, &w, 4);
- msg->b_rptr += 4;
- return (ntohl(w));
-}
-
-/*
- * Append a 32 bit word to the buffer.
- */
-int
-uni_msg_append32(struct uni_msg *msg, u_int u)
-{
- if (uni_msg_ensure(msg, 4) == -1)
- return (-1);
- u = htonl(u);
- bcopy(&u, msg->b_wptr, 4);
- msg->b_wptr += 4;
- return (0);
-}
-
-/*
- * Append a byte to the buffer.
- */
-int
-uni_msg_append8(struct uni_msg *msg, u_int u)
-{
- if (uni_msg_ensure(msg, 1) == -1)
- return (-1);
- *msg->b_wptr++ = u;
- return (0);
-}
-
-/*
- * Return the i-th word counted from the end of the buffer.
- * i=-1 will return the last 32bit word, i=-2 the 2nd last.
- * Assumes that the word is in the buffer.
- */
-u_int
-uni_msg_trail32(const struct uni_msg *msg, int i)
-{
- u_int w;
-
- bcopy(msg->b_wptr + 4 * i, &w, 4);
- return (ntohl(w));
-}
-
-
-/*
- * Make a duplicate.
- */
-struct uni_msg *
-uni_msg_dup(const struct uni_msg *inp)
-{
- struct uni_msg *msg;
- u_int len, off;
-
- len = inp->b_wptr - inp->b_rptr;
- off = inp->b_rptr - inp->b_buf;
- if ((msg = uni_msg_alloc(inp->b_lim - inp->b_buf)) == NULL)
- return (NULL);
- msg->b_rptr = msg->b_buf + off;
- msg->b_wptr = msg->b_rptr + len;
- (void)memcpy(msg->b_rptr, inp->b_rptr, len);
-
- return (msg);
-}
diff --git a/contrib/ngatm/man/libngatm.3 b/contrib/ngatm/man/libngatm.3
deleted file mode 100644
index 8a2dbed332af..000000000000
--- a/contrib/ngatm/man/libngatm.3
+++ /dev/null
@@ -1,75 +0,0 @@
-.\"
-.\" Copyright (c) 2004-2005
-.\" Hartmut Brandt
-.\" All rights reserved.
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Begemot: libunimsg/man/libngatm.3,v 1.6 2005/06/15 11:37:07 brandt_h Exp $
-.\"
-.Dd May 23, 2005
-.Dt LIBNGATM 3
-.Os
-.Sh NAME
-.Nm libngatm
-.Nd "ATM signalling library"
-.Sh LIBRARY
-Begemot ATM signalling library
-.Pq libngatm, -lngatm
-.Sh DESCRIPTION
-The Begemot UNI signalling library handles message decoding and encoding as
-well as the Q.2110 and Q.2120 transport protocols and adaptation layers, and
-ATM-Forum UNI 4.0 compliant signalling.
-Because of this complexity the description is broken down in several man pages:
-.Bl -tag -width XXXX
-.It Xr unimsg 3
-Describes a data structure and functions for handling of variable sized
-messages.
-.It Xr unistruct 3
-describes data structures for the decoding, encoding and printing functions
-in the library.
-.It Xr unifunc 3
-describes the decoding, encoding and printing functions.
-.\" .It Xr sscop 3
-.\" describes the SSCOP transport protocol functions.
-.\" .It Xr sscfu 3
-.\" describes the SSCF at the UNI functions.
-.\" .It Xr uni 3
-.\" describes the UNI 4.0 signalling functions.
-.It Xr uniaddr 3
-describes address structures and handling functions.
-.It Xr unisap 3
-.\" describes ATM-Forum ATM-API service access point structures and
-.\" handling functions.
-.El
-.Sh SEE ALSO
-.Xr sscop 1
-.Sh STANDARDS
-This implementation conforms to the applicable ITU-T
-recommendations and ATM Forum standards.
-.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
diff --git a/contrib/ngatm/man/uniaddr.3 b/contrib/ngatm/man/uniaddr.3
deleted file mode 100644
index 3be82bb6c6b3..000000000000
--- a/contrib/ngatm/man/uniaddr.3
+++ /dev/null
@@ -1,129 +0,0 @@
-.\"
-.\" Copyright (c) 2004-2005
-.\" Hartmut Brandt.
-.\" All rights reserved.
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Begemot: libunimsg/man/uniaddr.3,v 1.6 2005/06/15 11:37:08 brandt_h Exp $
-.\"
-.Dd June 14, 2005
-.Dt UNIADDR 3
-.Os
-.Sh NAME
-.Nm unimsg ,
-.Nm uni_str2nsap ,
-.Nm uni_nsap2str ,
-.Nm uni_prefix2str ,
-.Nm uni_e1642nsap ,
-.Nm uni_nsap2e164
-.Nd "ATM signalling library - address handling"
-.Sh LIBRARY
-Begemot ATM signalling library
-.Pq libunimsg, -lunimsg
-.Sh SYNOPSIS
-.In netnatm/addr.h
-.Ft int
-.Fn uni_str2nsap "u_char *nsap" "const char *str"
-.Ft void
-.Fn uni_nsap2str "char *str" "const u_char *nsap" "int dots"
-.Ft void
-.Fn uni_prefix2str "char *str" "const u_char *prefix" "u_int len" "int dots"
-.Ft int
-.Fn uni_e1642nsap "u_char *nsap" "const char *e164"
-.Ft int
-.Fn uni_nsap2e164 "char *e164" "const u_char *nsap" "int check"
-.Sh DESCRIPTION
-The UNI message library contains a number of utility functions to handle
-NSAP and E.164 addresses.
-.Pp
-The function
-.Fn uni_str2nsap
-parses a string and interprets it as an NSAP address.
-The string should consist of exact 40 hexadecimal digits
-(upper and lower case are allowed) and any
-number of dots at any position.
-Any other character is illegal.
-The resulting NSAP address is written to the buffer pointed to by
-.Fa nsap .
-This buffer should be at least 20 bytes.
-On success the funtion returns 0.
-If an parsing error happens -1 is returned.
-.Pp
-The function
-.Fn uni_nsap2str
-converts the NSAP address pointed to by
-.Fa nsap
-into a string.
-For some commonly used NSAP formats (those with leading
-octets 0x39, 0x45 or 0x47) dots may be inserted to make the address more
-readable by passing a non-0 value in
-.Fa dots .
-The buffer pointed to by
-.Fa str
-should be large enough to hold the resulting string plus the terminating NUL.
-A size of 80 byte is large enough for all cases.
-.Pp
-The function
-.Fn uni_prefix2str
-converts an NSAP prefix to a string.
-The length of the NSAP prefix in bytes is passed in
-.Fa len .
-.Li "uni_nsap2str(str, nsap, dots)"
-is equivalent to
-.Li "uni_prefix2str(str, nsap, 20, dots)" .
-.Pp
-The function
-.Fn uni_e1642nsap
-converts an E.164 address given as an ASCII string to an embedded E.164 NSAP
-address.
-The string pointed to by
-.Fa e164
-must consist of at least 1 and not more than 15 ASCII digits.
-The function returns 0 on success and -1 if the E.164 address was malformed.
-.Pp
-The function
-.Fn uni_nsap2e164
-extracts the E.164 address from an embedded E.164 NSAP address.
-The argument
-.Fa check
-specifies whether the NSAP address should be checked for correct syntax.
-If
-.Fa check
-is 0 the last 11 bytes of the address are ignored.
-If
-.Fa check
-is 1 the last 11 bytes except the selector byte must be zero.
-If
-.Fa check
-is 2 the last 11 bytes must be zero.
-The function returns 0 on success and -1 when the NSAP address was not an
-embedded E.164 NSAP or one of the additional checks failed.
-.Sh SEE ALSO
-.Xr libngatm 3
-.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
diff --git a/contrib/ngatm/man/unifunc.3 b/contrib/ngatm/man/unifunc.3
deleted file mode 100644
index 3d66900a3372..000000000000
--- a/contrib/ngatm/man/unifunc.3
+++ /dev/null
@@ -1,255 +0,0 @@
-.\"
-.\" Copyright (c) 2004-2005
-.\" Hartmut Brandt.
-.\" All rights reserved.
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Begemot: libunimsg/man/unifunc.3,v 1.6 2005/06/15 11:37:09 brandt_h Exp $
-.\"
-.Dd June 14, 2005
-.Dt UNIFUNC 3
-.Os
-.Sh NAME
-.Nm libngatm ,
-.Nm uni_decode ,
-.Nm uni_decode_head ,
-.Nm uni_decode_body ,
-.Nm uni_decode_ie_hdr ,
-.Nm uni_decode_ie_body ,
-.Nm uni_encode ,
-.Nm uni_encode_msg_hdr ,
-.Nm uni_encode_ie ,
-.Nm uni_encode_ie_hdr ,
-.Nm uni_check_ie ,
-.Nm uni_print_cref ,
-.Nm uni_print_msghdr ,
-.Nm uni_print ,
-.Nm uni_print_ie ,
-.Nm uni_initcx ,
-.Nm uni_print_cx
-.Nd "ATM signalling library - message handling functions"
-.Sh LIBRARY
-Begemot ATM signalling library
-.Pq libngatm, -lngatm
-.Sh SYNOPSIS
-.In netnatm/msg/unistruct.h
-.In netnatm/msg/unimsglib.h
-.Ft int
-.Fn uni_decode "struct uni_msg *buf" "struct uni_all *msg" "struct unicx *cx"
-.Ft int
-.Fn uni_decode_head "struct uni_msg *buf" "struct uni_all *msg" "struct unicx *cx"
-.Ft int
-.Fn uni_decode_body "struct uni_msg *buf" "struct uni_all *msg" "struct unicx *cx"
-.Ft int
-.Fn uni_decode_ie_hdr "enum uni_ietype *type" "struct uni_iehdr *hdr" "struct uni_msg *buf" "struct unicx *cx" "u_int *ielen"
-.Ft int
-.Fn uni_decode_ie_body "enum uni_ietype type" "union uni_ieall *ie" "struct uni_msg *buf" "u_int ielen" "struct unicx *cx"
-.Ft int
-.Fn uni_encode "struct uni_msg *buf" "struct uni_all *msg" "struct unicx *cx"
-.Ft int
-.Fn uni_encode_msg_hdr "struct uni_msg *buf" "struct uni_msghdr *hdr" "enum uni_msgtype type" "struct unicx *cx" "int *mlen"
-.Ft int
-.Fn uni_encode_ie "enum uni_ietype type" "struct uni_msg *buf" "union uni_ieall *ie" "struct unicx *cx"
-.Ft int
-.Fn uni_encode_ie_hdr "struct uni_msg *buf" "enum uni_ietype type" "struct uni_iehdr *hdr" "u_int len" "struct unicx *cx"
-.Ft int
-.Fn uni_check_ie "enum uni_ietype type" "union uni_ieall *ie" "struct unicx *cx"
-.Ft void
-.Fn uni_print_cref "char *buf" "size_t buflen" "struct uni_cref *cref" "struct unicx *cx"
-.Ft void
-.Fn uni_print_msghdr "char *buf" "size_t buflen" "struct uni_msghdr *hdr" "struct unicx *cx"
-.Ft void
-.Fn uni_print "char *buf" "size_t buflen" "struct uni_all *msg" "struct unicx *cx"
-.Ft void
-.Fn uni_print_ie "char *buf" "size_t buflen" "enum uni_ietype type" "union uni_ieall *ie" "struct unicx *cx"
-.Ft void
-.Fn uni_initcx "struct unicx *cx"
-.Ft void
-.Fn uni_print_cx "char *buf" "size_t buflen" "struct unicx *cx"
-.Sh DESCRIPTION
-The
-.Nm
-library handles UNI 4.0 messages.
-For each information element and message
-type the header files contain a structure definition.
-Additionally there
-are a number of help structures and a global context structure for some
-of the library functions.
-This document describes the functions that are
-used to handle messages.
-.Ss DECODING
-Decoding is the process of taking an octet stream containing a UNI message
-or IE, parsing it and filling in a message or IE structure.
-.Pp
-The function
-.Fn uni_decode
-takes a message buffer, interprets it as a UNI message and fills in the
-structure pointed to by
-.Fa msg .
-It also takes a context argument and may fill the error array in the context.
-It returns -1 if there is an error decoding the message header and
--2 if there is an error decoding the message body.
-The function returns 0 on success.
-.Pp
-The process of decoding a message can be split up by calling
-.Fn uni_decode_head
-and
-.Fn uni_decode_body .
-The first of these functions decodes only the message header and the second
-one decodes only the information elements.
-.Fn uni_decode_head
-returns 0 if it could decode the message header
-and -1 if the message could not be decoded (bad protocol
-identifier, bad length or broken call reference).
-.Fn uni_decode_body
-return 0 on success and -1 for unknown message types or if any
-IE had an error.
-.Pp
-The function
-.Fn uni_decode_ie_hdr
-decodes the next information element header.
-It returns the IE type and its length
-in the variables pointed to by
-.Va type
-and
-.Va ielen
-and stores the decoded header in the structure pointed to by
-.Va hdr .
-The function returns 0 on success and -1 if there were not enough bytes
-in the buffer left for a complete IE header.
-.Pp
-The function
-.Fn uni_decode_ie_body
-decodes the body of an information element.
-It is passed the buffer with the message
-.Fa buf ,
-the information element type
-.Fa type
-and length
-.Fa ielen .
-The IE is stored in the union pointed to by
-.Fa ie .
-The function returns -1 on errors and 0 on success.
-In any case the most correct
-number of bytes is consumed from the input buffer.
-.Ss ENCODING
-Encoding is the process of taking a message or IE structure and producing
-an octet stream from it.
-.Pp
-The function
-.Fn uni_encode
-encodes a UNI message.
-It returns -1 if the message type is out of bounds, -3
-if the message type is unknown.
-The encoding functions for the message types
-can return their own error codes.
-The function returns 0 on success.
-.Pp
-The function
-.Fn uni_encode_msg_hdr
-encodes a message header.
-The variable pointed to by
-.Fa mlen
-is set to the offset of the message length field from the begin of the
-byte stream.
-This is needed because the length of the message body will
-be known only after all the IEs have been encoded.
-Then the length
-has to be inserted into this place.
-The function returns -1 if the call reference
-was bad and 0 on success.
-.Pp
-The function
-.Fn uni_encode_ie
-encodes one information element.
-The function returns 0 on success or -1
-on errors.
-The function
-.Fn uni_encode_ie_hdr
-encodes the four byte IE header.
-The argument
-.Fa len
-is the maximum expected length of the information element, not the real length.
-The function inserts a 0 in the real length field.
-This must be
-fixed up by the caller after encoding the IE contents.
-The function
-return -1 if an empty IE is to be encoded (in this case the length field will
-have been set to 4) or 0 otherwise.
-.Ss CHECKING
-There exists a number of function that do consistency checks on information
-elements.
-Note, that these functions do not check inter-IE consistency, but
-each IE by itself.
-.Pp
-The function
-.Fn uni_check_ie
-check an information element for consistency.
-It returns 0 if the IE seems
-ok, -1 otherwise.
-.Ss PRINTING
-A number of functions can be used to print decoded messages and IEs in
-a human readable form.
-This is intended mainly for debugging.
-Some fields of the library context are used to control how the printing is done
-(see
-.Xr unistruct 3 ) .
-Each of the function takes a
-.Fa buf
-and a
-.Fa buflen
-argument.
-The string that is generated in the buffer pointed to by
-.Fa buf
-is guaranteed to be NUL terminated.
-.Pp
-The function
-.Fn uni_print_cref
-formats a call reference taking into account special call references.
-The function
-.Fn uni_print_msg_hdr
-formats a message header.
-The functions
-.Fn uni_print
-and
-.Fn uni_print_ie
-print messages and information elements.
-.Ss CONTEXTS
-There are two functions for context handling.
-.Fn uni_initcx
-initializes a context with default values and
-.Fn uni_print_cx
-prints a context to the given buffer.
-.Sh SEE ALSO
-.Xr libngatm 3
-.Sh STANDARDS
-This implementation conforms to the applicable ITU-T
-recommendations and ATM Forum standards with the exception of some limitations
-(see the Configuration section).
-.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
diff --git a/contrib/ngatm/man/unimsg.3 b/contrib/ngatm/man/unimsg.3
deleted file mode 100644
index 41d58ee294ce..000000000000
--- a/contrib/ngatm/man/unimsg.3
+++ /dev/null
@@ -1,249 +0,0 @@
-.\"
-.\" Copyright (c) 2004-2005
-.\" Hartmut Brandt.
-.\" All rights reserved.
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" $Begemot: libunimsg/man/unimsg.3,v 1.4 2005/06/15 11:37:10 brandt_h Exp $
-.\"
-.Dd June 14, 2005
-.Dt UNIMSG 3
-.Os
-.Sh NAME
-.Nm uni_msg_len ,
-.Nm uni_msg_space ,
-.Nm uni_msg_leading ,
-.Nm uni_msg_size ,
-.Nm uni_msg_ensure ,
-.Nm uni_msg_append ,
-.Nm uni_msg_extend ,
-.Nm uni_msg_alloc ,
-.Nm uni_msg_build ,
-.Nm uni_msg_destroy ,
-.Nm uni_msg_strip32 ,
-.Nm uni_msg_get32 ,
-.Nm uni_msg_append32 ,
-.Nm uni_msg_append8 ,
-.Nm uni_msg_trail32 ,
-.Nm uni_msg_dup
-.Nd "ATM signalling library - message buffers"
-.Sh LIBRARY
-Begemot ATM signalling library
-.Pq libunimsg, -lunimsg
-.Sh SYNOPSIS
-.In uni4/unimsg.h
-.Ft size_t
-.Fn uni_msg_len "const struct uni_msg *msg"
-.Ft size_t
-.Fn uni_msg_space "const struct uni_msg *msg"
-.Ft size_t
-.Fn uni_msg_leading "const struct uni_msg *msg"
-.Ft size_t
-.Fn uni_msg_size "const struct uni_msg *msg"
-.Ft int
-.Fn uni_msg_ensure "struct uni_msg *msg" "size_t bytes"
-.Ft int
-.Fn uni_msg_append "struct uni_msg *msg" "void *buf" "size_t buflen"
-.Ft int
-.Fn uni_msg_extend "struct uni_msg *msg" "size_t bytes"
-.Ft struct uni_msg *
-.Fn uni_msg_alloc "size_t space"
-.Ft struct uni_msg *
-.Fn uni_msg_build "void *buf" "..."
-.Ft void
-.Fn uni_msg_destroy "struct uni_msg *msg"
-.Ft u_int
-.Fn uni_msg_strip32 "struct uni_msg *msg"
-.Ft u_int
-.Fn uni_msg_get32 "struct uni_msg *msg"
-.Ft int
-.Fn uni_msg_append32 "struct uni_msg *msg" "u_int value"
-.Ft int
-.Fn uni_msg_append8 "struct uni_msg *msg" "u_int byte"
-.Ft u_int
-.Fn uni_msg_trail32 "const struct uni_msg *msg" "int n"
-.Ft struct uni_msg *
-.Fn uni_msg_dup "const struct uni_msg *msg"
-.Sh DESCRIPTION
-These functions are used to manipulate variable sized message.
-They are
-inspired by BSD mbufs and SysV stream buffers, but somewhat simplified because
-signalling generally is a low bandwidth task.
-All the functions operation on a
-.Li uni_msg
-data structure:
-.Bd -literal -offset indent
-struct uni_msg {
- u_char *b_wptr; /* tail pointer */
- u_char *b_rptr; /* head pointer */
- u_char *b_buf; /* data buffer */
- u_char *b_lim; /* end of data buffer */
-};
-.Ed
-.Pp
-The field
-.Fa b_buf
-points to the begin of a memory block that is used to store the actual message
-and the field
-.Fa b_lim
-points just to the first byte behind that buffer.
-This buffer is allocated
-separate from the structure itself and the user calling any of the above
-functions with a non const
-.Vt struct uni_msg
-argument should expect the buffer to be reallocated and hence not hold pointers
-into the buffer accross call to these functions.
-The pointer
-.Fa b_rptr
-points to the first used byte in the message and
-.Fa b_wptr
-to the first unused byte behind all used bytes.
-If the message is empty, both pointers point to the same place somewhere in
-the allocated buffer.
-.Pp
-There are several functions and macros that return various sizes and lengths.
-The macro
-.Fn uni_msg_len
-returns the actual size of the message (the number of used bytes).
-The macro
-.Fn uni_msg_space
-returns the number of bytes that are left unused behind the used space.
-The macro
-.Fn uni_msg_leading
-returns the number of bytes that are unused before the used space and the
-macro
-.Fn uni_msg_size
-returns the maximum size of the message (that is the size of the allocated
-buffer).
-.Pp
-Two functions may be used to create new messages: The function
-.Fn uni_msg_alloc
-allocates the message structure and a buffer to hold at least
-.Ar space
-bytes (In fact it allocates a couple of bytes more).
-If the allocation fails NULL is returned.
-The pointers are setup so that there is no leading space in the buffer.
-The function
-.Fn uni_msg_build
-constructs a new message from a variable number of buffers.
-The arguments are pairs of
-.Vt void *
-pointers to buffers and
-.Vt size_t
-buffer sizes, terminated by a NULL pointer.
-The function computes the total resulting message size, allocates a message
-and copies all the buffers into the message.
-The message is built to have no leading space.
-If the allocation fails, NULL is returned.
-.Pp
-The function
-.Fn uni_msg_destroy
-deallocates the buffer pointed to by the message and the message itself.
-It is save to pass a message with a NULL buffer, but not a NULL message.
-.Pp
-The function
-.Fn uni_msg_dup
-returns a copy of a message with exact the same leading space.
-.Pp
-A number of functions are used to add bytes to an existing message.
-The function
-.Fn uni_msg_extend
-extends the message buffer to have space for at least
-.Ar bytes
-additional byte at the end.
-The leading space does not change.
-This function may reallocate the message buffer.
-The function returns 0 on success and ENOMEM if the reallocation fails.
-In this case the message buffer is not changed.
-The macro
-.Fn uni_msg_ensure
-checks whether the message has space for additional
-.Ar bytes
-bytes.
-If not it calls
-.Fn uni_msg_extend
-to make the message buffer larger.
-The macro returns 0 on success or ENOMEM
-if there is not enough space and the reallocation fails.
-In this case the message buffer is not changed.
-The function
-.Fn uni_msg_append
-appends
-.Ar buflen
-bytes from the buffer pointed to by
-.Ar buf
-to the message.
-The function
-.Fn uni_msg_append8
-appends one byte to the message and the function
-.Fn uni_msg_append32
-appends a 32-bit value in network byte order to the message
-.Fa ( b_wptr
-needs not to be aligned).
-All three functions call
-.Fn uni_msg_ensure
-to make sure, that the buffer contents fit into the message.
-They return 0 on success and ENOMEM if the buffer is too small and
-the reallocation fails.
-In this case the message buffer is not changed.
-.Pp
-A number of functions can be used to retrieve parts of the message.
-The function
-.Fn uni_msg_strip32
-returns the last four bytes of the message as a 32-bit integer assumed to
-be in network byte order.
-It adjusts
-.Fa b_wptr
-to remove these four bytes from the message.
-.Fa b_wptr
-does not need to be aligned.
-The function
-.Fn uni_msg_get32
-returns the first four bytes of the message as a 32-bit integer assumed to
-be in network byte order.
-It adjusts
-.Fa b_rptr
-to remove these four bytes from the message.
-.Fa b_rptr
-does not need to be aligned.
-The function
-.Fn uni_msg_trail32
-returns the
-.Fa n 'th
-32-bit integer from the buffer counted from the end of the buffer.
-The integer is assumed to be in network byte order.
-A value of -1 for
-.Fa n
-returns the last four bytes of the buffer, a value of -2 the four bytes
-just before the last four bytes and so on.
-All three functions do not check that the message is large enough.
-.Sh SEE ALSO
-.Xr libunimsg 3 ,
-.Xr mbuf 9
-.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
diff --git a/contrib/ngatm/man/unisap.3 b/contrib/ngatm/man/unisap.3
deleted file mode 100644
index bc0c2a7ae475..000000000000
--- a/contrib/ngatm/man/unisap.3
+++ /dev/null
@@ -1,265 +0,0 @@
-.\"
-.\" Copyright (c) 2004-2005
-.\" Hartmut Brandt.
-.\" All rights reserved.
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" $Begemot: libunimsg/man/unisap.3,v 1.5 2005/06/15 11:37:11 brandt_h Exp $
-.\"
-.Dd June 14, 2005
-.Dt UNISAP 3
-.Os
-.Sh NAME
-.Nm unimsg ,
-.Nm unisve_check_addr ,
-.Nm unisve_check_selector ,
-.Nm unisve_check_blli_id2 ,
-.Nm unisve_check_blli_id3 ,
-.Nm unisve_check_bhli ,
-.Nm unisve_check_sap ,
-.Nm unisve_overlap_addr ,
-.Nm unisve_overlap_selector ,
-.Nm unisve_overlap_blli_id2 ,
-.Nm unisve_overlap_blli_id3 ,
-.Nm unisve_overlap_bhli ,
-.Nm unisve_overlap_sap ,
-.Nm unisve_is_catchall ,
-.Nm unisve_match
-.Nd "ATM signalling library - ATM SAP handling"
-.Sh LIBRARY
-Begemot ATM signalling library
-.Pq libunimsg, -lunimsg
-.Sh SYNOPSIS
-.In uni4/unisap.h
-.Ft int
-.Fn unisve_check_addr "const struct unisve_addr *sve"
-.Ft int
-.Fn unisve_check_selector "const struct unisve_selector *sve"
-.Ft int
-.Fn unisve_check_blli_id2 "const struct unisve_blli_id2 *sve"
-.Ft int
-.Fn unisve_check_blli_id3 "const struct unisve_blli_id3 *sve"
-.Ft int
-.Fn unisve_check_bhli "const struct unisve_bhli *sve"
-.Ft int
-.Fn unisve_check_sap "const struct uni_sap *sve"
-.Ft int
-.Fn unisve_overlap_addr "const struct unisve_addr *sve1" "const struct unisve_addr *sve2"
-.Ft int
-.Fn unisve_overlap_selector "const struct unisve_selector *sve1" "const struct unisve_selector *sve2"
-.Ft int
-.Fn unisve_overlap_blli_id2 "const struct unisve_blli_id2 *sve1" "const struct unisve_blli_id2 *sve2"
-.Ft int
-.Fn unisve_overlap_blli_id3 "const struct unisve_blli_id3 *sve1" "const struct unisve_blli_id3 *sve2"
-.Ft int
-.Fn unisve_overlap_bhli "const struct unisve_bhli *sve1" "const struct unisve_bhli *sve2"
-.Ft int
-.Fn unisve_overlap_sap "const struct uni_sap *sap1" "const struct uni_sap *sap2"
-.Ft int
-.Fn unisve_is_catchall "const struct uni_sap *sap"
-.Ft int
-.Fn unisve_match "const struct uni_sap *sap" \
-"const struct uni_ie_called *called" "const struct uni_ie_blli *blli" \
-"const struct uni_ie_bhli *bhli"
-.Sh DESCRIPTION
-The
-.Nm
-library contains functions to handle Service Access Points (SAP) and SAP Vector
-Elements (SVE) as specified in the ATM Forum ATM API Semantic Description.
-SAPs are the analog of TCP and UDP ports in the ATM world.
-As usually in ATM they are a couple of orders of magnitude more complex as
-their Internet equivalent.
-See the ATM Forum document for a description.
-.Pp
-A SAP is a data structure:
-.Bd -literal -offset indent
-struct uni_sap {
- struct unisve_addr addr;
- struct unisve_selector selector;
- struct unisve_blli_id2 blli_id2;
- struct unisve_blli_id3 blli_id3;
- struct unisve_bhli bhli;
-};
-.Ed
-.Pp
-that consists of 5 elements matching different information elements in
-the SETUP message.
-Each of these elements has a tag that defines how the SVE is to be matched
-with the information element.
-The tag is one of
-.Bl -tag -width ".Dv UNISVE_PRESENT"
-.It Dv UNISVE_ABSENT
-The information element has to absent from the SETUP message.
-.It Dv UNISVE_PRESENT
-The information element has to be present in the SETUP message and must
-match the SVE.
-.It Dv UNISVE_ANY
-The information element may be absent from the SETUP message or may
-have any value.
-.El
-.Pp
-The called address is matched by a
-.Bd -literal -offset indent
-struct unisve_addr {
- enum unisve_tag tag;
- enum uni_addr_type type;/* type of address */
- enum uni_addr_plan plan;/* addressing plan */
- uint32_t len; /* length of address */
- u_char addr[UNI_ADDR_MAXLEN];
-};
-.Ed
-.Pp
-Here
-.Fa type
-is the type of address and
-.Fa plan
-is the address plan.
-.Fa len
-is the length of the address (for ATME addresses not counting the selector byte)
-and
-.Fa addr is the address itself.
-.Pp
-In case of ATME addresses the selector byte is matched by a
-.Bd -literal -offset indent
-struct unisve_selector {
- enum unisve_tag tag;
- uint8_t selector;
-};
-.Ed
-.Pp
-Here
-.Fa selector
-is the selector byte that must match the 20th byte of the ATME calling address
-from the SETUP message.
-.Pp
-The BLLI information element is matched by two SVEs: one for layer 2 options
-and one for layer 3 options.
-The layer 2 SVE is:
-.Bd -literal -offset indent
-struct unisve_blli_id2 {
- enum unisve_tag tag;
- uint8_t proto:5;/* the protocol */
- uint8_t user:7; /* user specific protocol */
-};
-.Ed
-.Pp
-Where the
-.Fa user
-fields is matched only if the
-.Fa proto
-field specifies
-.Dv UNI_BLLI_L2_USER .
-The layer 3 SVE is:
-.Bd -literal -offset indent
-struct unisve_blli_id3 {
- enum unisve_tag tag;
- uint8_t proto:5;/* L3 protocol */
- uint8_t user:7; /* user specific protocol */
- uint8_t ipi:8; /* ISO/IEC TR 9557 IPI */
- uint32_t oui:24; /* IEEE 802.1 OUI */
- uint32_t pid:16; /* IEEE 802.1 PID */
- uint32_t noipi; /* ISO/IEC TR 9557 per frame */
-};
-.Ed
-For the exact rules how matching occures refer to the source code or the
-ATM Forum document.
-.Pp
-Finally the BHLI information element is matched with a
-.Bd -literal -offset indent
-struct unisve_bhli {
- enum unisve_tag tag;
- enum uni_bhli type; /* type of info */
- uint32_t len; /* length of info */
- uint8_t info[8];/* info itself */
-};
-.Ed
-.Pp
-For each SVE type there is a function that checks whether the SVE is correct
-specified.
-The functions
-.Fn unisve_check_addr ,
-.Fn unisve_check_selector ,
-.Fn unisve_check_blli_id2 ,
-.Fn unisve_check_blli_id3 ,
-and
-.Fn unisve_check_bhli
-return one of the following error codes:
-.Bd -literal -offset indent
-enum {
- UNISVE_OK = 0,
- UNISVE_ERROR_BAD_TAG,
- UNISVE_ERROR_TYPE_PLAN_CONFLICT,
- UNISVE_ERROR_ADDR_SEL_CONFLICT,
- UNISVE_ERROR_ADDR_LEN,
- UNISVE_ERROR_BAD_ADDR_TYPE,
- UNISVE_ERROR_BAD_BHLI_TYPE,
- UNISVE_ERROR_BAD_BHLI_LEN,
-};
-.Ed
-.Pp
-A code of
-.Li UNISVE_OK
-means that the SVE has no error.
-The function
-.Fn unisve_check_sap
-checks a complete SAP and returns one of the above codes.
-.Pp
-There is a definition
-.Dv UNISVE_ERRSTR
-that evaluates to a comma separated list of strings that can be used
-to initializes an array of char pointers to map the error codes into
-human readable strings.
-.Pp
-The ATM Forum document defines the concept of overlaping SAPs.
-This basically means, that an incoming SETUP could match more than one SAP
-(and more than one application) to receive the SETUP.
-For each SVE type there is a function that checks whether two SVEs overlap
-and there is a function that checks whether two SAPs overlap.
-The functions
-.Fn unisve_overlap_addr ,
-.Fn unisve_overlap_selector ,
-.Fn unisve_overlap_blli_id2 ,
-.Fn unisve_overlap_blli_id3 ,
-.Fn unisve_overlap_bhli , and
-.Fn unisve_overlap_sap
-return 1 if the SVEs or SAPs overlap and 0 if they do not.
-They assume, that the SAPs are correct.
-.Pp
-The ATM Forum document specifies a catch-all SAP.
-The function
-.Fn unisve_is_catchall
-returns 1 if the SAP is the catch-all SAP and 0 otherwise.
-.Pp
-Finally the function
-.Fn unisve_match
-is used to match a SAP against the information elements from a SETUP message.
-It returns 1 if they match and 0 otherwise.
-.Sh SEE ALSO
-.Xr libunimsg 3
-.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
diff --git a/contrib/ngatm/man/unistruct.3 b/contrib/ngatm/man/unistruct.3
deleted file mode 100644
index 8a955068a7cc..000000000000
--- a/contrib/ngatm/man/unistruct.3
+++ /dev/null
@@ -1,323 +0,0 @@
-.\"
-.\" Copyright (c) 2004-2005
-.\" Hartmut Brandt.
-.\" All rights reserved.
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Begemot: libunimsg/man/unistruct.3,v 1.5 2005/06/15 11:37:12 brandt_h Exp $
-.\"
-.Dd May 23, 2005
-.Dt UNISTRUCT 3
-.Os
-.Sh NAME
-.Nm libngatm
-.Nd "ATM signalling library"
-.Sh LIBRARY
-Begemot ATM signalling library
-.Pq libngatm, -lngatm
-.Sh SYNOPSIS
-.In netnatm/msg/unistruct.h
-.In netnatm/msg/unimsglib.h
-.Sh DESCRIPTION
-The
-.Nm
-library handles UNI 4.0 messages.
-For each information element and message
-type the header files contain a structure definition.
-Additionally there
-are a number of help structures and a global context structure for some
-of the library functions.
-This document only describes the common structures.
-For information element and message structures see the header files.
-.Ss LIBRARY CONFIGURATION
-When the library is compiled a number of constants are define in the file
-.Pa uni_config.h .
-They define certain limits.
-Because of the use of these definitions a change
-in any of them requires a complete recompilation of all library code and
-all code that uses the library.
-The following constants are defined (they
-value behind the name is the default value):
-.Bl -tag -width XXXX
-.It Dv UNI_MAX_ERRIE ( Li 50 )
-When decoding information elements and analyzing them the library fills
-an array in the context with the identifiers of IEs that had errors.
-This is the size of this array.
-.It Dv UNI_NUM_IE_GIT ( Li 3 )
-A message is allowed to contain more than one General Identifier Transport
-information element.
-This is the maximum supported number of these IEs.
-.It Dv UNI_NUM_IE_BLLI ( Li 3 )
-The maximum number of BLLI information elements in a SETUP message.
-.It Dv UNI_NUM_IE_CALLEDSUB ( Li 2 )
-The maximum number of Called Subaddress information elements in a SETUP message.
-.It Dv UNI_NUM_IE_CALLINGSUB ( Li 2 )
-The maximum number of Calling Subaddress information elements in a SETUP
-message.
-.It Dv UNI_NUM_IE_TNS ( Li 4 )
-The maximum number of Transit Network Selection information elements in a SETUP
-message.
-.It Dv UNI_TNS_MAXLEN ( Li 4 )
-The maximum size of a name in the TNS IE.
-.It Dv UNI_UU_MAXLEN ( Li 128 )
-Maximum size of user data in the UU IE.
-.It Dv UNI_ADDR_MAXLEN ( Li 20 )
-Maximum address size.
-.It Dv UNI_SUBADDR_MAXLEN ( Li 20 )
-Maximum subaddress size.
-.It Dv UNI_NUM_IE_DTL ( Li 10 )
-Maximum number of DTL information elements in a SETUP message.
-.It Dv UNI_DTL_MAXNUM ( Li 20 )
-Maximum number of identifiers in one DTL information element.
-.El
-.Ss INFORMATION ELEMENTS
-Each information element structure starts with a field of type:
-.Bd -literal -offset indent
-struct uni_iehdr {
- enum uni_coding coding; /* coding standard */
- enum uni_ieact act; /* action indicator */
- u_int pass:1; /* PNNI pass along request */
- u_int present;/* which optional elements are present */
-};
-.Ed
-.Pp
-The
-.Fa coding
-field is the coding standard of the information element and may be one of
-.Dv UNI_CODING_ITU
-or
-.Dv UNI_CODING_NET .
-The action indicator
-.Fa act
-is used for error processing and is one of:
-.Bl -tag -width XXXX
-.It Dv UNI_IEACT_CLEAR
-clear call
-.It Dv UNI_IEACT_IGNORE
-ignore IE and proceed
-.It Dv UNI_IEACT_REPORT
-ignore IE, report and proceed
-.It Dv UNI_IEACT_MSG_IGNORE
-ignore message
-.It Dv UNI_IEACT_MSG_REPORT
-ignore message and report
-.It Dv UNI_IEACT_DEFAULT
-the use action indicator flag was not set.
-.El
-.Pp
-For information elements in PNNI message the
-.Fa pass
-fields contains the pass along flag from the IE header.
-.Pp
-The
-.Fa present
-field is a bit field, which contains four common bits describing the current
-state of the information element.
-The rest of the bits are used by the
-information elements to indicate which of the optional fields of the IE are
-present.
-Most of the IE header files contain definitions for those bits.
-The common bits are:
-.Bd -literal -offset indent
-#define UNI_IE_EMPTY 0x80000000
-#define UNI_IE_PRESENT 0x40000000
-#define UNI_IE_ERROR 0x20000000
-#define UNI_IE_XXX 0x10000000
-.Ed
-.Pp
-The flag
-.Dv UNI_IE_EMPTY
-indicates that the information element is present, but empty (its length is
-zero).
-This is legal for all information elements.
-The flag
-.Dv UNI_IE_PRESENT
-indicates that the IE is present in the message and the flag
-.Dv UNI_IE_ERROR
-indicates that the IE had an error.
-The flag
-.Dv UNI_IE_XXX
-is currently not used.
-.Pp
-The following macros may be used to test or change these flags:
-.Bl -tag -width XXXX
-.It Dv IE_ISPRESENT
-Check whether the IE is present and not empty.
-Returns true in this case.
-.It Dv IE_SETPRESENT
-Set the IE to be present and not empty.
-.It Dv IE_ISEMPTY
-Check whether the IE is present and empty.
-Returns true in this case.
-.It Dv IE_SETEMPTY
-Set the IE to be present and empty.
-.It Dv IE_ISERROR
-Check whether the IE is present and has an error.
-Returns true in this case.
-.It Dv IE_SETERROR
-Sets the IE to be present and to have an error.
-.It Dv IE_ISGOOD
-Checks whether the IE is present, not empty and without error.
-Returns true in this case.
-.El
-.Pp
-For each IE type there is an
-.Vt enum uni_ietype
-definition of the form
-.Dv UNI_IE_*
-in
-.Pa uni_hdr.h .
-.Pp
-.Pa unistruct.h
-contains a
-.Vt union uni_ieall
-that is the union of all IE structures and a
-.Bd -literal -offset indent
-struct uni_ie {
- enum uni_ietype ietype;
- union uni_ieall u;
-};
-.Ed
-.Ss MESSAGES
-Each message structure starts with a
-.Bd -literal -offset indent
-struct uni_msghdr {
- struct uni_cref cref;
- enum uni_msgact act; /* action indicator */
- u_int pass:1; /* PNNI pass along request */
-};
-.Ed
-.Pp
-The
-.Fa cref
-is the call reference:
-.Bd -literal -offset indent
-struct uni_cref {
- u_int flag;
- u_int cref;
-};
-.Ed
-.Pp
-There are two special call references:
-.Dv CREF_GLOBAL
-and
-.Dv CREF_DUMMY .
-The
-.Fa act
-field is the message action indicator and has one of the following values:
-.Bl -tag -width XXXX
-.It Dv UNI_MSGACT_CLEAR
-clear call
-.It Dv UNI_MSGACT_IGNORE
-ignore message
-.It Dv UNI_MSGACT_REPORT
-send STATUS message
-.It Dv UNI_MSGACT_DEFAULT
-default handling for this message type
-.El
-.Pp
-The
-.Fa pass
-field is the pass along indicator in the case of PNNI messages.
-.Pp
-For each message type there is a
-.Vt enum uni_msgtype
-definition of the form
-.Dv UNI_*
-in
-.Pa uni_hdr.h .
-.Pa uni_struct.h
-contains a
-.Vt union_msgall
-that is the union of all message structures and a
-.Bd -literal -offset indent
-struct uni_all {
- enum uni_msgtype mtype;
- union uni_msgall u;
-};
-.Ed
-.Ss CONTEXTS
-The header file
-.Pa unimsglib.h
-contains a definition of a
-.Vt struct uni_context
-that is used to minimize the number of arguments passed to certain functions
-and to avoid the use of global variables.
-This structure has the following
-public fields (all other fields are used internally by the library):
-.Bl -tag -width XXXX
-.It Fa err
-This is an array consisting of the following structures:
-.Bd -literal -offset indent
-struct uni_ierr {
- enum uni_ierr_type err; /* what error */
- enum uni_ieact act; /* the action indicator */
- u_int ie:8; /* the ie type */
- u_int man:1; /* mandatory flag */
- u_int epref:1;/* Q.2971 9.5.3.2.1 low-pri epref */
-};
-.Ed
-When decoding information elements the information about IEs with errors is
-stuffed into this array.
-.It Fa errcnt
-The current number of IEs in
-.Fa err .
-.It Fa q2932
-Enable the Q.2932.1 Generic Functional Protocol.
-Currently only message
-and IE decoding/encoding is supported.
-The signalling part is still missing.
-.It Fa pnni
-Enable PNNI extensions.
-Currently only message and IE decoding/encoding
-is supported.
-The signalling part is still missing.
-.It Fa git_hard
-Do hard checking on GIT information elements.
-.It Fa bearer_hard
-Do hard checking on Broadband Bearer IEs.
-This involves rejecting old bearer
-type values.
-.It Fa cause_hard
-Do hard checking on Cause information elements.
-.It Fa multiline
-This is used by the printing routines.
-Legal values are 0 to 4 and give
-different kinds of printout.
-.It Fa tabsiz
-The size of tabulation to use in printing.
-4 is a good value.
-.El
-.Sh SEE ALSO
-.Xr libunimsg 3
-.Sh STANDARDS
-This implementation conforms to the applicable ITU-T
-recommendations and ATM Forum standards with the exception of some limitations
-(see the Configuration section).
-.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
diff --git a/contrib/ngatm/snmp_atm/BEGEMOT-ATM.txt b/contrib/ngatm/snmp_atm/BEGEMOT-ATM.txt
deleted file mode 100644
index f6cca9615e2c..000000000000
--- a/contrib/ngatm/snmp_atm/BEGEMOT-ATM.txt
+++ /dev/null
@@ -1,301 +0,0 @@
---
--- Copyright (c) 2001-2002
--- Fraunhofer Institute for Open Communication Systems (FhG Fokus).
--- All rights reserved.
--- Copyright (c) 2004
--- Hartmut Brandt.
--- All rights reserved.
---
--- Author: Hartmut Brandt <harti@freebsd.org>
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
--- 1. Redistributions of source code must retain the above copyright
--- notice, this list of conditions and the following disclaimer.
--- 2. Redistributions in binary form must reproduce the above copyright
--- notice, this list of conditions and the following disclaimer in the
--- documentation and/or other materials provided with the distribution.
---
--- THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
--- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
--- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
--- ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
--- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
--- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
--- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
--- SUCH DAMAGE.
---
--- $Begemot: libunimsg/snmp_atm/BEGEMOT-ATM.txt,v 1.2 2004/08/06 14:50:26 brandt Exp $
---
--- Private Begemot MIB for ATM interfaces.
---
-BEGEMOT-ATM-MIB DEFINITIONS ::= BEGIN
-
-IMPORTS
- MODULE-IDENTITY, OBJECT-TYPE, Unsigned32, TimeTicks
- FROM SNMPv2-SMI
- TEXTUAL-CONVENTION, DisplayString
- FROM SNMPv2-TC
- ifIndex
- FROM IF-MIB
- begemot
- FROM BEGEMOT-MIB;
-
-begemotAtm MODULE-IDENTITY
- LAST-UPDATED "200407190000Z"
- ORGANIZATION "German Aerospace Centre"
- CONTACT-INFO
- " Hartmut Brandt
-
- Postal: German Aerospace Centre (DLR)
- Institute of Communications and Navigation
- 82234 Wessling
- Germany
-
- Fax: +49 8153 28 2844
-
- E-mail: harti@freebsd.org"
- DESCRIPTION
- "The Begemot MIB for ATM interfaces."
-
- ::= { begemot 101 }
-
-begemotAtmObjects OBJECT IDENTIFIER ::= { begemotAtm 1 }
-
--- --------------------------------------------------------------------------
-
-AtmESI ::= TEXTUAL-CONVENTION
- DISPLAY-HINT "1x:"
- STATUS current
- DESCRIPTION
- "An ATM End System Identifier. This is basically the same as
- an Ethernet Address and is assigned using the same rules."
- SYNTAX OCTET STRING (SIZE(6))
-
--- --------------------------------------------------------------------------
-
---
--- Interfaces table
---
-begemotAtmIfTable OBJECT-TYPE
- SYNTAX SEQUENCE OF BegemotAtmIfEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "This table contains an entry for each hardware ATM
- interface. The table is indexed by the interface index."
- ::= { begemotAtmObjects 1 }
-
-begemotAtmIfEntry OBJECT-TYPE
- SYNTAX BegemotAtmIfEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "This is a table entry describing one ATM hardware interface."
- INDEX { ifIndex }
- ::= { begemotAtmIfTable 1 }
-
-BegemotAtmIfEntry ::= SEQUENCE {
- begemotAtmIfName DisplayString,
- begemotAtmIfPcr Unsigned32,
- begemotAtmIfMedia INTEGER,
- begemotAtmIfVpiBits Unsigned32,
- begemotAtmIfVciBits Unsigned32,
- begemotAtmIfMaxVpcs Unsigned32,
- begemotAtmIfMaxVccs Unsigned32,
- begemotAtmIfEsi AtmESI,
- begemotAtmIfCarrierStatus INTEGER,
- begemotAtmIfMode INTEGER
-}
-
-begemotAtmIfName OBJECT-TYPE
- SYNTAX DisplayString (SIZE(1..15))
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Name of the ATM interface."
- ::= { begemotAtmIfEntry 1 }
-
-begemotAtmIfPcr OBJECT-TYPE
- SYNTAX Unsigned32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The line cell rate of the interface."
- ::= { begemotAtmIfEntry 2 }
-
-begemotAtmIfMedia OBJECT-TYPE
- SYNTAX INTEGER {
- other(1),
- unknown(3),
- utp25(4),
- taxi100(5),
- taxi140(6),
- mm155(7),
- sm155(8),
- utp155(9),
- mm622(10),
- sm622(11),
- virtual(12)
- }
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The physical medium."
- ::= { begemotAtmIfEntry 3 }
-
-begemotAtmIfVpiBits OBJECT-TYPE
- SYNTAX Unsigned32 (0..12)
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Number of VPI bits that are used by the device."
- ::= { begemotAtmIfEntry 4 }
-
-begemotAtmIfVciBits OBJECT-TYPE
- SYNTAX Unsigned32 (0..16)
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "Number of VCI bits that are used by the device."
- ::= { begemotAtmIfEntry 5 }
-
-begemotAtmIfMaxVpcs OBJECT-TYPE
- SYNTAX Unsigned32 (0..256)
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The maximum number of VPC supported on this device. This may not
- be larger than 2^begemotAtmIfVpiBits."
- ::= { begemotAtmIfEntry 6 }
-
-begemotAtmIfMaxVccs OBJECT-TYPE
- SYNTAX Unsigned32 (0..16777216)
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The maximum number of VCC supported on this device. This may not
- be larger than 2^(begemotAtmIfVpiBits + begemotAtmVciBits)."
- ::= { begemotAtmIfEntry 7 }
-
-begemotAtmIfEsi OBJECT-TYPE
- SYNTAX AtmESI
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The default End System Identifier as reported by the hardware.
- If the hardware has no ESI all six bytes are reported as 0."
- ::= { begemotAtmIfEntry 8 }
-
-begemotAtmIfCarrierStatus OBJECT-TYPE
- SYNTAX INTEGER { carrierOn(1), carrierOff(2), unknown(3), none(4) }
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The state of the carrier. For interfaces which don't have the
- notion of a carriere none is reported."
- ::= { begemotAtmIfEntry 9 }
-
-begemotAtmIfMode OBJECT-TYPE
- SYNTAX INTEGER { sonet(1), sdh(2), unknown(3) }
- MAX-ACCESS read-write
- STATUS current
- DESCRIPTION
- "The mode of the SUNI interface. For interfaces without SUNI
- unknown is reported in which case the variable is read-only.
- Some types of interfaces may not be able to change this value."
- ::= { begemotAtmIfEntry 10 }
-
-begemotAtmIfTableLastChange OBJECT-TYPE
- SYNTAX TimeTicks
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The value of sysUpTime the last time that an entry in
- begemotIfTable was created or destroyed. If the table is
- unchanged since the last coldStart this value is zero."
- ::= { begemotAtmObjects 2 }
-
---
--- Interface hardware table
---
-begemotAtmHWTable OBJECT-TYPE
- SYNTAX SEQUENCE OF BegemotAtmHWEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "This table augments the begemotAtmIfTable and contains an entry
- for each hardware ATM interface. The entries describe the
- ATM hardware interface."
- ::= { begemotAtmObjects 3 }
-
-begemotAtmHWEntry OBJECT-TYPE
- SYNTAX BegemotAtmHWEntry
- MAX-ACCESS not-accessible
- STATUS current
- DESCRIPTION
- "This is a table entry describing one ATM hardware interface."
- AUGMENTS { begemotAtmIfEntry }
- ::= { begemotAtmHWTable 1 }
-
-BegemotAtmHWEntry ::= SEQUENCE {
- begemotAtmHWVendor DisplayString,
- begemotAtmHWDevice DisplayString,
- begemotAtmHWSerial Unsigned32,
- begemotAtmHWVersion Unsigned32,
- begemotAtmHWSoftVersion Unsigned32
-}
-
-begemotAtmHWVendor OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "A short string naming the vendor of the interface card."
- ::= { begemotAtmHWEntry 1 }
-
-begemotAtmHWDevice OBJECT-TYPE
- SYNTAX DisplayString
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "A short string naming the brand of the interface card."
- ::= { begemotAtmHWEntry 2 }
-
-begemotAtmHWSerial OBJECT-TYPE
- SYNTAX Unsigned32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The serial number of the interface card or 0 if it doesn't
- report a serial number."
- ::= { begemotAtmHWEntry 3 }
-
-begemotAtmHWVersion OBJECT-TYPE
- SYNTAX Unsigned32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The hardware version of the interface card or 0 if it doesn't
- report a hardware version number."
- ::= { begemotAtmHWEntry 4 }
-
-begemotAtmHWSoftVersion OBJECT-TYPE
- SYNTAX Unsigned32
- MAX-ACCESS read-only
- STATUS current
- DESCRIPTION
- "The firmware version of the interface card or 0 if it doesn't
- report a firmware version number."
- ::= { begemotAtmHWEntry 5 }
-
--- --------------------------------------------------------------------
-
--- System specific parts
-begemotAtmSysGroup OBJECT IDENTIFIER ::= { begemotAtmObjects 4 }
-
-END
diff --git a/contrib/ngatm/snmp_atm/atm.h b/contrib/ngatm/snmp_atm/atm.h
deleted file mode 100644
index 456f31e71ca5..000000000000
--- a/contrib/ngatm/snmp_atm/atm.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2004
- * Deutsches Zentrum fuer Luft- und Raumfahrt.
- * All rights reserved.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/snmp_atm/atm.h,v 1.3 2005/05/23 11:46:46 brandt_h Exp $
- */
-
-#include <sys/types.h>
-#include <sys/queue.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <net/if_mib.h>
-
-#include <bsnmp/snmpmod.h>
-#include <bsnmp/snmp_mibII.h>
-#include <bsnmp/snmp_atm.h>
-
-/*
- * Event registrations
- */
-struct atmif_reg {
- TAILQ_ENTRY(atmif_reg) link;
- void *data;
- atmif_event_f func;
- const struct lmodule *mod;
- struct atmif_priv *aif; /* back pointer */
-};
-TAILQ_HEAD(atmif_reg_list, atmif_reg);
-
-/*
- * Interface data
- */
-struct atmif_priv {
- struct atmif pub; /* public part, must be first */
- TAILQ_ENTRY(atmif_priv) link;
- u_int index; /* if_index */
- void *ifpreg;
- struct atmif_sys *sys;
- struct atmif_reg_list notify;
-};
-TAILQ_HEAD(atmif_list, atmif_priv);
-
-/* list of all (known) ATM interfaces */
-extern struct atmif_list atmif_list;
-
-extern struct lmodule *module;
-
-/* Check the carrier state of the interface */
-void atmif_check_carrier(struct atmif_priv *);
-
-/* Send notification to all listeners. */
-void atmif_send_notification(struct atmif_priv *, enum atmif_notify, uintptr_t);
-
-/* Get the interface point for a table access */
-int atmif_get_aif(struct snmp_value *, u_int, enum snmp_op,
- struct atmif_priv **);
-
-/* Destroy system dependend stuff. */
-void atmif_sys_destroy(struct atmif_priv *);
-
-/* Attach to an ATM interface */
-int atmif_sys_attach_if(struct atmif_priv *);
-
-/* Get vendor string */
-int atm_sys_get_hw_vendor(struct atmif_priv *, struct snmp_value *);
-
-/* Get device string */
-int atm_sys_get_hw_device(struct atmif_priv *, struct snmp_value *);
-
-/* Extract the ATM MIB from the interface's private MIB */
-void atmif_sys_fill_mib(struct atmif_priv *);
diff --git a/contrib/ngatm/snmp_atm/atm_tree.def b/contrib/ngatm/snmp_atm/atm_tree.def
deleted file mode 100644
index ac70b0e7ee22..000000000000
--- a/contrib/ngatm/snmp_atm/atm_tree.def
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Copyright (c) 2000-2003
-# Fraunhofer Institut for Open Communication Systems (FOKUS).
-# All rights reserved.
-# Copyright (c) 2004
-# Hartmut Brandt.
-# All rights reserved.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $Begemot: libunimsg/snmp_atm/atm_tree.def,v 1.3 2004/08/06 14:50:27 brandt Exp $
-#
-# SNMP module for ATM hardware interfaces.
-#
-# $Begemot: libunimsg/snmp_atm/atm_tree.def,v 1.3 2004/08/06 14:50:27 brandt Exp $
-#
-(1 internet
- (4 private
- (1 enterprises
- (12325 fokus
- (1 begemot
- (101 begemotAtm
- (1 begemotAtmObjects
- (1 begemotAtmIfTable
- (1 begemotAtmIfEntry : INTEGER op_atmif
- (1 begemotAtmIfName OCTETSTRING GET)
- (2 begemotAtmIfPcr UNSIGNED32 GET)
- (3 begemotAtmIfMedia INTEGER GET)
- (4 begemotAtmIfVpiBits UNSIGNED32 GET)
- (5 begemotAtmIfVciBits UNSIGNED32 GET)
- (6 begemotAtmIfMaxVpcs UNSIGNED32 GET)
- (7 begemotAtmIfMaxVccs UNSIGNED32 GET)
- (8 begemotAtmIfEsi OCTETSTRING GET)
- (9 begemotAtmIfCarrierStatus INTEGER GET)
- (10 begemotAtmIfMode INTEGER GET SET)
- ))
- (2 begemotAtmIfTableLastChange TIMETICKS op_atm GET)
- (3 begemotAtmHWTable
- (1 begemotAtmHWEntry : INTEGER op_atmhw
- (1 begemotAtmHWVendor OCTETSTRING GET)
- (2 begemotAtmHWDevice OCTETSTRING GET)
- (3 begemotAtmHWSerial UNSIGNED32 GET)
- (4 begemotAtmHWVersion UNSIGNED32 GET)
- (5 begemotAtmHWSoftVersion UNSIGNED32 GET)
- ))
- (4 begemotAtmSysGroup
- (1 begemotAtmFreeBSDGroup
- )
- )
- )
- ))
- )
- )
-))
diff --git a/contrib/ngatm/snmp_atm/snmp_atm.3 b/contrib/ngatm/snmp_atm/snmp_atm.3
deleted file mode 100644
index a85cd1bcf70e..000000000000
--- a/contrib/ngatm/snmp_atm/snmp_atm.3
+++ /dev/null
@@ -1,218 +0,0 @@
-.\"
-.\" Copyright (c) 2001-2002
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\" Copyright (c) 2003-2004
-.\" Hartmut Brandt.
-.\" All rights reserved.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Begemot: libunimsg/snmp_atm/snmp_atm.3,v 1.2 2005/05/23 12:00:29 brandt_h Exp $
-.\"
-.Dd May 23, 2005
-.Dt SNMP_ATM 3
-.Os
-.Sh NAME
-.Nm atmif_event_f ,
-.Nm atm_find_if_name ,
-.Nm atm_find_if ,
-.Nm atm_notify_aif ,
-.Nm atm_unnotify_aif
-.Nd "ATM driver module for snmpd.
-.Sh LIBRARY
-.Pq begemotSnmpdModulePath."netgraph" = "@MODPATH@snmp_netgraph.so" (FreeBSD)
-.Pq begemotSnmpdModulePath."mibII" = "@MODPATH@snmp_mibII.so"
-.Pq begemotSnmpdModulePath."atm" = "@MODPATH@snmp_atm.so"
-.Sh SYNOPSIS
-.In bsnmp/snmpmod.h
-.In bsnmp/snmp_mibII.h
-.In bsnmp/snmp_atm.h
-.Ft typedef void
-.Fn (*atmif_event_f) "struct atmif *aif" "enum atmif_notify event" "uintptr_t data" "void *uarg"
-.Ft struct atmif *
-.Fn atm_find_if_name "const char *name"
-.Ft struct atmif *
-.Fn atm_find_if "u_int ifindex"
-.Ft void *
-.Fn atm_notify_aif "struct atmif *aif" "const struct lmodule *mod" "atmif_event_f func" "void *uarg"
-.Ft void
-.Fn atm_unnotify_aif "void *not"
-.Sh DESCRIPTION
-The
-.Nm snmp_atm
-module implements a number of tables and scalars that enable remote access to
-the ATM devices in the system. It also exports a number of
-functions, that allow other modules to easily access ATM devices.
-.Pp
-The module maintains an extension to the interface structure exported by
-.Xr snmp_mibII 3
-for all ATM devices. This structure has the following fields:
-.Bd -literal -offset indent
-struct atmif {
- struct mibif *ifp; /* common interface data */
- struct atmif_mib *mib; /* ATM MIB */
- enum atmif_carrier_state carrier;
- enum atmif_suni_mode mode; /* SUNI mode SDH or SONET */
-};
-.Ed
-.Pp
-The fields have the following meaning:
-.Bl -tag -width XXX
-.It Fa ifp
-The field points to the
-.Xr snmp_mibII 3
-interface structure.
-.It Fa mib
-The special ATM interface MIB (see below).
-.It Fa carrier
-The current state of the carrier. One of the following:
-.Bl -tag -width XXX
-.It Dv ATMIF_CARRIER_ON
-carrier detected,
-.It Dv ATMIF_CARRIER_OFF
-no carrier,
-.It Dv ATMIF_CARRIER_UNKNOWN
-the state of the carrier is unknown,
-.It Dv ATMIF_CARRIER_NONE
-the device has no notion of carrier or is not able to sense it.
-.El
-.It Fa mode
-For ATM devices with a SUNI chip this is the current mode of the interface:
-.Bl -tag -width XXX
-.It Dv ATMIF_SUNI_MODE_SONET
-The interface is in SONET mode.
-.It Dv ATMIF_SUNI_MODE_SDH
-The interface is in SDH mode.
-.It Dv ATMIF_SUNI_MODE_UNKNOWN
-The interface either has no SUNI interface or the mode is unknown (for example,
-interface is down).
-.El
-.El
-.Pp
-An ATM interface can be found by name or by SNMP interface index (see
-.Xr snmp_mibII 3
-for a discussion of interface indexes).
-The function
-.Fn atm_find_if_name
-searches an interface given a name.
-The function
-.Fn atm_find_if
-searches an interface by its interface index.
-Both functions return NULL if an interface cannot be found.
-.Pp
-The ATM MIB contains the following fields:
-.Bd -literal -offset indent
-struct atmif_mib {
- u_int version; /* currently 0 */
-
- u_int device; /* type of hardware (system specific) */
- u_int serial; /* card serial number (device specific) */
- u_int hw_version; /* card version (device specific) */
- u_int sw_version; /* firmware version (device specific) */
- u_int media; /* physical media (see MIB) */
-
- u_char esi[6]; /* end system identifier (MAC) */
- u_int pcr; /* supported peak cell rate */
- u_int vpi_bits; /* number of used bits in VPI field */
- u_int vci_bits; /* number of used bits in VCI field */
- u_int max_vpcs; /* maximum number of VPCs */
- u_int max_vccs; /* maximum number of VCCs */
-};
-.Ed
-.Ss NOTIFICATIONS
-An other module can register with
-.Nm
-to receive notifications when certain events happen on the ATM interface.
-The registration is done with
-.Fn atm_notify_aif
-which takes a pointer to the interface, the calling module pointer, a callback
-function and a user argument that is passed to the callback function.
-The callback function is called with the interface pointer, a notification
-code, a notification argument and the user argument. The following
-notifications are defined:
-.Bl -tag -width XXX
-.It Dv ATMIF_NOTIFY_DESTROY
-The interface is destroyed. The notification argument is not used.
-.It Dv ATMIF_NOTIFY_CARRIER
-The carrier state on the interface has changed. The argument is the
-.Em old
-state of the carrier. The new state can be obtained from the interface
-structure.
-.It Dv ATMIF_NOTIFY_VCC
-A permanent VCC has been created or destroyed. The argument is an u_int that
-can be decoded as follows:
-.Bd -literal -offset indent
-vpi = (arg >> 24) & 0xff;
-vci = (arg >> 8) & 0xffff;
-state = arg & 1;
-.Ed
-.Pp
-.Va state
-is 0 if the VCC was destroyed and 1 if it was created.
-.El
-The registration for notification can be undone by passing the return
-value from
-.Fn atm_notify_aif
-to
-.Fn atm_unnotify_aif .
-The registrations is automatically removed if the interface is destroyed.
-.Ss MIB
-The MIB implemented by the module is defined in
-.Pa BEGEMOT-ATM.txt .
-In the generic part there are two tables and one scalar, there is also
-a system specific group:
-.Bl -tag -width XXX
-.It Va begemotAtmIfTable
-This table is an extension of
-.Va ifTable .
-It contains a row for each ATM interface and is index with
-.Va ifIndex .
-All fields are read-only except the
-.Va begemotAtmIfMode
-column.
-.It Va begemotAtmIfTableLastChange
-Contains the tick when a row was created or destroyed in the above table or
-0, if the table did not change since start of the SNMP agent.
-.It Va begemotAtmHWTable
-Is also indexed by
-.Va ifIndex
-and contains hardware specific information. This table is read-only.
-.El
-.Sh FILES
-.Bl -tag -width "XXXXXXXXX"
-.It Pa @DEFPATH@atm_tree.def
-The description of the MIB tree implemented by
-.Nm .
-.It Pa @MIBSPATH@BEGEMOT-ATM.txt
-This is the MIB that is implemented by this module.
-.El
-.Sh SEE ALSO
-.Xr bsnmpd 1 ,
-.Xr gensnmptree 1 ,
-.Xr snmp_mibII 3 ,
-.Xr snmpmod 3 ,
-.Xr snmp_netgraph 3
-.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
diff --git a/contrib/ngatm/snmp_atm/snmp_atm.c b/contrib/ngatm/snmp_atm/snmp_atm.c
deleted file mode 100644
index a2590aeb4dd4..000000000000
--- a/contrib/ngatm/snmp_atm/snmp_atm.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Copyright (c) 2001-2002
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- * Copyright (c) 2003-2004
- * Hartmut Brandt.
- * All rights reserved.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/snmp_atm/snmp_atm.c,v 1.3 2005/05/23 11:46:46 brandt_h Exp $
- *
- * SNMP module for ATM hardware interfaces.
- */
-
-#include "atm.h"
-#include "atm_tree.h"
-#include "atm_oid.h"
-
-#include <sys/ioctl.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <syslog.h>
-#include <net/if_types.h>
-#include <net/if_media.h>
-#include <net/if_atm.h>
-
-struct lmodule *module;
-
-/* list of all (known) ATM interfaces */
-struct atmif_list atmif_list = TAILQ_HEAD_INITIALIZER(atmif_list);
-
-/* whether we are started or not */
-static int started;
-
-/* last time table was changed */
-static uint64_t last_change;
-
-/* for the registration */
-static const struct asn_oid oid_begemotAtm = OIDX_begemotAtm;
-
-/* the registration */
-static u_int reg_atm;
-
-/*
- * Find an ATM interface by name
- */
-struct atmif *
-atm_find_if_name(const char *name)
-{
- struct atmif_priv *aif;
-
- TAILQ_FOREACH(aif, &atmif_list, link)
- if (strcmp(aif->pub.ifp->name, name) == 0)
- return (&aif->pub);
- return (NULL);
-}
-
-/*
- * get the interface from the interface index
- */
-struct atmif *
-atm_find_if(u_int ifindex)
-{
- struct atmif_priv *aif;
-
- TAILQ_FOREACH(aif, &atmif_list, link)
- if (aif->index == ifindex)
- return (&aif->pub);
- return (NULL);
-}
-
-/*
- * Send notification to all listeners.
- */
-void
-atmif_send_notification(struct atmif_priv *aif, enum atmif_notify code,
- uintptr_t arg)
-{
- struct atmif_reg *r0, *r1;
-
- r0 = TAILQ_FIRST(&aif->notify);
- while (r0 != NULL) {
- r1 = TAILQ_NEXT(r0, link);
- r0->func(&aif->pub, code, arg, r0->data);
- r0 = r1;
- }
-}
-
-/*
- * Destroy an interface
- */
-static void
-atmif_destroy(struct atmif_priv *aif)
-{
- struct atmif_reg *r0;
-
- atmif_send_notification(aif, ATMIF_NOTIFY_DESTROY,
- (uintptr_t)0);
-
- atmif_sys_destroy(aif);
-
- if (aif->ifpreg != NULL)
- mibif_unnotify(aif->ifpreg);
-
- while ((r0 = TAILQ_FIRST(&aif->notify)) != NULL) {
- TAILQ_REMOVE(&aif->notify, r0, link);
- free(r0);
- }
-
- TAILQ_REMOVE(&atmif_list, aif, link);
- free(aif);
-
- last_change = this_tick;
-}
-
-/*
- * Function gets called from the MIB-II module for events on that interface
- */
-static void
-atmif_notify(struct mibif *ifp __unused, enum mibif_notify event, void *data)
-{
- struct atmif_priv *aif = data;
-
- switch (event) {
-
- case MIBIF_NOTIFY_DESTROY:
- atmif_destroy(aif);
- break;
- }
-}
-
-/*
- * Check the carrier state of the interface
- */
-void
-atmif_check_carrier(struct atmif_priv *aif)
-{
- struct ifmediareq ifmr;
- enum atmif_carrier_state ost = aif->pub.carrier;
-
- memset(&ifmr, 0, sizeof(ifmr));
- strcpy(ifmr.ifm_name, aif->pub.ifp->name);
-
- if (ioctl(mib_netsock, SIOCGIFMEDIA, &ifmr) == -1) {
- aif->pub.carrier = ATMIF_CARRIER_UNKNOWN;
- return;
- }
- if (!(ifmr.ifm_status & IFM_AVALID)) {
- aif->pub.carrier = ATMIF_CARRIER_UNKNOWN;
- return;
- }
- if (ifmr.ifm_status & IFM_ACTIVE)
- aif->pub.carrier = ATMIF_CARRIER_ON;
- else
- aif->pub.carrier = ATMIF_CARRIER_OFF;
-
- if (ost != aif->pub.carrier)
- atmif_send_notification(aif, ATMIF_NOTIFY_CARRIER,
- (uintptr_t)ost);
-}
-
-/*
- * Retrieve the SUNI mode
- */
-static int
-atmif_get_mode(struct atmif_priv *aif)
-{
- struct ifmediareq ifmr;
-
- memset(&ifmr, 0, sizeof(ifmr));
- strcpy(ifmr.ifm_name, aif->pub.ifp->name);
-
- if (ioctl(mib_netsock, SIOCGIFMEDIA, &ifmr) < 0) {
- syslog(LOG_ERR, "SIOCGIFMEDIA: %m");
- aif->pub.mode = ATMIF_SUNI_MODE_UNKNOWN;
- return (SNMP_ERR_GENERR);
- }
- if (ifmr.ifm_current & IFM_ATM_SDH)
- aif->pub.mode = ATMIF_SUNI_MODE_SDH;
- else
- aif->pub.mode = ATMIF_SUNI_MODE_SONET;
-
- return (SNMP_ERR_NOERROR);
-}
-
-/*
- * Change the SUNI mod
- */
-static int
-atmif_set_mode(struct atmif_priv *aif, int newmode)
-{
- struct ifmediareq ifmr;
- struct ifreq ifr;
-
- memset(&ifmr, 0, sizeof(ifmr));
- strcpy(ifmr.ifm_name, aif->pub.ifp->name);
-
- /* get current mode */
- if (ioctl(mib_netsock, SIOCGIFMEDIA, &ifmr) < 0) {
- syslog(LOG_ERR, "SIOCGIFMEDIA: %m");
- return (SNMP_ERR_GENERR);
- }
-
- memset(&ifr, 0, sizeof(ifr));
- strcpy(ifr.ifr_name, aif->pub.ifp->name);
-
- ifr.ifr_media = ifmr.ifm_current;
- if (newmode == ATMIF_SUNI_MODE_SDH)
- ifr.ifr_media |= IFM_ATM_SDH;
- else
- ifr.ifr_media &= ~IFM_ATM_SDH;
-
- if (ioctl(mib_netsock, SIOCSIFMEDIA, &ifr) < 0) {
- syslog(LOG_ERR, "SIOCSIFMEDIA: %m");
- return (SNMP_ERR_GENERR);
- }
-
- aif->pub.mode = newmode;
- return (SNMP_ERR_NOERROR);
-}
-
-/*
- * Attach to an ATM interface
- */
-static void
-attach_if(struct mibif *ifp)
-{
- struct atmif_priv *aif;
-
- /* we should not know it */
- TAILQ_FOREACH(aif, &atmif_list, link)
- if (aif->pub.ifp == ifp) {
- syslog(LOG_CRIT, "new ATM if already known '%s'",
- ifp->name);
- return;
- }
-
- /*
- * tap it
- */
- if ((aif = malloc(sizeof(*aif))) == NULL) {
- syslog(LOG_ERR, "new atmif: %m");
- return;
- }
- memset(aif, 0, sizeof(*aif));
-
- aif->pub.ifp = ifp;
- aif->index = ifp->index;
- TAILQ_INIT(&aif->notify);
-
- if (atmif_sys_attach_if(aif)) {
- free(aif);
- return;
- }
-
- aif->ifpreg = mibif_notify(ifp, module, atmif_notify, aif);
-
- aif->pub.carrier = ATMIF_CARRIER_UNKNOWN;
- atmif_check_carrier(aif);
- (void)atmif_get_mode(aif);
-
- INSERT_OBJECT_INT(aif, &atmif_list);
-
- last_change = this_tick;
-
- return;
-}
-
-/*
- * Function gets called when a new interface is created. If this is an
- * ATM interface, hook in. Claim the interface in any case even when
- * the creation of our data structures fails.
- */
-static int
-new_if(struct mibif *ifp)
-{
- if (!started || ifp->mib.ifmd_data.ifi_type != IFT_ATM ||
- ifp->xnotify != NULL)
- return (0);
-
- attach_if(ifp);
- return (1);
-}
-
-/*
- * Start the module
- */
-static void
-atm_start(void)
-{
- struct mibif *ifp;
-
- reg_atm = or_register(&oid_begemotAtm,
- "The Begemot MIB for ATM interfaces.", module);
-
- started = 1;
- for (ifp = mib_first_if(); ifp != NULL; ifp = mib_next_if(ifp))
- if (ifp->mib.ifmd_data.ifi_type == IFT_ATM &&
- ifp->xnotify == NULL)
- attach_if(ifp);
-}
-
-/*
- * Called when modules is loaded
- */
-static int
-atm_init(struct lmodule *mod, int argc __unused, char *argv[] __unused)
-{
- module = mod;
-
- /* register to get creation messages for ATM interfaces */
- if (mib_register_newif(new_if, module)) {
- syslog(LOG_ERR, "cannot register newif function: %m");
- return (-1);
- }
-
- return (0);
-}
-
-/*
- * Called when module gets unloaded - free all resources
- */
-static int
-atm_fini(void)
-{
- struct atmif_priv *aif;
-
- while ((aif = TAILQ_FIRST(&atmif_list)) != NULL)
- atmif_destroy(aif);
-
- mib_unregister_newif(module);
- or_unregister(reg_atm);
-
- return (0);
-}
-
-/*
- * Other module unloaded/loaded
- */
-static void
-atm_loading(const struct lmodule *mod, int loading)
-{
- struct atmif_priv *aif;
- struct atmif_reg *r0, *r1;
-
- if (!loading) {
- /* remove notifications for this module */
- TAILQ_FOREACH(aif, &atmif_list, link)
- TAILQ_FOREACH_SAFE(r0, &aif->notify, link, r1) {
- if (r0->mod == mod) {
- TAILQ_REMOVE(&aif->notify, r0, link);
- free(r0);
- }
- }
- }
-}
-
-const struct snmp_module config = {
- .comment = "This module implements a private MIB for ATM interfaces.",
- .init = atm_init,
- .fini = atm_fini,
- .start = atm_start,
- .tree = atm_ctree,
- .tree_size = atm_CTREE_SIZE,
- .loading = atm_loading
-};
-
-/*
- * Get the interface point for a table access
- */
-int
-atmif_get_aif(struct snmp_value *value, u_int sub, enum snmp_op op,
- struct atmif_priv **aifp)
-{
- switch (op) {
-
- case SNMP_OP_GETNEXT:
- if ((*aifp = NEXT_OBJECT_INT(&atmif_list,
- &value->var, sub)) == NULL)
- return (SNMP_ERR_NOSUCHNAME);
- value->var.len = sub + 1;
- value->var.subs[sub] = (*aifp)->index;
- break;
-
- case SNMP_OP_GET:
- if ((*aifp = FIND_OBJECT_INT(&atmif_list,
- &value->var, sub)) == NULL)
- return (SNMP_ERR_NOSUCHNAME);
- break;
-
- case SNMP_OP_SET:
- if ((*aifp = FIND_OBJECT_INT(&atmif_list,
- &value->var, sub)) == NULL)
- return (SNMP_ERR_NO_CREATION);
- break;
-
- case SNMP_OP_ROLLBACK:
- case SNMP_OP_COMMIT:
- if ((*aifp = FIND_OBJECT_INT(&atmif_list,
- &value->var, sub)) == NULL)
- abort();
- return (SNMP_ERR_NOERROR);
- }
-
- if ((*aifp)->pub.mib->pcr == 0) {
- mib_fetch_ifmib((*aifp)->pub.ifp);
- atmif_sys_fill_mib(*aifp);
- atmif_check_carrier(*aifp);
- }
-
- return (SNMP_ERR_NOERROR);
-}
-
-/*
- * Table of all ATM interfaces
- */
-int
-op_atmif(struct snmp_context *ctx __unused, struct snmp_value *value,
- u_int sub, u_int vindex __unused, enum snmp_op op)
-{
- struct atmif_priv *aif;
- int err;
-
- if ((err = atmif_get_aif(value, sub, op, &aif)) != SNMP_ERR_NOERROR)
- return (err);
-
- if (op == SNMP_OP_SET) {
- switch (value->var.subs[sub - 1]) {
-
- default:
- return (SNMP_ERR_NOT_WRITEABLE);
-
- case LEAF_begemotAtmIfMode:
- if ((err = atmif_get_mode(aif)) != SNMP_ERR_NOERROR)
- return (err);
- if (aif->pub.mode == ATMIF_SUNI_MODE_UNKNOWN)
- return (SNMP_ERR_INCONS_VALUE);
- if (value->v.integer != ATMIF_SUNI_MODE_SONET &&
- value->v.integer != ATMIF_SUNI_MODE_SDH)
- return (SNMP_ERR_WRONG_VALUE);
- if ((u_int)value->v.integer == aif->pub.mode)
- return (SNMP_ERR_NOERROR);
- return (atmif_set_mode(aif, value->v.integer));
- }
- abort();
- }
-
- switch (value->var.subs[sub - 1]) {
-
- case LEAF_begemotAtmIfName:
- return (string_get(value, aif->pub.ifp->name, -1));
-
- case LEAF_begemotAtmIfPcr:
- value->v.uint32 = aif->pub.mib->pcr;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmIfMedia:
- value->v.integer = aif->pub.mib->media;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmIfVpiBits:
- value->v.uint32 = aif->pub.mib->vpi_bits;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmIfVciBits:
- value->v.uint32 = aif->pub.mib->vci_bits;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmIfMaxVpcs:
- value->v.uint32 = aif->pub.mib->max_vpcs;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmIfMaxVccs:
- value->v.uint32 = aif->pub.mib->max_vccs;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmIfEsi:
- return (string_get(value, aif->pub.mib->esi, 6));
-
- case LEAF_begemotAtmIfCarrierStatus:
- value->v.integer = aif->pub.carrier;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmIfMode:
- if ((err = atmif_get_mode(aif)) != SNMP_ERR_NOERROR)
- return (err);
- value->v.integer = aif->pub.mode;
- return (SNMP_ERR_NOERROR);
- }
- abort();
-}
-
-/*
- * Hardware table
- */
-int
-op_atmhw(struct snmp_context *ctx __unused, struct snmp_value *value,
- u_int sub, u_int vindex __unused, enum snmp_op op)
-{
- struct atmif_priv *aif;
- int err;
-
- if ((err = atmif_get_aif(value, sub, op, &aif)) != SNMP_ERR_NOERROR)
- return (err);
- if (op == SNMP_OP_SET)
- return (SNMP_ERR_NOT_WRITEABLE);
-
- switch (value->var.subs[sub - 1]) {
-
- case LEAF_begemotAtmHWVendor:
- return (atm_sys_get_hw_vendor(aif, value));
-
- case LEAF_begemotAtmHWDevice:
- return (atm_sys_get_hw_device(aif, value));
-
- case LEAF_begemotAtmHWSerial:
- value->v.uint32 = aif->pub.mib->serial;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmHWVersion:
- value->v.uint32 = aif->pub.mib->hw_version;
- return (SNMP_ERR_NOERROR);
-
- case LEAF_begemotAtmHWSoftVersion:
- value->v.uint32 = aif->pub.mib->sw_version;
- return (SNMP_ERR_NOERROR);
-
- }
- abort();
-}
-
-/*
- * Scalars
- */
-int
-op_atm(struct snmp_context *ctx __unused, struct snmp_value *value,
- u_int sub, u_int vindex __unused, enum snmp_op op)
-{
- switch (op) {
-
- case SNMP_OP_GETNEXT:
- abort();
-
- case SNMP_OP_GET:
- switch (value->var.subs[sub - 1]) {
-
- case LEAF_begemotAtmIfTableLastChange:
- value->v.uint32 =
- (last_change == 0 ? 0 : last_change - start_tick);
- return (SNMP_ERR_NOERROR);
- }
- abort();
-
- case SNMP_OP_SET:
- return (SNMP_ERR_NOT_WRITEABLE);
-
- case SNMP_OP_ROLLBACK:
- case SNMP_OP_COMMIT:
- abort();
- }
- abort();
-}
-
-/*
- * Register for interface notifications
- */
-void *
-atm_notify_aif(struct atmif *pub, const struct lmodule *mod,
- atmif_event_f func, void *arg)
-{
- struct atmif_priv *aif = (struct atmif_priv *)pub;
- struct atmif_reg *r0;
-
- if ((r0 = malloc(sizeof(*r0))) == NULL) {
- syslog(LOG_CRIT, "out of memory");
- return (NULL);
- }
- r0->func = func;
- r0->mod = mod;
- r0->data = arg;
- r0->aif = aif;
-
- TAILQ_INSERT_TAIL(&aif->notify, r0, link);
-
- return (r0);
-}
-
-/*
- * Unregister it
- */
-void
-atm_unnotify_aif(void *arg)
-{
- struct atmif_reg *r0 = arg;
-
- TAILQ_REMOVE(&r0->aif->notify, r0, link);
- free(r0);
-}
diff --git a/contrib/ngatm/snmp_atm/snmp_atm.h b/contrib/ngatm/snmp_atm/snmp_atm.h
deleted file mode 100644
index 50784ccc45bb..000000000000
--- a/contrib/ngatm/snmp_atm/snmp_atm.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2001-2002
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- * Copyright (c) 2003-2004
- * Hartmut Brandt
- * All rights reserved.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/snmp_atm/snmp_atm.h,v 1.2 2004/08/06 17:30:40 brandt Exp $
- */
-#ifndef _BSNMP_SNMP_ATM_H
-#define _BSNMP_SNMP_ATM_H
-
-enum atmif_notify {
- ATMIF_NOTIFY_DESTROY, /* interface has been destroyed */
- ATMIF_NOTIFY_CARRIER, /* carriere change */
- ATMIF_NOTIFY_VCC /* VCC change */
-};
-
-enum atmif_carrier_state {
- ATMIF_CARRIER_ON = 1,
- ATMIF_CARRIER_OFF = 2,
- ATMIF_CARRIER_UNKNOWN = 3,
- ATMIF_CARRIER_NONE = 4
-};
-
-enum atmif_suni_mode {
- ATMIF_SUNI_MODE_SONET = 1,
- ATMIF_SUNI_MODE_SDH = 2,
- ATMIF_SUNI_MODE_UNKNOWN = 3
-};
-
-/* forward declaration */
-struct atmif;
-typedef void (*atmif_event_f)(struct atmif *, enum atmif_notify, uintptr_t,
- void *);
-
-struct atmif_mib {
- u_int version; /* currently 0 */
-
- u_int device; /* type of hardware (system specific) */
- u_int serial; /* card serial number (device specific) */
- u_int hw_version; /* card version (device specific) */
- u_int sw_version; /* firmware version (device specific) */
- u_int media; /* physical media (see MIB) */
-
- u_char esi[6]; /* end system identifier (MAC) */
- u_int pcr; /* supported peak cell rate */
- u_int vpi_bits; /* number of used bits in VPI field */
- u_int vci_bits; /* number of used bits in VCI field */
- u_int max_vpcs; /* maximum number of VPCs */
- u_int max_vccs; /* maximum number of VCCs */
-};
-
-struct atmif {
- struct mibif *ifp; /* common interface data */
- struct atmif_mib *mib; /* ATM MIB */
- enum atmif_carrier_state carrier;
- enum atmif_suni_mode mode; /* SUNI mode SDH or SONET */
-};
-
-/* find an ATM interface by name */
-struct atmif *atm_find_if_name(const char *);
-
-/* get the interface from the interface index */
-struct atmif *atm_find_if(u_int);
-
-/* register for notifications */
-void *atm_notify_aif(struct atmif *, const struct lmodule *mod,
- atmif_event_f, void *);
-void atm_unnotify_aif(void *);
-
-/* return the If for a system-specific node number */
-struct atmif *atm_node2if(u_int);
-
-/* return the node id for the if */
-u_int atm_if2node(struct atmif *);
-
-#endif
diff --git a/contrib/ngatm/sscop/common.c b/contrib/ngatm/sscop/common.c
deleted file mode 100644
index e34181c36150..000000000000
--- a/contrib/ngatm/sscop/common.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/sscop/common.c,v 1.5 2005/05/23 11:46:16 brandt_h Exp $
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <time.h>
-#include <signal.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <err.h>
-
-#include <netnatm/unimsg.h>
-#include <netnatm/saal/sscop.h>
-#include "common.h"
-
-struct timer {
- evTimerID id;
- struct sscop *sscop;
- void (*func)(void *);
-};
-
-int useframe;
-int sscopframe;
-u_int sscop_vflag;
-int sscop_fd;
-int user_fd;
-int loose;
-int user_out_fd;
-u_int verbose;
-#ifndef USE_LIBBEGEMOT
-evContext evctx;
-#endif
-evFileID sscop_h;
-evFileID user_h;
-
-/*
- * This function get's called from sscop to put out verbose messages
- */
-void
-sscop_verbose(struct sscop *sscop __unused, void *u __unused,
- const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
- va_end(ap);
-}
-void
-verb(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
- va_end(ap);
-}
-
-/*
- * Dump a buffer in hex to stderr.
- */
-void
-dump_buf(const char *w, const u_char *buf, size_t len)
-{
- u_int i;
-
- fprintf(stderr, "%s %zu: ", w, len);
- for(i = 0; i < len; i++) {
- if (i % 4 == 0 && i != 0)
- fprintf(stderr, " ");
- fprintf(stderr, "%02x", *buf++);
- }
- fprintf(stderr, "\n");
-}
-
-/*
- * SSCOP file descriptor is ready. Allocate and read one message
- * and dispatch a signal.
- */
-struct uni_msg *
-proto_msgin(int fd __unused)
-{
- struct uni_msg *m = NULL;
- ssize_t size;
- u_int32_t flen;
- u_int got;
-
- if (sscopframe) {
- if ((size = read(sscop_fd, &flen, 4)) == -1)
- err(1, "error reading frame hdr");
- if (size == 0) {
- got = 0;
- goto eof;
- }
- if (size != 4)
- errx(1, "short frame header: %zd", size);
- if ((m = uni_msg_alloc(flen)) == NULL)
- err(1, NULL);
- for (got = 0; got < flen; got += (size_t)size) {
- size = read(sscop_fd, m->b_rptr + got, flen - got);
- if (size == -1)
- err(1, "error reading frame");
- if (size == 0) {
- got = 0;
- break;
- }
- }
-
- } else {
- if ((m = uni_msg_alloc(MAXMSG)) == NULL)
- err(1, NULL);
- if ((size = read(sscop_fd, m->b_rptr, MAXMSG)) == -1)
- err(1, "error reading message");
- got = size;
- }
-
- if (got == 0) {
- eof:
-#ifdef USE_LIBBEGEMOT
- poll_unregister(sscop_h);
-#else
- evDeselectFD(evctx, sscop_h);
-#endif
- (void)close(sscop_fd);
- sscop_fd = -1;
- if (m != NULL)
- uni_msg_destroy(m);
- VERBOSE(("EOF on sscop file descriptor"));
- return (NULL);
- }
- m->b_wptr = m->b_rptr + got;
-
- if(verbose & 0x0002)
- dump_buf("SSCOP INPUT", m->b_rptr, got);
-
- return (m);
-}
-
-/*
- * User file descriptor ready - read a message
- */
-struct uni_msg *
-user_msgin(int fd __unused)
-{
- struct uni_msg *m = NULL;
- ssize_t size;
- u_int32_t flen;
- u_int got;
-
- if (useframe) {
- if ((size = read(user_fd, &flen, 4)) == -1)
- err(1, "error reading frame hdr");
- if (size == 0) {
- got = 0;
- goto eof;
- }
- if (size != 4)
- errx(1, "short frame header: %zd", size);
- if ((m = uni_msg_alloc(flen)) == NULL)
- err(1, NULL);
- for (got = 0; got < flen; got++) {
- size = read(user_fd, m->b_rptr + got, flen - got);
- if (size == -1)
- err(1, "error reading frame");
- if (size == 0) {
- got = 0;
- break;
- }
- got += (size_t)size;
- }
-
- } else {
- if ((m = uni_msg_alloc(MAXMSG)) == NULL)
- err(1, NULL);
- if ((size = read(user_fd, m->b_rptr, MAXMSG)) == -1)
- err(1, "error reading message");
- got = size;
- }
-
- if (size == 0) {
- eof:
-#ifdef USE_LIBBEGEMOT
- poll_unregister(user_h);
-#else
- evDeselectFD(evctx, user_h);
-#endif
- if (m != NULL)
- uni_msg_destroy(m);
- VERBOSE(("EOF on user connection"));
- return (NULL);
- }
- m->b_wptr = m->b_rptr + size;
-
- return (m);
-}
-
-/*
- * Write message to the SSCOP file descriptor.
- * Here we have a problem: we should have a means to check how much space
- * we have. If the pipe is full, we could declare the lower layer busy and
- * drop the message. However, how do we know, when a message will fit?
- * Selecting for WRITE doesn't help, because it will return even if a single
- * byte can be written. For this reason, we switch the file descriptor to
- * blocking mode, and hope everything is fast enough to not timeout us.
- * Alternatively we could just drop the message. Using kevent would help here.
- */
-void
-proto_msgout(struct uni_msg *m)
-{
- struct iovec iov[2];
- u_int32_t flen;
- ssize_t size;
- static int sent;
- int fl;
-
- if (verbose & 0x0002)
- dump_buf("send", m->b_rptr, uni_msg_len(m));
- if (loose > 0 && (sent++ % loose) == loose - 1) {
- VERBOSE(("loosing message"));
- uni_msg_destroy(m);
- return;
- }
-
- flen = uni_msg_len(m);
-
- iov[0].iov_len = sscopframe ? 4 : 0;
- iov[0].iov_base = (caddr_t)&flen;
- iov[1].iov_len = uni_msg_len(m);
- iov[1].iov_base = m->b_rptr;
-
- if ((fl = fcntl(sscop_fd, F_GETFL, 0)) == -1)
- err(1, "cannot get flags for sscop fd");
- fl &= ~O_NONBLOCK;
- if (fcntl(sscop_fd, F_SETFL, fl) == -1)
- err(1, "cannot set flags for sscop fd");
-
- if ((size = writev(sscop_fd, iov, 2)) == -1)
- err(1, "write sscop");
- if ((size_t)size != iov[0].iov_len + iov[1].iov_len)
- err(1, "short sscop write %zu %zu %zd",
- iov[0].iov_len, iov[1].iov_len, size);
-
- fl |= O_NONBLOCK;
- if (fcntl(sscop_fd, F_SETFL, fl) == -1)
- err(1, "cannot restore flags for sscop fd");
-
- uni_msg_destroy(m);
-}
-
-/*
- * output a message to the user
- */
-void
-user_msgout(struct uni_msg *m)
-{
- struct iovec iov[2];
- u_int32_t flen;
- ssize_t size;
-
- flen = uni_msg_len(m);
-
- iov[0].iov_len = useframe ? 4 : 0;
- iov[0].iov_base = (caddr_t)&flen;
- iov[1].iov_len = uni_msg_len(m);
- iov[1].iov_base = m->b_rptr;
-
- if ((size = writev(user_out_fd, iov, 2)) == -1)
- err(1, "write sscop");
- if ((size_t)size != iov[0].iov_len + iov[1].iov_len)
- errx(1, "short sscop write");
-
- uni_msg_destroy(m);
-}
-
-void
-parse_param(struct sscop_param *param, u_int *pmask, int opt, char *arg)
-{
- u_int val;
- char *end, *p;
-
- if(opt == 'b') {
- param->flags |= SSCOP_ROBUST;
- *pmask |= SSCOP_SET_ROBUST;
- return;
- }
- if(opt == 'x') {
- param->flags |= SSCOP_POLLREX;
- *pmask |= SSCOP_SET_POLLREX;
- return;
- }
- if(opt == 'W') {
- val = (u_int)strtoul(optarg, &end, 0);
-
- if(*end != '\0')
- errx(1, "bad number to -W '%s'", optarg);
- if(val >= (1 << 24) - 1)
- errx(1, "window too large: 0x%x", val);
- param->mr = val;
- *pmask |= SSCOP_SET_MR;
- return;
- }
-
- if((p = strchr(arg, '=')) == NULL)
- errx(1, "need '=' in argument to -%c", opt);
- *p++ = 0;
- if(*p == 0)
- errx(1, "argument to -%c %s empty", opt, arg);
- val = strtoul(p, &end, 0);
- if(*end != 0)
- errx(1, "bad number in -%c %s=%s", opt, arg, p);
-
- if(opt == 't') {
- if(strcmp(arg, "cc") == 0) {
- param->timer_cc = val;
- *pmask |= SSCOP_SET_TCC;
- } else if(strcmp(arg, "poll") == 0) {
- param->timer_poll = val;
- *pmask |= SSCOP_SET_TPOLL;
- } else if(strcmp(arg, "ka") == 0) {
- param->timer_keep_alive = val;
- *pmask |= SSCOP_SET_TKA;
- } else if(strcmp(arg, "nr") == 0) {
- param->timer_no_response = val;
- *pmask |= SSCOP_SET_TNR;
- } else if(strcmp(arg, "idle") == 0) {
- param->timer_idle = val;
- *pmask |= SSCOP_SET_TIDLE;
- } else
- errx(1, "bad timer name '%s'", arg);
- return;
- }
-
- if(opt == 'a') {
- if(strcmp(arg, "j") == 0) {
- param->maxj = val;
- *pmask |= SSCOP_SET_MAXJ;
- } else if(strcmp(arg, "k") == 0) {
- param->maxk = val;
- *pmask |= SSCOP_SET_MAXK;
- } else if(strcmp(arg, "cc") == 0) {
- param->maxcc = val;
- *pmask |= SSCOP_SET_MAXCC;
- } else if(strcmp(arg, "pd") == 0) {
- param->maxpd = val;
- *pmask |= SSCOP_SET_MAXPD;
- } else if(strcmp(arg, "stat") == 0) {
- param->maxstat = val;
- *pmask |= SSCOP_SET_MAXSTAT;
- } else
- errx(1, "bad parameter '%s'", arg);
- return;
- }
-
- verb("bad flag");
- abort();
-}
-
-#ifdef USE_LIBBEGEMOT
-static void
-tfunc(int tid __unused, void *uap)
-#else
-static void
-tfunc(evContext ctx __unused, void *uap, struct timespec due __unused,
- struct timespec inter __unused)
-#endif
-{
- struct timer *t = uap;
-
- t->func(t->sscop);
- free(t);
-}
-
-/*
- * Start a timer
- */
-void *
-sscop_start_timer(struct sscop *sscop, void *arg __unused, u_int msec,
- void (*func)(void *))
-{
- struct timer *t;
-#ifndef USE_LIBBEGEMOT
- struct timespec due;
-#endif
-
- if ((t = malloc(sizeof(*t))) == NULL)
- err(1, NULL);
- t->sscop = sscop;
- t->func = func;
-
-#ifdef USE_LIBBEGEMOT
- if ((t->id = poll_start_timer(msec, 0, tfunc, t)) == -1)
- err(1, "cannot start timer");
-#else
- due = evAddTime(evNowTime(),
- evConsTime((time_t)msec/1000, (long)(msec%1000)*1000));
-
- if (evSetTimer(evctx, tfunc, t, due, evConsTime(0, 0), &t->id))
- err(1, "cannot start timer");
-#endif
-
- return (t);
-}
-
-/*
- * Stop a timer
- */
-void
-sscop_stop_timer(struct sscop *sscop __unused, void *arg __unused, void *tp)
-{
- struct timer *t = tp;
-
-#ifdef USE_LIBBEGEMOT
- poll_stop_timer(t->id);
-#else
- evClearTimer(evctx, t->id);
-#endif
- free(t);
-}
diff --git a/contrib/ngatm/sscop/common.h b/contrib/ngatm/sscop/common.h
deleted file mode 100644
index 9ad6d4e95b6e..000000000000
--- a/contrib/ngatm/sscop/common.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/sscop/common.h,v 1.5 2005/05/23 11:46:16 brandt_h Exp $
- *
- * Common declaration for the SAAL programs.
- */
-#ifndef _SAAL_COMMON_H_
-#define _SAAL_COMMON_H_
-
-#ifdef USE_LIBBEGEMOT
-#include <rpoll.h>
-#define evFileID int
-#define evTimerID int
-#else
-#include <isc/eventlib.h>
-#endif
-
-/*
- * Writes to a pipe must be in messages (if we don't use framing).
- * It is not clear, what is the maximum message size for this. It seems
- * to be PIPE_BUF, but be conservative.
- */
-#define MAXUSRMSG 4096
-#define MAXMSG (MAXUSRMSG+4)
-
-extern int useframe; /* use frame functions */
-extern int sscopframe; /* use sscop framing */
-extern u_int sscop_vflag; /* be talkative */
-extern int sscop_fd; /* file descriptor for SSCOP protocol */
-extern int user_fd; /* file descriptor for USER */
-extern int loose; /* loose messages */
-extern int user_out_fd; /* file descriptor for output to user */
-extern u_int verbose; /* talk to me */
-#ifndef USE_LIBBEGEMOT
-extern evContext evctx;
-#endif
-extern evFileID sscop_h;
-extern evFileID user_h;
-
-void dump_buf(const char *, const u_char *, size_t);
-struct uni_msg *proto_msgin(int);
-struct uni_msg *user_msgin(int);
-void proto_msgout(struct uni_msg *);
-void user_msgout(struct uni_msg *);
-void parse_param(struct sscop_param *, u_int *, int, char *);
-
-void verb(const char *, ...) __printflike(1, 2);
-
-void sscop_verbose(struct sscop *, void *, const char *, ...)
- __printflike(3, 4);
-void *sscop_start_timer(struct sscop *, void *, u_int, void (*)(void *));
-void sscop_stop_timer(struct sscop *, void *, void *);
-
-#define VERBOSE(P) do { if (verbose & 0x0001) verb P; } while(0)
-
-#endif /* _SAAL_COMMON_H_ */
diff --git a/contrib/ngatm/sscop/sscop.1 b/contrib/ngatm/sscop/sscop.1
deleted file mode 100644
index 6cbc6d268739..000000000000
--- a/contrib/ngatm/sscop/sscop.1
+++ /dev/null
@@ -1,169 +0,0 @@
-.\"
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Author: Harti Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Begemot: libunimsg/sscop/sscop.1,v 1.3 2004/07/08 08:22:28 brandt Exp $
-.\"
-.Dd October 28, 2003
-.Dt SSCOP 1
-.Os
-.Sh NAME
-.Nm sscop
-.Nd "SSCOP transport protocol"
-.Sh SYNOPSIS
-.Nm
-.Op Fl Fbefhirwx3
-.Op Fl V Ar X
-.Op Fl W Ar N
-.Op Fl a Ar p Ns Li = Ns Ar v
-.Op Fl l Ar N
-.Op Fl t Ar t Ns Li = Ns Ar m
-.Op Fl v Ar X
-.Sh DESCRIPTION
-The
-.Nm
-tool implements the Q.2110 transport protocol.
-Normally the program reads from standard input and sends this input over
-the SSCOP protocol on the standard output file descriptor. This means, that
-the standard output file descriptor should be connected in read-write mode.
-The program takes the
-following arguments:
-.Bl -tag -width ".It Fl a Ar p Ns Li = Ns Ar v"
-.It Fl F
-Use frameing on the SSCOP connection (see the
-.Fl f
-option).
-.It Fl V Ar X
-Set the verbose flag to the hex value
-.Ar X .
-.It Fl W Ar N
-Set the initial SSCOP window to
-.Ar N .
-.It Fl a Ar p Ns Li = Ns Ar v
-Set SSCOP parameter
-.Ar p
-to the value
-.Ar v .
-The following parameters may be set:
-.Bl -tag -width ".It Li stat Ns = Ns Ar N"
-.It Li j Ns = Ns Ar N
-Set the maximum SSCOP-UU data size to
-.Ar N
-octets.
-.It Li k Ns = Ns Ar N
-Set the maximum SSCOP SDU data size to
-.Ar N
-octets.
-.It Li cc Ns = Ns Ar N
-Set the parameter
-.Li MaxCC
-(maximum number of connection control message re-transmissions) to
-the value
-.Ar N .
-.It Li pd Ns = Ns Ar N
-Set the parameter
-.Li MaxPD
-(maximum acceptable number of outstanding unacknowledged SD PDUs before
-sending a POLL) to the value
-.Ar N .
-.It Li stat Ns = Ns Ar N
-Set the parameter
-.Li MaxSTAT
-(maximum number of elements placed in a STAT PDU) to the value
-.Ar N .
-.El
-.It Fl b
-Enable the ATM-Forum SSCOP robustness enhancement.
-.It Fl e
-Exit when there is an end of file condition on the input file or the
-SSCOP indicates a release confirmation.
-.It Fl f
-Use the framing protocol for communication over the SSCOP link. See
-.Xr frame l
-(libbegemot) for framing.
-.It Fl h
-Print a short help information and exit.
-.It Fl i
-Try not to read from the user input file descriptor. Assume that we a receiving
-only.
-.It Fl l Ar N
-Loose every Nth message. This is used for testing.
-.It Fl r
-Revert user and SSCOP file descriptors. That means, that user input and output
-is done on standard output and SSCOP input and output on standard input.
-.It Fl t Ar t Ns Li = Ns Ar m
-Set SSCOP timer
-.Ar t
-to
-.Ar m
-milliseconds. The following timers may be set:
-.Bl -tag -width ".It Li stat Ns = Ns Ar N"
-.It Li cc Ns = Ns Ar m
-Set the connection control timer to
-.Ar m .
-This timer controls the retransmission of connection control messages.
-.It Li poll Ns = Ns Ar m
-Set the poll timer to
-.Ar m .
-This timer controls the transmission of POLL messages.
-.It Li ka Ns = Ns Ar m
-Set the keep-alive timer to
-.Ar m .
-This timer controls the maximum length of the transient phase.
-.It Li nr Ns = Ns Ar m
-Set the no-response timer to
-.Ar m .
-This timer controls the maximum time between two received STAT PDUs before
-the connection is aborted.
-.It Li idle Ns = Ns Ar m
-Set the idle timer to
-.Ar m .
-This timer controls the length of the idle phase.
-.El
-.It Fl v Ar X
-Set the SSCOP library verbose flag to the hex value.
-.It Fl w
-Don't start the SSCOP protocol. Wait for a establish indication from the remote
-side.
-.It Fl x
-Enable to POLL after retransmission flag.
-.It Fl 3
-Send user output to file descriptor 3.
-.El
-.Sh EXAMPLES
-The following command line sends the file
-.Pa Makefile
-over a pipe (this depends on the feature that pipes are bi-directional):
-.Bd -literal
-cat Makefile | sscop -reF | sscop -weF
-.Ed
-.Sh SEE ALSO
-.Xr libunimsg 3
-.Sh STANDARDS
-The implemented protocol conforms to ITU-T recommendation Q.2110.
-.Sh AUTHORS
-.An Hartmut Brandt Aq harti@FreeBSD.org
diff --git a/contrib/ngatm/sscop/sscop_main.c b/contrib/ngatm/sscop/sscop_main.c
deleted file mode 100644
index a35d7a6c2da5..000000000000
--- a/contrib/ngatm/sscop/sscop_main.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/sscop/sscop_main.c,v 1.5 2005/05/23 11:46:17 brandt_h Exp $
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <time.h>
-#include <signal.h>
-#include <assert.h>
-#include <err.h>
-
-#include <netnatm/unimsg.h>
-#include <netnatm/saal/sscop.h>
-#include "common.h"
-
-static int sigusr1; /* got SIGUSR1 */
-static int unidir; /* write only user */
-static int end_at_eof = 1; /* send RELEASE_request at user EOF */
-
-static volatile int ready; /* flag if connection is established */
-static volatile int finished; /* got release confirm or indication */
-
-static const char usgtxt[] = "\
-SSCOP transport protocol\n\
-Usage: sscop [-h] [-Fbefirwx3] [-ap=v] [-lN] [-tt=m] [-v X] [-V X] [-W N]\n\
-Options:\n\
- -F use framing for sscop also\n\
- -V X set verbose flags to hex X\n\
- -W N set initial window to N\n\
- -a p=v set parameter 'p' to 'v'\n\
- -b enable robustness enhancement\n\
- -e don't RELEASE_request on user EOF\n\
- -f use begemot frame functions for user fd\n\
- -h print this info\n\
- -i use user fd only for output\n\
- -lN loose every nth message\n\
- -r reverse user and sscop file descriptors\n\
- -t t=m set timer 't' to 'm' milliseconds\n\
- -v X set sscop verbose flags to hex X\n\
- -w don't start conversation\n\
- -x enable POLL after retransmission\n\
- -3 redirect output to fd 3\n\
-Timers are cc, poll, ka, nr or idle; parameters are j, k, cc, pd or stat.\n";
-
-static void sscop_send_manage(struct sscop *, void *,
- enum sscop_maasig, struct uni_msg *, u_int, u_int);
-static void sscop_send_upper(struct sscop *, void *, enum sscop_aasig,
- struct SSCOP_MBUF_T *, u_int);
-static void sscop_send_lower(struct sscop *, void *, struct SSCOP_MBUF_T *);
-
-static const struct sscop_funcs sscop_funcs = {
- sscop_send_manage,
- sscop_send_upper,
- sscop_send_lower,
- sscop_verbose,
- sscop_start_timer,
- sscop_stop_timer
-};
-
-/*
- * SSCOP file descriptor is ready. Allocate and read one message
- * and dispatch a signal.
- */
-#ifdef USE_LIBBEGEMOT
-static void
-proto_infunc(int fd, int mask __unused, void *uap)
-#else
-static void
-proto_infunc(evContext ctx __unused, void *uap, int fd, int mask __unused)
-#endif
-{
- struct uni_msg *m;
-
- if ((m = proto_msgin(fd)) != NULL)
- sscop_input((struct sscop *)uap, m);
-}
-
-/*
- * User input. Allocate and read message and dispatch signal.
- */
-#ifdef USE_LIBBEGEMOT
-static void
-user_infunc(int fd, int mask __unused, void *uap)
-#else
-static void
-user_infunc(evContext ctx __unused, void *uap, int fd, int mask __unused)
-#endif
-{
- struct uni_msg *m;
-
- if ((m = user_msgin(fd)) != NULL)
- sscop_aasig((struct sscop *)uap, SSCOP_DATA_request, m, 0);
-
- else if (end_at_eof)
- sscop_aasig((struct sscop *)uap, SSCOP_RELEASE_request, 0, 0);
-}
-
-static void
-onusr1(int s __unused)
-{
- sigusr1++;
-}
-
-int
-main(int argc, char *argv[])
-{
- int opt;
- struct sscop *sscop;
- struct sscop_param param;
- struct sigaction sa;
- int wait = 0;
- u_int mask;
-#ifndef USE_LIBBEGEMOT
- evEvent ev;
-#endif
-
- /*
- * Default is to have the USER on stdin and SSCOP on stdout
- */
- sscop_fd = 0;
- user_fd = 1;
- user_out_fd = -1;
-
- memset(&param, 0, sizeof(param));
- param.maxk = MAXUSRMSG;
- param.maxj = 0;
- param.maxcc = 4;
- mask = SSCOP_SET_MAXK | SSCOP_SET_MAXJ | SSCOP_SET_MAXCC;
-
- while((opt = getopt(argc, argv, "3a:befFhil:rt:v:V:wW:x")) != -1)
- switch(opt) {
-
- case '3':
- user_out_fd = 3;
- break;
-
- case 'e':
- end_at_eof = 0;
- break;
-
- case 'f':
- useframe = 1;
- break;
-
- case 'F':
- sscopframe = 1;
- break;
-
- case 'h':
- fprintf(stderr, usgtxt);
- exit(0);
-
- case 'i':
- unidir++;
- break;
-
- case 'l':
- loose = strtoul(optarg, NULL, 0);
- break;
-
- case 'r':
- sscop_fd = 1;
- user_fd = 0;
- break;
-
- case 'v':
- sscop_vflag = strtoul(optarg, NULL, 16);
- break;
-
- case 'V':
- verbose = strtoul(optarg, NULL, 16);
- break;
-
- case 'w':
- wait = 1;
- break;
-
- case 'a':
- case 't':
- case 'b':
- case 'x':
- case 'W':
- parse_param(&param, &mask, opt, optarg);
- break;
- }
-
- if(user_out_fd < 0)
- user_out_fd = user_fd;
-
-#ifndef USE_LIBBEGEMOT
- if (evCreate(&evctx))
- err(1, "evCreate");
-#endif
-
- /*
- * Catch USR1
- */
- sa.sa_handler = onusr1;
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = SA_RESTART;
- if(sigaction(SIGUSR1, &sa, NULL))
- err(1, "sigaction(SIGUSR1)");
-
- /*
- * Allocate and initialize SSCOP
- */
- if ((sscop = sscop_create(NULL, &sscop_funcs)) == NULL)
- err(1, NULL);
- sscop_setdebug(sscop, sscop_vflag);
- if ((errno = sscop_setparam(sscop, &param, &mask)) != 0)
- err(1, "can't set sscop parameters %#x", mask);
-
- /*
- * Register sscop fd
- */
-#ifdef USE_LIBBEGEMOT
- if ((sscop_h = poll_register(sscop_fd, proto_infunc,
- sscop, POLL_IN)) == -1)
- err(1, "can't select on sscop fd");
-#else
- if (evSelectFD(evctx, sscop_fd, EV_READ, proto_infunc, sscop, &sscop_h))
- err(1, "can't select on sscop fd");
-#endif
-
- /*
- * if we are active - send establish request
- */
- if(!wait)
- sscop_aasig(sscop, SSCOP_ESTABLISH_request, NULL, 1);
-
- /*
- * Run protocol until it get's ready
- */
- while (sscop_fd >= 0 && !ready) {
-#ifdef USE_LIBBEGEMOT
- poll_dispatch(1);
-#else
- if (evGetNext(evctx, &ev, EV_WAIT) == 0) {
- if (evDispatch(evctx, ev))
- err(1, "dispatch event");
- } else if (errno != EINTR)
- err(1, "get event");
-#endif
- }
-
- /*
- * If this led to a closed file - exit.
- */
- if (sscop_fd < 0) {
- VERBOSE(("SSCOP file descriptor closed - exiting"));
- sscop_destroy(sscop);
- return 0;
- }
-
- VERBOSE(("READY - starting data transfer"));
-
- if (!unidir &&
-#ifdef USE_LIBBEGEMOT
- ((user_h = poll_register(user_fd, user_infunc, sscop, POLL_IN)) == -1))
-#else
- evSelectFD(evctx, user_fd, EV_READ, user_infunc, sscop, &user_h))
-#endif
- err(1, "can't select on sscop fd");
-
- while (!sigusr1 && sscop_fd >= 0) {
-#ifdef USE_LIBBEGEMOT
- poll_dispatch(1);
-#else
- if (evGetNext(evctx, &ev, EV_WAIT) == 0) {
- if (evDispatch(evctx, ev))
- err(1, "dispatch event");
- } else if (errno != EINTR)
- err(1, "get event");
-#endif
- }
-
- if (sigusr1 && sscop_fd >= 0) {
- /*
- * Release if we still have the connection
- */
- sscop_aasig(sscop, SSCOP_RELEASE_request, NULL, 0);
- while (!finished && sscop_fd >= 0) {
-#ifdef USE_LIBBEGEMOT
- poll_dispatch(1);
-#else
- if (evGetNext(evctx, &ev, EV_WAIT) == 0) {
- if (evDispatch(evctx, ev))
- err(1, "dispatch event");
- } else if (errno != EINTR)
- err(1, "get event");
-#endif
- }
- }
-
- VERBOSE(("SSCOP file descriptor closed - exiting"));
- sscop_destroy(sscop);
-
- return (0);
-}
-
-
-
-/*
- * AAL OUTPUT
- */
-static void
-sscop_send_lower(struct sscop *sscop __unused, void *arg __unused,
- struct SSCOP_MBUF_T *m)
-{
- proto_msgout(m);
-}
-
-
-/*
- * Write the message to the user and move the window
- */
-static void
-uoutput(struct sscop *sscop, struct uni_msg *m)
-{
- user_msgout(m);
- sscop_window(sscop, +1);
-}
-
-/*
- * SSCOP AA-SIGNALS
- */
-static void
-sscop_send_upper(struct sscop *sscop, void *arg __unused, enum sscop_aasig sig,
- struct SSCOP_MBUF_T *m, u_int p __unused)
-{
- VERBOSE(("--> got aa %d(%s)", sig, sscop_signame(sig)));
-
- switch (sig) {
-
- case SSCOP_RELEASE_indication:
- if (end_at_eof) {
- VERBOSE((" ... exiting"));
-#ifdef USE_LIBBEGEMOT
- poll_unregister(sscop_h);
-#else
- evDeselectFD(evctx, sscop_h);
-#endif
- (void)close(sscop_fd);
- sscop_fd = -1;
- }
- finished++;
- if (m)
- uni_msg_destroy(m);
- break;
-
- case SSCOP_RELEASE_confirm:
- if (end_at_eof) {
- VERBOSE((" ... exiting"));
-#ifdef USE_LIBBEGEMOT
- poll_unregister(sscop_h);
-#else
- evDeselectFD(evctx, sscop_h);
-#endif
- (void)close(sscop_fd);
- sscop_fd = -1;
- }
- finished++;
- break;
-
- case SSCOP_ESTABLISH_indication:
- sscop_aasig(sscop, SSCOP_ESTABLISH_response, NULL, 1);
- ready++;
- if (m)
- uni_msg_destroy(m);
- break;
-
- case SSCOP_ESTABLISH_confirm:
- ready++;
- if (m)
- uni_msg_destroy(m);
- break;
-
- case SSCOP_DATA_indication:
- assert(m != NULL);
- uoutput(sscop, m);
- break;
-
- case SSCOP_UDATA_indication:
- assert(m != NULL);
- VERBOSE(("UDATA.indication ignored"));
- uni_msg_destroy(m);
- break;
-
- case SSCOP_RECOVER_indication:
- sscop_aasig(sscop, SSCOP_RECOVER_response, NULL, 0);
- break;
-
- case SSCOP_RESYNC_indication:
- sscop_aasig(sscop, SSCOP_RESYNC_response, NULL, 0);
- if (m)
- uni_msg_destroy(m);
- break;
-
- case SSCOP_RESYNC_confirm:
- break;
-
- case SSCOP_RETRIEVE_indication:
- case SSCOP_RETRIEVE_COMPL_indication:
- warnx("Ooops. A retrieve indication");
- abort();
-
- case SSCOP_ESTABLISH_request:
- case SSCOP_RELEASE_request:
- case SSCOP_ESTABLISH_response:
- case SSCOP_DATA_request:
- case SSCOP_UDATA_request:
- case SSCOP_RECOVER_response:
- case SSCOP_RESYNC_request:
- case SSCOP_RESYNC_response:
- case SSCOP_RETRIEVE_request:
- warnx("bad signal for this direction");
- abort();
- }
-}
-
-/*
- * This get's called for MAAL
- */
-static void
-sscop_send_manage(struct sscop *sscop __unused, void *arg __unused,
- enum sscop_maasig sig, struct uni_msg *m, u_int error, u_int cnt)
-{
- VERBOSE(("--> got maa %d(%s)", sig, sscop_msigname(sig)));
-
- switch (sig) {
-
- case SSCOP_MDATA_indication:
- VERBOSE(("MDATA.indication ignored"));
- uni_msg_destroy(m);
- break;
-
- case SSCOP_MERROR_indication:
- VERBOSE(("MAAL-ERROR.indication '%c' %u", error, cnt));
- break;
-
- case SSCOP_MDATA_request:
- warnx("bad signal for this direction");
- abort();
- }
-}
diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist
index 5887e25261a8..ac9edf6a8bcb 100644
--- a/etc/mtree/BSD.include.dist
+++ b/etc/mtree/BSD.include.dist
@@ -287,16 +287,6 @@
..
netipsec
..
- netnatm
- api
- ..
- msg
- ..
- saal
- ..
- sig
- ..
- ..
netpfil
pf
..
diff --git a/lib/Makefile b/lib/Makefile
index 8d4115d29602..e791c983cc77 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -153,7 +153,6 @@ SUBDIR_DEPEND_flua= libjail
# NB: keep these sorted by MK_* knobs
-SUBDIR.${MK_ATM}+= libngatm
SUBDIR.${MK_BEARSSL}+= libbearssl libsecureboot
SUBDIR.${MK_BLACKLIST}+=libblacklist
SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp
diff --git a/lib/libngatm/Makefile b/lib/libngatm/Makefile
deleted file mode 100644
index 47dc716b800e..000000000000
--- a/lib/libngatm/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# $FreeBSD$
-#
-# Author: Harti Brandt <harti@freebsd.org>
-#
-LIB= ngatm
-SHLIB_MAJOR= 4
-MAN= libngatm.3 uniaddr.3 unifunc.3 unimsg.3 unisap.3 unistruct.3
-
-# source of the library lives in contrib
-SDIR= ${SRCTOP}/sys
-CTRB= ${SRCTOP}/contrib/ngatm
-LIBBASE= ${SDIR}/contrib/ngatm
-
-CFLAGS+= -I${LIBBASE} -I${.OBJDIR} -I${CTRB}/libngatm
-# CFLAGS+= -DSSCOP_DEBUG -DSSCFU_DEBUG -DUNI_DEBUG -DCCATM_DEBUG
-
-.PATH: ${LIBBASE}/netnatm ${LIBBASE}/netnatm/saal ${LIBBASE}/netnatm/misc \
- ${LIBBASE}/netnatm/msg ${LIBBASE}/netnatm/sig ${LIBBASE}/netnatm/api
-.PATH: ${CTRB}/libngatm ${CTRB}/man
-
-SRCS= unimsg.c unimsg_common.c straddr.c \
- traffic.c uni_ie.c uni_msg.c \
- saal_sscop.c saal_sscfu.c \
- sig_call.c sig_coord.c sig_party.c sig_print.c sig_reset.c \
- sig_uni.c sig_unimsgcpy.c sig_verify.c \
- cc_conn.c cc_user.c cc_sig.c cc_data.c cc_port.c unisap.c \
- cc_dump.c
-
-# Includes
-INCSGROUPS= INCSATM INCSSAAL INCSMSG INCSSIG INCSAPI
-
-# common files
-INCSATMDIR= $(INCLUDEDIR)/netnatm
-INCSATM= unimsg.h addr.h
-
-# signaling AAL
-INCSSAALDIR= $(INCLUDEDIR)/netnatm/saal
-INCSSAAL= saal/sscfu.h saal/sscfudef.h saal/sscop.h saal/sscopdef.h
-
-# message parsing
-INCSMSGDIR= $(INCLUDEDIR)/netnatm/msg
-INCSMSG= msg/uni_config.h msg/uni_hdr.h msg/uni_ie.h msg/uni_msg.h \
- msg/unimsglib.h msg/uniprint.h msg/unistruct.h
-
-# signaling layer
-INCSSIGDIR= $(INCLUDEDIR)/netnatm/sig
-INCSSIG= sig/uni.h sig/unidef.h sig/unisig.h
-
-# call control layer
-INCSAPIDIR= $(INCLUDEDIR)/netnatm/api
-INCSAPI= api/atmapi.h api/ccatm.h api/unisap.h
-
-.include <bsd.lib.mk>
diff --git a/lib/libngatm/Makefile.depend b/lib/libngatm/Makefile.depend
deleted file mode 100644
index b9209eb15132..000000000000
--- a/lib/libngatm/Makefile.depend
+++ /dev/null
@@ -1,17 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- include \
- include/arpa \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcompiler_rt \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index da5344bdeb68..1e6354e314fe 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -344,13 +344,11 @@ MAN= aac.4 \
${_nfe.4} \
${_nfsmb.4} \
ng_async.4 \
- ngatmbase.4 \
ng_atmllc.4 \
ng_bpf.4 \
ng_bridge.4 \
ng_btsocket.4 \
ng_car.4 \
- ng_ccatm.4 \
ng_checksum.4 \
ng_cisco.4 \
ng_deflate.4 \
@@ -389,15 +387,12 @@ MAN= aac.4 \
ng_socket.4 \
ng_source.4 \
ng_split.4 \
- ng_sscfu.4 \
- ng_sscop.4 \
ng_tag.4 \
ng_tcpmss.4 \
ng_tee.4 \
ng_tty.4 \
ng_ubt.4 \
ng_UI.4 \
- ng_uni.4 \
ng_vjc.4 \
ng_vlan.4 \
ng_vlan_rotate.4 \
diff --git a/share/man/man4/netgraph.4 b/share/man/man4/netgraph.4
index bbea09264435..3f79a47c2c40 100644
--- a/share/man/man4/netgraph.4
+++ b/share/man/man4/netgraph.4
@@ -1453,13 +1453,10 @@ common networking problems, solved using
.Xr ng_rfc1490 4 ,
.Xr ng_socket 4 ,
.Xr ng_split 4 ,
-.Xr ng_sscfu 4 ,
-.Xr ng_sscop 4 ,
.Xr ng_tee 4 ,
.Xr ng_tty 4 ,
.Xr ng_ubt 4 ,
.Xr ng_UI 4 ,
-.Xr ng_uni 4 ,
.Xr ng_vjc 4 ,
.Xr ng_vlan 4 ,
.Xr ngctl 8 ,
diff --git a/share/man/man4/ng_ccatm.4 b/share/man/man4/ng_ccatm.4
deleted file mode 100644
index 02a5a5f011b5..000000000000
--- a/share/man/man4/ng_ccatm.4
+++ /dev/null
@@ -1,328 +0,0 @@
-.\"
-.\" Copyright (c) 2001-2004
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\" Copyright (c) 2005
-.\" Hartmut Brandt.
-.\" All rights reserved.
-.\"
-.\" Author: Harti Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 3, 2023
-.Dt NG_CCATM 4
-.Os
-.Sh NAME
-.Nm ng_ccatm
-.Nd "ATM Call Control netgraph node type"
-.Sh SYNOPSIS
-.In netnatm/unimsg.h
-.In netnatm/msg/unistruct.h
-.In netnatm/sig/unidef.h
-.In netnatm/api/unisap.h
-.In netnatm/api/atmapi.h
-.In netnatm/api/ccatm.h
-.In netgraph.h
-.In netgraph/ng_uni.h
-.In netgraph/ng_ccatm.h
-.Sh DEPRECATION NOTICE
-.Nm
-is deprecated and may not be available in
-.Fx 14.0
-and later.
-.Sh DESCRIPTION
-The
-.Nm
-node implements the API specified by the ATM Forum for access to ATM services
-(see ATM-Forum document
-.Pa af-saa-0108 ) .
-This document specifies the semantics
-of the API, not the exact language binding.
-For this reason, it is expected that
-this implementation is neither compile-time nor binary compatible with
-other implementations of this API.
-It should, however, be fairly straightforward
-to convert between different API implementations.
-.Pp
-This node is usually stacked on top of one or more UNI nodes (see
-.Xr ng_uni 4 ) .
-Each of these hooks appears as a
-.Dq port
-to the user of the node.
-It also has one hook connected to the ILMI daemon for management purposes.
-.Pp
-The node is removed when it receives a
-.Dv NGM_SHUTDOWN
-messages or when all hooks are disconnected.
-.Sh HOOKS
-The node understands a number of hooks with predefined names and an
-unlimited number of hooks for user connections.
-The predefined names are:
-.Bl -tag -width ".Va orphans"
-.It Va uni Ns Ar NNN
-These hooks stack the
-.Nm
-node on top of a UNI stack.
-The node expects the interface on these hooks
-to conform to the upper interface specified in
-.Xr ng_uni 4 .
-These hooks are forced into queuing mode, so that there are no circular
-calls from call control to UNI and UNI back to call control.
-The
-.Ar NNN
-in the hook name is the decimal port number and should not be zero.
-The port number is a 32-bit unsigned integer.
-.It Va manage
-This hook should be connected to the ILMI daemon.
-No data is ever sent on this hook and all received data is discarded.
-The hook is used to send control messages along.
-.It Va dump
-On receipt of a
-.Dv NGM_CCATM_DUMP
-command a textual description of the current state of the node is sent
-out of this hook.
-This text is sent as one large message consisting of more
-than one
-.Vt mbuf .
-.El
-.Pp
-All other hook names are taken to be user hooks and correspond to an
-ATM endpoint as specified in the ATM Forum document.
-The interface on these hooks is defined in
-.In atmapi.h
-and uses a structure
-.Bd -literal
-struct ccatm_op {
- uint32_t op; /* request code */
- u_char data[]; /* optional data */
-};
-.Ed
-.Pp
-This structure is followed directly by the data for the operation.
-The opcode is one of the following:
-.Bd -literal
-enum atmop {
- ATMOP_RESP,
- ATMOP_ABORT_CONNECTION,
- ATMOP_ACCEPT_INCOMING_CALL,
- ATMOP_ADD_PARTY,
- ATMOP_ADD_PARTY_REJECT,
- ATMOP_ADD_PARTY_SUCCESS,
- ATMOP_ARRIVAL_OF_INCOMING_CALL,
- ATMOP_CALL_RELEASE,
- ATMOP_CONNECT_OUTGOING_CALL,
- ATMOP_DROP_PARTY,
- ATMOP_GET_LOCAL_PORT_INFO,
- ATMOP_P2MP_CALL_ACTIVE,
- ATMOP_P2P_CALL_ACTIVE,
- ATMOP_PREPARE_INCOMING_CALL,
- ATMOP_PREPARE_OUTGOING_CALL,
- ATMOP_QUERY_CONNECTION_ATTRIBUTES,
- ATMOP_REJECT_INCOMING_CALL,
- ATMOP_SET_CONNECTION_ATTRIBUTES,
- ATMOP_WAIT_ON_INCOMING_CALL,
- ATMOP_SET_CONNECTION_ATTRIBUTES_X,
- ATMOP_QUERY_CONNECTION_ATTRIBUTES_X,
- ATMOP_QUERY_STATE
-};
-.Ed
-.Pp
-These codes correspond directly to the operations specified in the ATM
-Forum document with the following exceptions:
-.Bl -tag -width foo
-.It Dv ATMOP_RESP
-As discussed in
-.Xr ng_uni 4 ,
-this is used to
-.Dq synchronify
-the interface.
-The argument is a
-.Bd -literal
-struct atm_resp {
- int32_t resp;
- uint32_t data; /* type of attached data */
-};
-.Ed
-.Pp
-If the response code
-.Va resp
-is zero, the node has accepted the user request.
-If something goes wrong,
-.Va resp
-contains an error code.
-For requests that return data,
-.Va data
-contains a code describing the type of data and the data itself
-starts immediately after the structure.
-.It Dv ATMOP_QUERY_CONNECTION_ATTRIBUTES_X
-This is the same as
-.Dv ATMOP_QUERY_CONNECTION_ATTRIBUTES
-except that it allows to query several attributes
-within one request.
-.It Dv ATMOP_SET_CONNECTION_ATTRIBUTES_X
-This is the same as
-.Dv ATMOP_SET_CONNECTION_ATTRIBUTES
-except that it allows to set several attributes
-within one request.
-The list of attributes is followed directly by the attributes in the same
-order as they appear in the list.
-.El
-.Pp
-If a user hook is disconnected, an active connection on that hook is released.
-Incoming connections waiting to be accepted are reoffered to other
-listening hooks or rejected.
-.Sh CONTROL MESSAGES
-Besides the generic messages the node understands the following special
-messages:
-.Bl -tag -width foo
-.It Dv NGM_CCATM_DUMP Pq Ic dump
-This causes the internal state of the node to be dumped in ASCII to the
-.Va dump
-hook.
-.It Dv NGM_CCATM_STOP Pq Ic stop
-This message causes all connections on that port to be aborted (not released!\&)
-and all ATM endpoints which are bound to that port to be closed.
-It stops processing of all messages from the UNI stack on that port UNI stack.
-The argument is a
-.Bd -literal
-struct ngm_ccatm_port {
- uint32_t port;
-};
-.Ed
-.It Dv NGM_CCATM_START Pq Ic start
-Start processing on the port.
-The argument is a
-.Vt ngm_ccatm_port
-structure.
-.It Dv NGM_CCATM_CLEAR Pq Ic clear
-This message takes a
-.Vt ngm_ccatm_port
-structure and clears all prefixes and addresses on that port.
-If the port number is zero, all ports are cleared.
-.It Dv NGM_CCATM_GET_ADDRESSES Pq Ic get_addresses
-Get the list of all registered addresses on the given port.
-The argument is a
-.Vt ngm_ccatm_port
-structure and the result is a
-.Vt ngm_ccatm_get_addresses
-structure:
-.Bd -literal
-struct ngm_ccatm_get_addresses {
- uint32_t count;
- struct ngm_ccatm_address_req addr[0];
-};
-struct ngm_ccatm_address_req {
- uint32_t port;
- struct uni_addr addr;
-};
-.Ed
-.Pp
-If the
-.Va port
-field is zero in the request, all addresses on all ports
-are returned.
-If it is not zero, only the addresses on that port are reported.
-The number of addresses is returned in the
-.Va count
-field.
-.It Dv NGM_CCATM_ADDRESS_REGISTERED Pq Ic address_reg
-This message is used by ILMI to inform the
-.Nm
-node that a previous address registration request was successful.
-This causes the node to activate that address.
-The argument to the message is a
-.Vt ngm_ccatm_address_req
-structure.
-.It Dv NGM_CCATM_ADDRESS_UNREGISTERED Pq Ic address_unreg
-This message is used by ILMI to inform the
-.Nm
-node that an address has been unregistered.
-The node clears that address from its tables.
-The argument is a
-.Vt ngm_ccatm_address_req
-structure.
-.It Dv NGM_CCATM_SET_PORT_PARAM Pq Ic set_port_param
-This request sets the parameters on the given port.
-The argument is a
-.Bd -literal
-struct ngm_ccatm_atm_port {
- uint32_t port; /* port for which to set parameters */
- uint32_t pcr; /* port peak cell rate */
- uint32_t max_vpi_bits;
- uint32_t max_vci_bits;
- uint32_t max_svpc_vpi;
- uint32_t max_svcc_vpi;
- uint32_t min_svcc_vci;
- uint8_t esi[6];
- uint32_t num_addr;
-};
-.Ed
-.Pp
-This should be used only by ILMI and when that port is stopped and the
-address and prefix tables of that port are empty.
-The
-.Va num_addr
-field is ignored.
-.It Dv NGM_CCATM_GET_PORT_PARAM Pq Ic get_port_param
-Retrieve the parameters of the given port.
-The argument is a
-.Vt ngm_ccatm_port
-and the result a
-.Vt ngm_ccatm_atm_port .
-.It Dv NGM_CCATM_GET_PORTLIST Pq Ic get_portlist
-Get a list of all available ports on that node.
-This is returned as a
-.Bd -literal
-struct ngm_ccatm_portlist {
- uint32_t nports;
- uint32_t ports[];
-};
-.Ed
-.It Dv NGM_CCATM_GETSTATE Pq Ic getstate
-Return the state of a port.
-The argument is a
-.Vt "struct ngm_ccatm_port"
-and the return values as a
-.Vt uint32_t .
-.It Dv NGM_CCATM_SETLOG Pq Ic setlog
-This requests sets a new logging level and returns the previous one.
-The argument is either a
-.Vt uint32_t
-in which case it specifies the new logging level, or may be empty
-in which case just the old level is returned as a
-.Vt uint32_t .
-.It Dv NGM_CCATM_RESET Pq Ic reset
-Reset the node.
-This is allowed only if the number of user hooks and connected UNI stacks is
-zero.
-.It Dv NGM_CCATM_GET_EXSTAT
-Return extended status information from the node.
-.El
-.Sh SEE ALSO
-.Xr netgraph 4 ,
-.Xr ng_uni 4 ,
-.Xr ngctl 8
-.Sh AUTHORS
-.An Harti Brandt Aq Mt harti@FreeBSD.org
diff --git a/share/man/man4/ng_sscfu.4 b/share/man/man4/ng_sscfu.4
deleted file mode 100644
index 6011deaeb2b3..000000000000
--- a/share/man/man4/ng_sscfu.4
+++ /dev/null
@@ -1,166 +0,0 @@
-.\"
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" $FreeBSD$
-.\"
-.\" ng_sscfu(4) man page
-.\"
-.Dd March 3, 2023
-.Dt NG_SSCFU 4
-.Os
-.Sh NAME
-.Nm ng_sscfu
-.Nd netgraph SSCF at the UNI node type
-.Sh SYNOPSIS
-.In netnatm/saal/sscopdef.h
-.In netnatm/saal/sscfudef.h
-.In netgraph/atm/ng_sscfu.h
-.Sh DEPRECATION NOTICE
-.Nm
-is deprecated and may not be available in
-.Fx 14.0
-and later.
-.Sh DESCRIPTION
-The
-.Nm sscfu
-netgraph node type implements ITU-T recommendation Q.2130.
-This recommendation specifies the Service Specific Coordination
-Function at the UNI.
-This is a thin sub-layer between the SSCOP (see
-.Xr ng_sscop 4 )
-and the UNI signalling.
-This node does not really implement a protocol but
-provides a mapping between the signals at the upper layer of the SSCOP and
-the signals the UNI expects at its lower layer.
-It also provides default values for the parameters of the SSCOP.
-.Pp
-After creation of the node, the SSCF instance must be created by sending
-an
-.Dq enable
-message to the node.
-If the node is enabled, default SSCOP parameters
-can be retrieved and set in the corresponding SSCOP instance.
-.Pp
-The node is shut down either by a
-.Dv NGM_SHUTDOWN
-message, or when all hooks are disconnected.
-.Sh HOOKS
-Each
-.Nm sscfu
-node has two hooks with fixed names:
-.Bl -tag -width ".Va upper"
-.It Va lower
-This hook is the interface to the SSCOP.
-The interface expected here is exactly
-that which is exported by the
-.Xr ng_sscop 4
-node type.
-.It Va upper
-This is the interface to the UNI.
-It uses the following message format:
-.Bd -literal
-struct sscfu_arg {
- uint32_t sig;
- u_char data[];
-};
-.Ed
-.Pp
-The
-.Va sig
-field
-is one of the following signals:
-.Bd -literal
-enum saal_sig {
- SAAL_ESTABLISH_request, /* U -> SAAL: (UU) */
- SAAL_ESTABLISH_indication, /* SAAL -> U: (UU) */
- SAAL_ESTABLISH_confirm, /* SAAL -> U: (UU) */
- SAAL_RELEASE_request, /* U -> SAAL: (UU) */
- SAAL_RELEASE_confirm, /* SAAL -> U: */
- SAAL_RELEASE_indication, /* SAAL -> U: (UU) */
- SAAL_DATA_request, /* U -> SAAL: (DATA) */
- SAAL_DATA_indication, /* SAAL -> U: (DATA) */
- SAAL_UDATA_request, /* U -> SAAL: (UDATA) */
- SAAL_UDATA_indication, /* SAAL -> U: (UDATA) */
-};
-.Ed
-.Pp
-The arrows in the comment show the direction of the signal, whether it
-is a signal that comes out of the node
-.Pq Ql -> ,
-or is sent by the node user to the node
-.Pq Ql <- .
-The type of the data expected for the signal is specified in parentheses.
-This data starts at the
-.Va data
-field of the message structure.
-.El
-.Pp
-If the
-.Va lower
-hook is disconnected and the node is enabled, the protocol state is
-reset.
-.Sh CONTROL MESSAGES
-The
-.Nm sscfu
-node understands the generic messages plus the following:
-.Bl -tag -width foo
-.It Dv NGM_SSCFU_GETDEFPARAM Pq Ic getdefparam
-This message returns a
-.Vt sscop_param
-structure, which contains the default parameters for the SSCOP at the
-UNI.
-This structure should be used for a
-.Dv NGM_SSCOP_SETPARAM
-message to the SSCOP node below the SSCF.
-.It Dv NGM_SSCFU_ENABLE Pq Ic enable
-This message creates the actual SSCF instance and initializes it.
-Until this is done, parameters may neither be retrieved nor set,
-and all messages
-received on any hook are discarded.
-.It Dv NGM_SSCFU_DISABLE Pq Ic disable
-Destroy the SSCF instance.
-After this, all messages on any hooks are discarded.
-.It Dv NGM_SSCFU_GETDEBUG Pq Ic getdebug
-Retrieve the debugging flags in a
-.Vt uint32_t .
-.It Dv NGM_SSCFU_SETDEBUG Pq Ic setdebug
-Set debugging flags.
-The argument must be a
-.Vt uint32_t .
-.It Dv NGM_SSCFU_GETSTATE Pq Ic getstate
-Retrieve the current state of the SSCFU instance in a
-.Vt uint32_t .
-If the node has not been enabled, 0 is returned.
-.El
-.Sh SEE ALSO
-.Xr netgraph 4 ,
-.Xr ng_atm 4 ,
-.Xr ng_sscop 4 ,
-.Xr ngctl 8
-.Sh AUTHORS
-.An Harti Brandt Aq Mt harti@FreeBSD.org
diff --git a/share/man/man4/ng_sscop.4 b/share/man/man4/ng_sscop.4
deleted file mode 100644
index 451edcc4aebf..000000000000
--- a/share/man/man4/ng_sscop.4
+++ /dev/null
@@ -1,408 +0,0 @@
-.\"
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" $FreeBSD$
-.\"
-.\" ng_sscop(4) man page
-.\"
-.Dd March 3, 2023
-.Dt NG_SSCOP 4
-.Os
-.Sh NAME
-.Nm ng_sscop
-.Nd netgraph SSCOP node type
-.Sh SYNOPSIS
-.In netnatm/saal/sscopdef.h
-.In netgraph/atm/ng_sscop.h
-.Sh DEPRECATION NOTICE
-.Nm
-is deprecated and may not be available in
-.Fx 14.0
-and later.
-.Sh DESCRIPTION
-The
-.Nm sscop
-netgraph node type implements the ITU-T standard Q.2110.
-This standard describes
-the so called Service Specific Connection Oriented Protocol (SSCOP) that
-is used to carry signalling messages over the private and public UNIs and
-the public NNI.
-This protocol is a transport protocol with selective
-acknowledgements, and can be tailored to the environment.
-This implementation is a full implementation of that standard.
-.Pp
-After creation of the node, the SSCOP instance must be created by sending
-an
-.Dq enable
-message to the node.
-If the node is enabled, the SSCOP parameters
-can be retrieved and modified and the protocol can be started.
-.Pp
-The node is shut down either by a
-.Dv NGM_SHUTDOWN
-message, or when all hooks are disconnected.
-.Sh HOOKS
-Each
-.Nm sscop
-node has three hooks with fixed names:
-.Bl -tag -width ".Va manage"
-.It Va lower
-This hook must be connected to a node that ensures
-transport of packets to and from the remote peer node.
-Normally this is a
-.Xr ng_atm 4
-node with an AAL5 hook, but the
-.Nm sscop
-node is able to work on any packet-transporting layer, like, for example,
-IP or UDP.
-The node handles flow control messages received on
-this hook: if it receives a
-.Dv NGM_HIGH_WATER_PASSED
-message, it declares the
-.Dq "lower layer busy"
-state.
-If a
-.Dv NGM_LOW_WATER_PASSED
-message is received, the busy state is cleared.
-Note that the node does not
-look at the message contents of these flow control messages.
-.It Va upper
-This is the interface to the SSCOP user.
-This interface uses the following message format:
-.Bd -literal
-struct sscop_arg {
- uint32_t sig;
- uint32_t arg; /* opt. sequence number or clear-buff */
- u_char data[];
-};
-.Ed
-.Pp
-The
-.Va sig
-field
-is one of the signals defined in the standard:
-.Bd -literal
-enum sscop_aasig {
- SSCOP_ESTABLISH_request, /* <- UU, BR */
- SSCOP_ESTABLISH_indication, /* -> UU */
- SSCOP_ESTABLISH_response, /* <- UU, BR */
- SSCOP_ESTABLISH_confirm, /* -> UU */
-
- SSCOP_RELEASE_request, /* <- UU */
- SSCOP_RELEASE_indication, /* -> UU, SRC */
- SSCOP_RELEASE_confirm, /* -> */
-
- SSCOP_DATA_request, /* <- MU */
- SSCOP_DATA_indication, /* -> MU, SN */
-
- SSCOP_UDATA_request, /* <- MU */
- SSCOP_UDATA_indication, /* -> MU */
-
- SSCOP_RECOVER_indication, /* -> */
- SSCOP_RECOVER_response, /* <- */
-
- SSCOP_RESYNC_request, /* <- UU */
- SSCOP_RESYNC_indication, /* -> UU */
- SSCOP_RESYNC_response, /* <- */
- SSCOP_RESYNC_confirm, /* -> */
-
- SSCOP_RETRIEVE_request, /* <- RN */
- SSCOP_RETRIEVE_indication, /* -> MU */
- SSCOP_RETRIEVE_COMPL_indication,/* -> */
-};
-.Ed
-.Pp
-The arrows in the comment show the direction of the signal, whether it
-is a signal that comes out of the node
-.Pq Ql -> ,
-or is sent by the node user to the node
-.Pq Ql <- .
-The
-.Va arg
-field contains the argument to some of the signals: it is either a PDU
-sequence number, or the
-.Dv CLEAR-BUFFER
-flag.
-There are a number of special sequence numbers for some operations:
-.Pp
-.Bl -tag -width ".Dv SSCOP_RETRIEVE_UNKNOWN" -offset indent -compact
-.It Dv SSCOP_MAXSEQNO
-maximum legal sequence number
-.It Dv SSCOP_RETRIEVE_UNKNOWN
-retrieve transmission queue
-.It Dv SSCOP_RETRIEVE_TOTAL
-retrieve transmission buffer and queue
-.El
-.Pp
-For signals that carry user data (as, for example,
-.Dv SSCOP_DATA_request )
-these two fields are followed by the variable sized user data.
-.Pp
-If the
-.Va upper
-hook is disconnected and the SSCOP instance is not in the idle
-state, and the
-.Va lower
-hook is still connected, an
-.Dv SSCOP_RELEASE_request
-is executed to release the SSCOP connection.
-.It Va manage
-This is the management interface defined in the standard.
-The data structure used here is:
-.Bd -literal
-struct sscop_marg {
- uint32_t sig;
- u_char data[];
-};
-.Ed
-.Pp
-Here
-.Va sig
-is one of
-.Bd -literal
-enum sscop_maasig {
- SSCOP_MDATA_request, /* <- MU */
- SSCOP_MDATA_indication, /* -> MU */
- SSCOP_MERROR_indication, /* -> CODE, CNT */
-};
-.Ed
-.Pp
-The
-.Dv SSCOP_MDATA
-signals are followed by the actual management data, where the
-.Dv SSCOP_MERROR
-signal has the form:
-.Bd -literal
-struct sscop_merr {
- uint32_t sig;
- uint32_t err; /* error code */
- uint32_t cnt; /* error count */
-};
-.Ed
-.El
-.Sh CONTROL MESSAGES
-The
-.Nm sscop
-node understands the generic control messages, plus the following:
-.Bl -tag -width foo
-.It Dv NGM_SSCOP_SETPARAM Pq Ic setparam
-Sets operational parameters of the SSCOP instance and takes the
-following structure:
-.Bd -literal
-struct ng_sscop_setparam {
- uint32_t mask;
- struct sscop_param param;
-};
-.Ed
-.Pp
-The sub-structure
-.Va param
-contains the parameters to set, and the
-.Va mask
-field contains a bit mask, telling which of the parameters to set, and which
-to ignore.
-If a bit is set, the corresponding parameter is set.
-The parameters are:
-.Bd -literal
-struct sscop_param {
- uint32_t timer_cc; /* timer_cc in msec */
- uint32_t timer_poll; /* timer_poll im msec */
- uint32_t timer_keep_alive;/* timer_keep_alive in msec */
- uint32_t timer_no_response;/*timer_no_response in msec */
- uint32_t timer_idle; /* timer_idle in msec */
- uint32_t maxk; /* maximum user data in bytes */
- uint32_t maxj; /* maximum u-u info in bytes */
- uint32_t maxcc; /* max. retransmissions for control packets */
- uint32_t maxpd; /* max. vt(pd) before sending poll */
- uint32_t maxstat; /* max. number of elements in stat list */
- uint32_t mr; /* initial window */
- uint32_t flags; /* flags */
-};
-.Ed
-.Pp
-The
-.Va flags
-field contains the following flags influencing SSCOP operation:
-.Pp
-.Bl -tag -width ".Dv SSCOP_POLLREX" -offset indent -compact
-.It Dv SSCOP_ROBUST
-enable atmf/97-0216 robustness enhancement
-.It Dv SSCOP_POLLREX
-send POLL after each retransmission
-.El
-.Pp
-The bitmap has the following bits:
-.Pp
-.Bl -tag -width ".Dv SSCOP_SET_POLLREX" -offset indent -compact
-.It Dv SSCOP_SET_TCC
-set
-.Va timer_cc
-.It Dv SSCOP_SET_TPOLL
-set
-.Va timer_poll
-.It Dv SSCOP_SET_TKA
-set
-.Va timer_keep_alive
-.It Dv SSCOP_SET_TNR
-set
-.Va timer_no_response
-.It Dv SSCOP_SET_TIDLE
-set
-.Va timer_idle
-.It Dv SSCOP_SET_MAXK
-set
-.Va maxk
-.It Dv SSCOP_SET_MAXJ
-set
-.Va maxj
-.It Dv SSCOP_SET_MAXCC
-set
-.Va maxcc
-.It Dv SSCOP_SET_MAXPD
-set
-.Va maxpd
-.It Dv SSCOP_SET_MAXSTAT
-set
-.Va maxstat
-.It Dv SSCOP_SET_MR
-set the initial window
-.It Dv SSCOP_SET_ROBUST
-set or clear
-.Dv SSCOP_ROBUST
-.It Dv SSCOP_SET_POLLREX
-set or clear
-.Dv SSCOP_POLLREX
-.El
-.Pp
-The node responds to the
-.Dv NGM_SSCOP_SETPARAM
-message with the following response:
-.Bd -literal
-struct ng_sscop_setparam_resp {
- uint32_t mask;
- int32_t error;
-};
-.Ed
-.Pp
-Here
-.Va mask
-contains a bitmask of the parameters that the user requested to set,
-but that could not be set and
-.Va error
-is an
-.Xr errno 2
-code describing why the parameter could not be set.
-.It Dv NGM_SSCOP_GETPARAM Pq Ic getparam
-This message returns the current operational parameters of the SSCOP
-instance in a
-.Vt sscop_param
-structure.
-.It Dv NGM_SSCOP_ENABLE Pq Ic enable
-This message creates the actual SSCOP instance and initializes it.
-Until this is done, parameters may neither be retrieved nor set, and all
-messages received on any hook are discarded.
-.It Dv NGM_SSCOP_DISABLE Pq Ic disable
-Destroy the SSCOP instance.
-After this, all messages on any hooks are
-discarded.
-.It Dv NGM_SSCOP_SETDEBUG Pq Ic setdebug
-Set debugging flags.
-The argument is a
-.Vt uint32_t .
-.It Dv NGM_SSCOP_GETDEBUG Pq Ic getdebug
-Retrieve the actual debugging flags.
-Needs no arguments and responds with a
-.Vt uint32_t .
-.It Dv NGM_SSCOP_GETSTATE Pq Ic getstate
-Responds with the current state of the SSCOP instance in a
-.Vt uint32_t .
-If the node is not enabled, the retrieved state is 0.
-.El
-.Sh FLOW CONTROL
-Flow control works on the upper and on the lower layer interface.
-At the lower
-layer interface, the two messages,
-.Dv NGM_HIGH_WATER_PASSED
-and
-.Dv NGM_LOW_WATER_PASSED ,
-are used to declare or clear the
-.Dq "lower layer busy"
-state of the protocol.
-.Pp
-At the upper layer interface, the
-.Nm sscop
-node handles three types of flow control messages:
-.Bl -tag -width foo
-.It Dv NGM_HIGH_WATER_PASSED
-If this message is received, the SSCOP stops moving the receive window.
-Each time a data message is handed over to the upper layer, the receive
-window is moved by one message.
-Stopping these updates
-means that the window will start to close and if the peer has sent
-all messages allowed by the current window, it stops transmission.
-This means that the upper layer must be able to still receive a full window
-amount of messages.
-.It Dv NGM_LOW_WATER_PASSED
-This will re-enable the automatic window updates, and if the space indicated
-in the message is larger than the current window, the window will be opened
-by that amount.
-The space is computed as the difference of the
-.Va max_queuelen_packets
-and
-.Va current
-members of the
-.Vt ngm_queue_state
-structure.
-.It Dv NGM_SYNC_QUEUE_STATE
-If the upper layer buffer filling state, as indicated by
-.Va current ,
-is equal to or greater than
-.Va high_watermark
-then the message is ignored.
-If this is not the case, the amount
-of receiver space is computed as the difference of
-.Va max_queuelen_packets
-and
-.Va current
-if automatic window updates are currently allowed, and as the difference of
-.Va high_water_mark
-and
-.Va current
-if window updates are disabled.
-If the resulting value is larger than the current window, the current window
-is opened up to this value.
-Automatic window updates are enabled if they
-were disabled.
-.El
-.Sh SEE ALSO
-.Xr netgraph 4 ,
-.Xr ng_atm 4 ,
-.Xr ng_sscfu 4 ,
-.Xr ngctl 8
-.Sh AUTHORS
-.An Harti Brandt Aq Mt harti@FreeBSD.org
diff --git a/share/man/man4/ng_uni.4 b/share/man/man4/ng_uni.4
deleted file mode 100644
index 993119d23c70..000000000000
--- a/share/man/man4/ng_uni.4
+++ /dev/null
@@ -1,425 +0,0 @@
-.\"
-.\" Copyright (c) 2001-2003
-.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-.\" All rights reserved.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 3, 2023
-.Dt NG_UNI 4
-.Os
-.Sh NAME
-.Nm ng_uni
-.Nd netgraph UNI node type
-.Sh SYNOPSIS
-.In netnatm/msg/unistruct.h
-.In netnatm/sig/unidef.h
-.In netgraph/atm/ng_uni.h
-.Sh DEPRECATION NOTICE
-.Nm
-is deprecated and may not be available in
-.Fx 14.0
-and later.
-.Sh DESCRIPTION
-The
-.Nm uni
-netgraph node type implements ATM Forum signalling 4.0.
-.Pp
-After creation of the node, the UNI instance must be created by sending
-an
-.Dq enable
-message to the node.
-If the node is enabled, the UNI parameters
-can be retrieved and modified, and the protocol can be started.
-.Pp
-The node is shut down either by an
-.Dv NGM_SHUTDOWN
-message, or when all hooks are disconnected.
-.Sh HOOKS
-Each
-.Nm uni
-node has three hooks with fixed names:
-.Bl -tag -width ".Va upper"
-.It Va lower
-This hook is the interface of the UNI protocol to the transport layer of
-the ATM control plane.
-The node expects the interface exported by
-.Xr ng_sscfu 4
-at this hook.
-.It Va upper
-This hook is the
-.Dq user
-interface of the UNI protocol.
-Because there is no standardized interface
-at this point, this implementation follows more or less the interface
-specified by the SDL diagrams in ITU-T recommendations Q.2931 and Q.2971.
-Normally either a
-.Xr ng_ccatm 4
-or a switch CAC should be stacked at this interface.
-The message format at the
-.Va upper
-hook is described below.
-Because
-.Xr netgraph 4
-is functional, it makes sometimes sense to switch this hook to queueing mode
-from the peer node upon connection.
-.El
-.Pp
-The
-.Va upper
-interface of the
-.Nm uni
-node is loosely modelled after the interface specified in the ITU-T signalling
-standards.
-There is however one derivation from this: normally there exists
-four kinds of signals: requests, responses, indications and confirmations.
-These signals are usually triggered either by external events (receiving a
-message) or internal events (a timer or another signal).
-This scheme works
-fine for user APIs that are entirely asynchronous, and in cases where
-error handling is not taken into account.
-With synchronous APIs and error
-handling however, there is a problem.
-If, for example, the application
-issues a request to set up a connection,
-it may do it by sending a
-.Dv SETUP.request
-signal to the UNI.
-Normally, the UNI stack will send a SETUP message and
-receive a message from the switch (a RELEASE, CONNECT, CALL PROCEEDING or
-ALERTING), or a timer in the UNI stack will time out.
-In any of these cases,
-the UNI stack is supposed to report an event back to the application, and
-the application will unblock (in the case of a synchronous API) and handle
-the event.
-The problem occurs when an error happens.
-Suppose there is no
-memory to send the SETUP message and to start the timer.
-In this case, the
-application will block forever because no received message and no timer
-will wake it up.
-For this reason this implementation uses an additional message:
-for each signal sent from the application to the stack, the stack will
-respond with an error code.
-If this code is zero, the stack has accepted
-the signal and the application may block; if the code is non-zero, the signal
-is effectively ignored and the code describes what was wrong.
-This system
-makes it very easy to make a blocking interface out of the message based
-netgraph interface.
-.Pp
-The
-.Va upper
-interface uses the following structure:
-.Bd -literal
-struct uni_arg {
- uint32_t sig;
- uint32_t cookie;
- u_char data[];
-};
-.Ed
-The
-.Va sig
-field contains the actual signal that is sent from the user to UNI or from
-UNI to the user.
-The
-.Va cookie
-can be used by the user to correlate requests with events and responses.
-If an error response, a confirmation or an indication was triggered by
-a request or response, the cookie from that request or response is carried in
-the message from the stack to the user.
-The
-.Va cookie
-field is followed by the actual data for the signal.
-.Pp
-The signal is one of the following:
-.Bd -literal
-enum uni_sig {
- UNIAPI_ERROR, /* UNI -> API */
-
- UNIAPI_CALL_CREATED, /* UNI -> API */
- UNIAPI_CALL_DESTROYED, /* UNI -> API */
- UNIAPI_PARTY_CREATED, /* UNI -> API */
- UNIAPI_PARTY_DESTROYED, /* UNI -> API */
-
- UNIAPI_LINK_ESTABLISH_request, /* API -> UNI */
- UNIAPI_LINK_ESTABLISH_confirm, /* UNI -> API */
- UNIAPI_LINK_RELEASE_request, /* API -> UNI */
- UNIAPI_LINK_RELEASE_confirm, /* UNI -> API */
-
- UNIAPI_RESET_request, /* API -> UNI */
- UNIAPI_RESET_confirm, /* UNI -> API */
- UNIAPI_RESET_indication, /* UNI -> API */
- UNIAPI_RESET_ERROR_indication, /* UNI -> API */
- UNIAPI_RESET_response, /* API -> UNI */
- UNIAPI_RESET_ERROR_response, /* API -> UNI */
- UNIAPI_RESET_STATUS_indication, /* UNI -> API */
-
- UNIAPI_SETUP_request, /* API -> UNI */
- UNIAPI_SETUP_indication, /* UNI -> API */
- UNIAPI_SETUP_response, /* API -> UNI */
- UNIAPI_SETUP_confirm, /* UNI -> API */
- UNIAPI_SETUP_COMPLETE_indication, /* UNI -> API */
- UNIAPI_ALERTING_request, /* API -> UNI */
- UNIAPI_ALERTING_indication, /* UNI -> API */
- UNIAPI_PROCEEDING_request, /* API -> UNI */
- UNIAPI_PROCEEDING_indication, /* UNI -> API */
- UNIAPI_RELEASE_request, /* API -> UNI */
- UNIAPI_RELEASE_indication, /* UNI -> API */
- UNIAPI_RELEASE_response, /* API -> UNI */
- UNIAPI_RELEASE_confirm, /* UNI -> API */
- UNIAPI_NOTIFY_request, /* API -> UNI */
- UNIAPI_NOTIFY_indication, /* UNI -> API */
- UNIAPI_STATUS_indication, /* UNI -> API */
- UNIAPI_STATUS_ENQUIRY_request, /* API -> UNI */
-
- UNIAPI_ADD_PARTY_request, /* API -> UNI */
- UNIAPI_ADD_PARTY_indication, /* UNI -> API */
- UNIAPI_PARTY_ALERTING_request, /* API -> UNI */
- UNIAPI_PARTY_ALERTING_indication, /* UNI -> API */
- UNIAPI_ADD_PARTY_ACK_request, /* API -> UNI */
- UNIAPI_ADD_PARTY_ACK_indication, /* UNI -> API */
- UNIAPI_ADD_PARTY_REJ_request, /* API -> UNI */
- UNIAPI_ADD_PARTY_REJ_indication, /* UNI -> API */
- UNIAPI_DROP_PARTY_request, /* API -> UNI */
- UNIAPI_DROP_PARTY_indication, /* UNI -> API */
- UNIAPI_DROP_PARTY_ACK_request, /* API -> UNI */
- UNIAPI_DROP_PARTY_ACK_indication, /* UNI -> API */
-
- UNIAPI_ABORT_CALL_request, /* API -> UNI */
-
- UNIAPI_MAXSIG
-};
-.Ed
-.Pp
-The meaning of most of the signals can be deduced from the ITU-T SDLs.
-A number of signals, however, is unique to this implementation:
-.Bl -tag -width foo
-.It Dv UNIAPI_ERROR
-This is the error response, mentioned earlier.
-It carries an error code or
-zero, if the signal was accepted by the stack.
-.It Dv UNIAPI_CALL_CREATED
-The UNI stack has created a call instance either from an incoming SETUP or
-from the user requesting an outgoing SETUP.
-This may be used to synchronize
-the creation and destroying of call data between the UNI stack and the user.
-.It Dv UNIAPI_CALL_DESTROYED
-A call instance has been destroyed and all resources have been freed.
-.It Dv UNIAPI_PARTY_CREATED
-A new party has been created for an existing point-to-multipoint call.
-This may be used to synchronize the creation and destroying of party data
-between the UNI stack and the user.
-.It Dv UNIAPI_PARTY_DESTROYED
-A party has been destroyed and all resources have been freed.
-.It Dv UNIAPI_ABORT_CALL_request
-This requests the stack to destroy the call instance
-and free all its resources,
-without sending any messages to the network.
-.It Dv UNIAPI_MAXSIG
-This is not a signal, but rather a definition to get the number of defined
-signals.
-.El
-.Pp
-Each of the signals is followed by a fixed size structure defined in
-.In netnatm/sig/unidef.h .
-.Sh CONTROL MESSAGES
-The
-.Nm uni
-node understands the standard control messages, plus the following:
-.Bl -tag -width foo
-.It Dv NGM_UNI_SETDEBUG Pq Ic setdebug
-Set debugging facility levels.
-The UNI stack defines a number of debugging
-facilities, each one associated with a debugging level.
-If the debugging level
-of a facility is non-zero, text output will be generated to the console.
-The message uses the following structure:
-.Bd -literal
-struct ngm_uni_debug {
- uint32_t level[UNI_MAXFACILITY];
-};
-.Ed
-.It Dv NGM_UNI_GETDEBUG Pq Ic getdebug
-Get debugging facility levels.
-This returns an
-.Vt ngm_uni_debug
-structure.
-.It Dv NGM_UNI_GET_CONFIG Pq Ic get_config
-Retrieve the current configuration of the UNI instance.
-This message returns a
-.Vt uni_config
-structure:
-.Bd -literal
-struct uni_config {
- uint32_t proto; /* which protocol */
- uint32_t popt; /* protocol option */
- uint32_t option; /* other options */
- uint32_t timer301; /* T301 */
- uint32_t timer303; /* T303 */
- uint32_t init303; /* T303 retransmission count */
- uint32_t timer308; /* T308 */
- uint32_t init308; /* T308 retransmission count */
- uint32_t timer309; /* T309 */
- uint32_t timer310; /* T310 */
- uint32_t timer313; /* T313 */
- uint32_t timer316; /* T316 */
- uint32_t init316; /* T316 retransmission count */
- uint32_t timer317; /* T317 */
- uint32_t timer322; /* T322 */
- uint32_t init322; /* T322 retransmission count */
- uint32_t timer397; /* T397 */
- uint32_t timer398; /* T398 */
- uint32_t timer399; /* T399 */
-};
-.Ed
-.Pp
-The field
-.Va proto
-specifies one of the following protocols:
-.Bd -literal
-enum uni_proto {
- UNIPROTO_UNI40U, /* UNI4.0 user side */
- UNIPROTO_UNI40N, /* UNI4.0 network side */
- UNIPROTO_PNNI10, /* PNNI1.0 */
-};
-.Ed
-.Pp
-Some protocols may have options which can be set in
-.Va popt :
-.Bd -literal
-enum uni_popt {
- UNIPROTO_GFP, /* enable GFP */
-};
-.Ed
-.Pp
-The
-.Va option
-field controls parsing and checking of messages:
-.Bd -literal
-enum uni_option {
- UNIOPT_GIT_HARD, /* harder check of GIT IE */
- UNIOPT_BEARER_HARD, /* harder check of BEARER IE */
- UNIOPT_CAUSE_HARD, /* harder check of CAUSE IE */
-};
-.Ed
-.Pp
-All timer values are given in milliseconds.
-Note, however, that the actual
-resolution of the timers depend on system configuration (see
-.Xr timeout 9 ) .
-.It Dv NGM_UNI_SET_CONFIG Pq Ic set_config
-Change the UNI configuration.
-This takes a
-.Bd -literal
-struct ngm_uni_set_config {
- struct uni_config config;
- struct ngm_uni_config_mask mask;
-};
-struct ngm_uni_config_mask {
- uint32_t mask;
- uint32_t popt_mask;
- uint32_t option_mask;
-};
-.Ed
-.Pp
-The fields of the
-.Vt ngm_uni_config_mask
-specify which configuration parameter to change.
-The
-.Va mask
-field contains bit definitions for all timers, retransmission counters
-and the
-.Va proto
-field,
-.Va popt_mask
-selects which of the protocol options to change, and
-.Va option_mask
-specifies which options should be changed.
-The following bits are defined:
-.Bd -literal
-enum uni_config_mask {
- UNICFG_PROTO,
- UNICFG_TIMER301,
- UNICFG_TIMER303,
- UNICFG_INIT303,
- UNICFG_TIMER308,
- UNICFG_INIT308,
- UNICFG_TIMER309,
- UNICFG_TIMER310,
- UNICFG_TIMER313,
- UNICFG_TIMER316,
- UNICFG_INIT316,
- UNICFG_TIMER317,
- UNICFG_TIMER322,
- UNICFG_INIT322,
- UNICFG_TIMER397,
- UNICFG_TIMER398,
- UNICFG_TIMER399,
-};
-.Ed
-.Pp
-For
-.Va popt_mask
-and
-.Va option_mask ,
-the definitions from
-.Vt "enum uni_popt"
-and
-.Vt "enum uni_option"
-should be used.
-.It Dv NGM_UNI_ENABLE Pq Ic enable
-Create the UNI instance and enable processing.
-Before the UNI is enabled parameters cannot be retrieved or set.
-.It Dv NGM_UNI_DISABLE Pq Ic disable
-Destroy the UNI instance and free all resources.
-Note, that connections are not released.
-.El
-.Sh SEE ALSO
-.Xr netgraph 4 ,
-.Xr ng_atm 4 ,
-.Xr ng_sscfu 4 ,
-.Xr ng_sscop 4 ,
-.Xr ngctl 8
-.Sh AUTHORS
-The
-.Nm uni
-netgraph node
-and this manual page were written by
-.An Harti Brandt Aq Mt harti@FreeBSD.org
-.Sh BUGS
-.Bl -bullet -compact
-.It
-LIJ (leaf-initiated-join) is not implemented yet.
-.It
-GFP (generic functional protocol, Q.2932.1) is not yet implemented.
-.It
-More testing needed.
-.It
-PNNI not yet implemented.
-.It
-Need to implement connection modification and the Q.2931 amendments.
-.El
diff --git a/share/man/man4/ngatmbase.4 b/share/man/man4/ngatmbase.4
deleted file mode 100644
index 6cdc3eb532fc..000000000000
--- a/share/man/man4/ngatmbase.4
+++ /dev/null
@@ -1,139 +0,0 @@
-.\"
-.\" Copyright (c) 2004
-.\" Hartmut Brandt.
-.\" All rights reserved.
-.\"
-.\" Author: Hartmut Brandt <harti@FreeBSD.org>
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.\" ngatmbase(4) man page
-.\"
-.Dd March 3, 2023
-.Dt NGATMBASE 4
-.Os
-.Sh DEPRECATION NOTICE
-.Nm
-is deprecated and may not be available in
-.Fx 14.0
-and later.
-.Sh NAME
-.Nm ngatmbase
-.Nd netgraph ATM utility module
-.Sh SYNOPSIS
-.In netnatm/unimsg.h
-.In netgraph/atm/ngatmbase.h
-.Ft "struct mbuf *"
-.Fn uni_msg_pack_mbuf "struct uni_msg *msg" "void *hdr" "size_t len"
-.Ft "struct uni_msg *"
-.Fn uni_msg_alloc "size_t len"
-.Ft "struct uni_msg *"
-.Fn uni_msg_build "void *buf" ...
-.Ft void
-.Fn uni_msg_destroy "struct uni_msg *msg"
-.Ft int
-.Fn uni_msg_unpack_mbuf "struct mbuf *m" "struct uni_msg *msgp"
-.Sh DESCRIPTION
-This module provides utility functions for the handling of signalling
-messages to the NgATM modules.
-.Pp
-The
-.Fn uni_msg_pack_mbuf
-function
-packs a message into one or several
-.Vt mbuf Ns s
-optionally prepending a header.
-The header is given by its address
-.Fa hdr
-and length
-.Fa len .
-If
-.Fa hdr
-is
-.Dv NULL
-or
-.Fa len
-equals 0, no header is prepended.
-Either
-.Fa msg
-or
-.Fa hdr
-may be
-.Dv NULL
-but not both.
-The
-.Fn uni_msg_pack_mbuf
-function
-returns a pointer to the allocated
-.Vt mbuf
-chain or
-.Dv NULL
-in the case of an error.
-.Pp
-The
-.Fn uni_msg_alloc
-function
-allocates a new message with space for at least
-.Fa len
-bytes.
-In the case of an error
-.Dv NULL
-is returned.
-.Pp
-The
-.Fn uni_msg_build
-function constructs a message from pieces.
-Each piece is given by a pair of
-arguments, the first of type
-.Vt "void *"
-and the second a
-.Vt size_t .
-The list of pieces must be terminated by
-.Po Vt "void *" Pc Ns Dv NULL .
-.Pp
-The
-.Fn uni_msg_destroy
-function
-destroys the messages and frees all the messages's memory.
-.Pp
-The
-.Fn uni_msg_unpack_mbuf
-function
-unpacks an
-.Vt mbuf
-chain info a
-.Vt uni_msg .
-A pointer to the newly allocated message is stored in
-.Fa msgp
-and 0 is returned.
-In the case of an error (either when no packet header is found
-in the first mbuf or memory cannot be allocated) the function
-returns an appropriate error code.
-.Sh SEE ALSO
-.Xr ng_ccatm 4 ,
-.Xr ng_sscfu 4 ,
-.Xr ng_sscop 4 ,
-.Xr ng_uni 4
-.Sh AUTHORS
-.An Harti Brandt Aq Mt harti@FreeBSD.org
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index e76fe24d5506..35bd7fa98120 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -841,13 +841,6 @@ options NETGRAPH_UI
options NETGRAPH_VJC
options NETGRAPH_VLAN
-# NgATM - Netgraph ATM
-options NGATM_ATMBASE
-options NGATM_SSCOP
-options NGATM_SSCFU
-options NGATM_UNI
-options NGATM_CCATM
-
# Network stack virtualization.
options VIMAGE
options VNET_DEBUG # debug for VIMAGE
diff --git a/sys/conf/files b/sys/conf/files
index 952aab6f1b6e..afdf8e147014 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -633,50 +633,6 @@ contrib/libnv/cnvlist.c standard
contrib/libnv/dnvlist.c standard
contrib/libnv/nvlist.c standard
contrib/libnv/bsd_nvpair.c standard
-contrib/ngatm/netnatm/api/cc_conn.c optional ngatm_ccatm \
- compile-with "${NORMAL_C_NOWERROR} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/api/cc_data.c optional ngatm_ccatm \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/api/cc_dump.c optional ngatm_ccatm \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/api/cc_port.c optional ngatm_ccatm \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/api/cc_sig.c optional ngatm_ccatm \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/api/cc_user.c optional ngatm_ccatm \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/api/unisap.c optional ngatm_ccatm \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/misc/straddr.c optional ngatm_atmbase \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/misc/unimsg_common.c optional ngatm_atmbase \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/msg/traffic.c optional ngatm_atmbase \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/msg/uni_ie.c optional ngatm_atmbase \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/msg/uni_msg.c optional ngatm_atmbase \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/saal/saal_sscfu.c optional ngatm_sscfu \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/saal/saal_sscop.c optional ngatm_sscop \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/sig/sig_call.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/sig/sig_coord.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/sig/sig_party.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/sig/sig_print.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/sig/sig_reset.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/sig/sig_uni.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/sig/sig_unimsgcpy.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-contrib/ngatm/netnatm/sig/sig_verify.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
# xz
dev/xz/xz_mod.c optional xz \
compile-with "${NORMAL_C} -DXZ_USE_CRC64 -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
@@ -4251,16 +4207,6 @@ net80211/ieee80211_vht.c optional wlan
net80211/ieee80211_wds.c optional wlan
net80211/ieee80211_xauth.c optional wlan wlan_xauth
net80211/ieee80211_alq.c optional wlan ieee80211_alq
-netgraph/atm/ccatm/ng_ccatm.c optional ngatm_ccatm \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-netgraph/atm/ngatmbase.c optional ngatm_atmbase \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-netgraph/atm/sscfu/ng_sscfu.c optional ngatm_sscfu \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-netgraph/atm/sscop/ng_sscop.c optional ngatm_sscop \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
-netgraph/atm/uni/ng_uni.c optional ngatm_uni \
- compile-with "${NORMAL_C} -I$S/contrib/ngatm"
netgraph/bluetooth/common/ng_bluetooth.c optional netgraph_bluetooth
netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb
netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c optional netgraph_bluetooth_ubt usb
diff --git a/sys/conf/options b/sys/conf/options
index af83bc967670..a1b278491a73 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -563,13 +563,6 @@ NETGRAPH_UI opt_netgraph.h
NETGRAPH_VJC opt_netgraph.h
NETGRAPH_VLAN opt_netgraph.h
-# NgATM options
-NGATM_ATMBASE opt_netgraph.h
-NGATM_SSCOP opt_netgraph.h
-NGATM_SSCFU opt_netgraph.h
-NGATM_UNI opt_netgraph.h
-NGATM_CCATM opt_netgraph.h
-
# DRM options
DRM_DEBUG opt_drm.h
diff --git a/sys/contrib/ngatm/FREEBSD-Xlist b/sys/contrib/ngatm/FREEBSD-Xlist
deleted file mode 100644
index 0ead0cc6a5ce..000000000000
--- a/sys/contrib/ngatm/FREEBSD-Xlist
+++ /dev/null
@@ -1,15 +0,0 @@
-#$FreeBSD$
-*/README
-*/VERSION
-*/Makefile.in
-*/Makefile.pre
-*/Makefile.post
-*/aclocal.m4
-*/config
-*/configure
-*/configure.ac
-*/libngatm
-*/man
-*/snmp_atm
-*/snmp_ilmid
-*/sscop
diff --git a/sys/contrib/ngatm/FREEBSD-upgrade b/sys/contrib/ngatm/FREEBSD-upgrade
deleted file mode 100644
index cb167acca87d..000000000000
--- a/sys/contrib/ngatm/FREEBSD-upgrade
+++ /dev/null
@@ -1,26 +0,0 @@
-$FreeBSD$
-
-This is the part of the NgATM stuff that is shared by kernel and user.
-Be careful to feed changes back to the maintainer <harti@freebsd.org>,
-because the code here is actually shared with other environments besides
-FreeBSD.
-
-Import should be done by:
-
- 1. Put the distribution into a clean directory.
-
- 2. Remove any unneeded files.
-
- 3. cvs import \
- -m "Virgin import of NgATM shared kernel/user part X.Y" \
- src/sys/contrib/ngatm/netnatm BEGEMOT NGATM_X_Y
-
- 4. resolve conflicts
-
- 5. check-out the imported stuff
-
- 6. Re-generate files by calling ./genfiles
-
- 7. If neccessary commit the re-generated files
-
-harti
diff --git a/sys/contrib/ngatm/netnatm/addr.h b/sys/contrib/ngatm/netnatm/addr.h
deleted file mode 100644
index c1ba20eb1c3d..000000000000
--- a/sys/contrib/ngatm/netnatm/addr.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1996-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/netnatm/addr.h,v 1.3 2004/07/08 08:21:45 brandt Exp $
- */
-#ifndef _NETNATM_ADDR_H_
-#define _NETNATM_ADDR_H_
-
-int uni_str2nsap(u_char *, const char *);
-void uni_nsap2str(char *, const u_char *, int);
-
-void uni_prefix2str(char *, const u_char *, u_int, int);
-
-int uni_e1642nsap(u_char *, const char *);
-int uni_nsap2e164(char *, const u_char *, int);
-
-#endif
diff --git a/sys/contrib/ngatm/netnatm/api/atmapi.h b/sys/contrib/ngatm/netnatm/api/atmapi.h
deleted file mode 100644
index 887f548598ed..000000000000
--- a/sys/contrib/ngatm/netnatm/api/atmapi.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2003-2004
- * Hartmut Brandt
- * All rights reserved.
- *
- * Copyright (c) 2001-2002
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution of this software and documentation and use in source and
- * binary forms, with or without modification, are permitted provided that
- * the following conditions are met:
- *
- * 1. Redistributions of source code or documentation must retain the above
- * copyright notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHORS
- * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/api/atmapi.h,v 1.1 2004/07/08 08:21:48 brandt Exp $
- *
- * ATM API as defined per af-saa-0108
- */
-#ifndef _NETNATM_API_ATMAPI_H_
-#define _NETNATM_API_ATMAPI_H_
-
-#include <sys/types.h>
-
-/* size of an endpointlen including trailing \0 */
-#define ATM_EPNAMSIZ 65
-
-enum atmstate {
- ATM_A0, /* non existent */
- ATM_A1, /* initial */
- ATM_A2, /* outgoing call preparation */
- ATM_A3, /* outgoing call requested */
- ATM_A4, /* incoming call preparation */
- ATM_A5, /* wait incoming call */
- ATM_A6, /* incoming call present */
- ATM_A7, /* incoming call requested */
- ATM_A8, /* p2p data transfer */
- ATM_A9, /* p2mp root data transfer */
- ATM_A10, /* p2mp leaf data transfer */
- ATM_A11, /* terminated */
-};
-
-enum atmop {
- ATMOP_RESP, /* 0 */
- ATMOP_ABORT_CONNECTION,
- ATMOP_ACCEPT_INCOMING_CALL,
- ATMOP_ADD_PARTY,
- ATMOP_ADD_PARTY_REJECT,
- ATMOP_ADD_PARTY_SUCCESS, /* 5 */
- ATMOP_ARRIVAL_OF_INCOMING_CALL,
- ATMOP_CALL_RELEASE,
- ATMOP_CONNECT_OUTGOING_CALL,
- ATMOP_DROP_PARTY,
- ATMOP_GET_LOCAL_PORT_INFO, /* 10 */
- ATMOP_P2MP_CALL_ACTIVE,
- ATMOP_P2P_CALL_ACTIVE,
- ATMOP_PREPARE_INCOMING_CALL,
- ATMOP_PREPARE_OUTGOING_CALL,
- ATMOP_QUERY_CONNECTION_ATTRIBUTES, /* 15 */
- ATMOP_REJECT_INCOMING_CALL,
- ATMOP_SET_CONNECTION_ATTRIBUTES,
- ATMOP_WAIT_ON_INCOMING_CALL,
- ATMOP_SET_CONNECTION_ATTRIBUTES_X,
- ATMOP_QUERY_CONNECTION_ATTRIBUTES_X, /* 20 */
- ATMOP_QUERY_STATE,
-};
-
-#define ATM_DEFINE_ERRORS \
- DEF(ATMERR_OK, 0, "OK") \
- DEF(ATMERR_SYS, -1, "syscall error") \
- DEF(ATMERR_BAD_OP, -2, "bad operation") \
- DEF(ATMERR_BAD_ARGS, -3, "bad arguments for operation") \
- DEF(ATMERR_BAD_STATE, -4, "operation in bad state") \
- DEF(ATMERR_BAD_ATTR, -5, "unknown attribute") \
- DEF(ATMERR_BAD_VALUE, -6, "bad attribute value") \
- DEF(ATMERR_BUSY, -7, "busy") \
- DEF(ATMERR_RDONLY, -8, "read-only attribute") \
- DEF(ATMERR_BAD_SAP, -9, "bad SAP") \
- DEF(ATMERR_OVERLAP, -10,"overlaping SAP") \
- DEF(ATMERR_BAD_ENDPOINT, -11,"bad ATM endpoint") \
- DEF(ATMERR_PREVIOUSLY_ABORTED,-12,"previously aborted") \
- DEF(ATMERR_NO_CALL, -13,"no incoming call") \
- DEF(ATMERR_BAD_LEAF_IDENT, -14,"bad leaf identifier") \
- DEF(ATMERR_BAD_PORT, -15,"unknown port") \
- DEF(ATMERR_BAD_SIGNAL, -29-UNIAPI_ERROR_BAD_SIGNAL, "bad signal")\
- DEF(ATMERR_BADCU, -29-UNIAPI_ERROR_BADCU, "bad coordinator state")\
- DEF(ATMERR_BAD_CALLSTATE, -29-UNIAPI_ERROR_BAD_CALLSTATE, "bad call state")\
- DEF(ATMERR_BAD_EPSTATE, -29-UNIAPI_ERROR_BAD_EPSTATE, "bad party state")\
- DEF(ATMERR_BAD_UNIARG, -29-UNIAPI_ERROR_BAD_ARG, "bad uni argument")\
- DEF(ATMERR_BAD_CALL, -29-UNIAPI_ERROR_BAD_CALL, "unknown call")\
- DEF(ATMERR_BAD_PARTY, -29-UNIAPI_ERROR_BAD_PARTY, "unknown party")\
- DEF(ATMERR_BAD_CTYPE, -29-UNIAPI_ERROR_BAD_CTYPE, "wrong call type")\
- DEF(ATMERR_BAD_IE, -29-UNIAPI_ERROR_BAD_IE, "bad information element")\
- DEF(ATMERR_EPREF_INUSE, -29-UNIAPI_ERROR_EPREF_INUSE, "endpoint reference in use")\
- DEF(ATMERR_MISSING_IE, -29-UNIAPI_ERROR_MISSING_IE, "missing information element")\
- DEF(ATMERR_ENCODING, -29-UNIAPI_ERROR_ENCODING, "encoding error")\
- DEF(ATMERR_NOMEM, -29-UNIAPI_ERROR_NOMEM, "no memory")\
- DEF(ATMERR_UNIBUSY, -29-UNIAPI_ERROR_BUSY, "uni process busy")
-
-#define ATM_MKUNIERR(E) (-29 - (E))
-
-enum atm_error {
-#define DEF(NAME,VAL,STR) NAME = (VAL),
-ATM_DEFINE_ERRORS
-#undef DEF
-};
-
-enum atm_attribute {
- ATM_ATTR_NONE = 0,
- ATM_ATTR_BLLI_SELECTOR,
- ATM_ATTR_BLLI,
- ATM_ATTR_BEARER,
- ATM_ATTR_TRAFFIC,
- ATM_ATTR_QOS,
- ATM_ATTR_EXQOS,
- ATM_ATTR_CALLED,
- ATM_ATTR_CALLEDSUB,
- ATM_ATTR_CALLING,
- ATM_ATTR_CALLINGSUB,
- ATM_ATTR_AAL,
- ATM_ATTR_EPREF,
- ATM_ATTR_CONNED,
- ATM_ATTR_CONNEDSUB,
- ATM_ATTR_EETD,
- ATM_ATTR_ABRSETUP,
- ATM_ATTR_ABRADD,
- ATM_ATTR_CONNID,
- ATM_ATTR_MDCR,
-};
-
-struct atm_resp {
- int32_t resp;
- uint32_t data; /* type of attached data */
-};
-enum {
- ATMRESP_NONE, /* no data */
- ATMRESP_ATTRS, /* attribute(s) */
- ATMRESP_PORTS, /* port info */
- ATMRESP_STATE, /* endpoint state */
- ATMRESP_EXSTAT, /* extended status */
-};
-
-struct atm_abort_connection {
- struct uni_ie_cause cause;
-};
-
-struct atm_query_connection_attributes {
- uint32_t attr;
-};
-struct atm_set_connection_attributes {
- uint32_t attr;
-};
-struct atm_query_connection_attributes_x {
- uint32_t count;
-#if defined(__GNUC__) && __GNUC__ < 3
- uint32_t attr[0];
-#else
- uint32_t attr[];
-#endif
-};
-struct atm_set_connection_attributes_x {
- uint32_t count;
-#if defined(__GNUC__) && __GNUC__ < 3
- uint32_t attr[0];
-#else
- uint32_t attr[];
-#endif
-};
-struct atm_prepare_incoming_call {
- struct uni_sap sap;
- uint32_t queue_size;
-};
-struct atm_connect_outgoing_call {
- struct uni_ie_called called;
-};
-struct atm_call_release {
- struct uni_ie_cause cause[2];
-};
-struct atm_p2p_call_active {
- struct uni_ie_connid connid;
-};
-struct atm_p2mp_call_active {
- struct uni_ie_connid connid;
-};
-struct atm_accept_incoming_call {
- char newep[ATM_EPNAMSIZ];
-};
-struct atm_reject_incoming_call {
- struct uni_ie_cause cause;
-};
-struct atm_add_party {
- uint16_t leaf_ident;
- struct uni_ie_called called;
-};
-struct atm_add_party_success {
- uint16_t leaf_ident;
-};
-struct atm_add_party_reject {
- uint16_t leaf_ident;
- struct uni_ie_cause cause;
-};
-struct atm_drop_party {
- uint16_t leaf_ident;
- struct uni_ie_cause cause;
-};
-
-/*
- * Get local port info. If port is 0, information on all ports is returned,
- * otherwise only on the named port.
- * The response consists of a header with two counters, a list of ports
- * (struct atm_port_info) and a list of addresses (struct uni_addr).
- * The port to which an address belongs is implicit in the num_addrs field
- * of the port.
- */
-struct atm_get_local_port_info {
- uint32_t port;
-};
-
-struct atm_port_list {
- uint32_t num_ports; /* number of ports */
- uint32_t num_addrs; /* total number of addresses */
-};
-
-struct atm_port_info {
- uint32_t port;
- uint32_t pcr;
- uint32_t max_vpi_bits;
- uint32_t max_vci_bits;
- uint32_t max_svpc_vpi;
- uint32_t max_svcc_vpi;
- uint32_t min_svcc_vci;
- u_char esi[6];
- uint32_t num_addrs; /* number of addresses on this port */
-};
-
-/*
- * Endpoint state info
- */
-struct atm_epstate {
- char name[ATM_EPNAMSIZ];
- uint8_t state;
-};
-
-/*
- * Extended status information.
- */
-struct atm_exstatus {
- uint32_t neps; /* endpoints */
- uint32_t nports; /* ports */
- uint32_t nconns; /* connections */
- uint32_t nparties; /* number of parties */
-};
-struct atm_exstatus_ep {
- char name[ATM_EPNAMSIZ];
- uint8_t state; /* Ux */
-};
-struct atm_exstatus_port {
- uint32_t portno;
- uint8_t state;
-};
-struct atm_exstatus_conn {
- uint32_t id;
- uint32_t cref; /* (flag << 23) | cref */
- uint32_t port;
- char ep[ATM_EPNAMSIZ]; /* \0 - none */
- uint8_t state; /* Cx */
-};
-struct atm_exstatus_party {
- uint32_t connid;
- uint16_t epref;
- uint8_t state; /* Px */
-};
-#endif
diff --git a/sys/contrib/ngatm/netnatm/api/cc_conn.c b/sys/contrib/ngatm/netnatm/api/cc_conn.c
deleted file mode 100644
index 3350e2cb3806..000000000000
--- a/sys/contrib/ngatm/netnatm/api/cc_conn.c
+++ /dev/null
@@ -1,2096 +0,0 @@
-/*
- * Copyright (c) 2003-2007
- * Hartmut Brandt
- * All rights reserved.
- *
- * Copyright (c) 2001-2002
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution of this software and documentation and use in source and
- * binary forms, with or without modification, are permitted provided that
- * the following conditions are met:
- *
- * 1. Redistributions of source code or documentation must retain the above
- * copyright notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
- * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: cc_conn.c 1291 2007-07-10 10:35:38Z brandt_h $
- *
- * ATM API as defined per af-saa-0108
- *
- * Lower half - connection handling
- */
-#include <netnatm/unimsg.h>
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/msg/unimsglib.h>
-#include <netnatm/api/unisap.h>
-#include <netnatm/sig/unidef.h>
-#include <netnatm/api/atmapi.h>
-#include <netnatm/api/ccatm.h>
-#include <netnatm/api/ccpriv.h>
-
-static const char *stab[] = {
-#define DEF(N) [N] = #N,
- CONN_STATES
-#undef DEF
-};
-
-static const char *ptab[] = {
-#define DEF(N) [PARTY_##N] = #N,
- PARTY_STATES
-#undef DEF
-};
-
-const char *
-cc_conn_state2str(u_int s)
-{
- if (s >= sizeof(stab) / sizeof(stab[0]) || stab[s] == NULL)
- return ("?");
- return (stab[s]);
-}
-
-void
-cc_conn_set_state(struct ccconn *conn, enum conn_state ns)
-{
- if (conn->state != ns) {
- if (conn->cc->log & CCLOG_CONN_STATE)
- cc_conn_log(conn, "%s -> %s",
- stab[conn->state], stab[ns]);
- conn->state = ns;
- }
-}
-
-const char *
-cc_party_state2str(u_int s)
-{
- if (s >= sizeof(ptab) / sizeof(ptab[0]) || ptab[s] == NULL)
- return ("?");
- return (ptab[s]);
-}
-
-void
-cc_party_set_state(struct ccparty *party, enum party_state ns)
-{
-
- if (party->state != ns) {
- if (party->conn->cc->log & CCLOG_PARTY_STATE)
- cc_party_log(party, "%s -> %s",
- ptab[party->state], ptab[ns]);
- party->state = ns;
- }
-}
-
-/*
- * Remove connection from its user's queue
- */
-void
-cc_disconnect_from_user(struct ccconn *conn)
-{
-
- if (conn->user == NULL)
- cc_conn_log(conn, "no %s", "user");
- else {
- TAILQ_REMOVE(&conn->user->connq, conn, connq_link);
- conn->user->queue_act--;
- conn->user = NULL;
- }
-}
-
-/*
- * Put connection on user queue
- */
-void
-cc_connect_to_user(struct ccconn *conn, struct ccuser *user)
-{
-
- if (conn->user != NULL)
- cc_conn_log(conn, "still connected to %p", conn->user);
- conn->user = user;
- TAILQ_INSERT_TAIL(&user->connq, conn, connq_link);
- conn->user->queue_act++;
-}
-
-/*
- * Send a signal to the UNI stack for this connection
- */
-static void
-cc_send_uni(struct ccconn *conn, u_int op, struct uni_msg *msg)
-{
- struct ccreq *r;
-
- r = CCZALLOC(sizeof(*r));
- if (r == NULL) {
- if (msg != NULL)
- uni_msg_destroy(msg);
- cc_conn_log(conn, "no memory for cookie op=%u", op);
- return;
- }
-
- if ((r->cookie = ++conn->port->cc->cookie) == 0)
- r->cookie = ++conn->port->cc->cookie;
- r->req = op;
- r->conn = conn;
-
- TAILQ_INSERT_TAIL(&conn->port->cookies, r, link);
-
- conn->port->cc->funcs->send_uni(conn, conn->port->uarg, op,
- r->cookie, msg);
-}
-
-/*
- * Send a RELEASE.request for this connection.
- */
-static void
-do_release_request(struct ccconn *conn, const struct uni_ie_cause cause[2])
-{
- struct uni_msg *u;
- struct uniapi_release_request *req;
-
- if ((u = uni_msg_alloc(sizeof(*req))) == NULL)
- return;
- req = uni_msg_wptr(u, struct uniapi_release_request *);
- memset(req, 0, sizeof(*req));
- u->b_wptr += sizeof(struct uniapi_release_request);
-
- req->release.hdr.cref = conn->cref;
- req->release.hdr.act = UNI_MSGACT_DEFAULT;
-
- if (cause == NULL) {
- IE_SETPRESENT(req->release.cause[0]);
- req->release.cause[0].h.act = UNI_IEACT_DEFAULT;
- req->release.cause[0].loc = UNI_CAUSE_LOC_USER;
- req->release.cause[0].cause = UNI_CAUSE_UNSPEC;
- } else {
- req->release.cause[0] = cause[0];
- req->release.cause[1] = cause[1];
- }
-
- cc_send_uni(conn, UNIAPI_RELEASE_request, u);
-}
-
-/*
- * Make a RELEASE.response for this connection
- */
-static void
-do_release_response(struct ccconn *conn, uint8_t cause, struct uni_ie_cause *ie)
-{
- struct uni_msg *u;
- struct uniapi_release_response *resp;
-
- if ((u = uni_msg_alloc(sizeof(*resp))) == NULL)
- return;
- resp = uni_msg_wptr(u, struct uniapi_release_response *);
- memset(resp, 0, sizeof(*resp));
- u->b_wptr += sizeof(struct uniapi_release_response);
-
- resp->release_compl.hdr.cref = conn->cref;
- resp->release_compl.hdr.act = UNI_MSGACT_DEFAULT;
-
- if (ie != NULL)
- resp->release_compl.cause[0] = *ie;
-
- if (cause != 0) {
- IE_SETPRESENT(resp->release_compl.cause[0]);
- resp->release_compl.cause[0].h.act = UNI_IEACT_DEFAULT;
- resp->release_compl.cause[0].loc = UNI_CAUSE_LOC_USER;
- resp->release_compl.cause[0].cause = cause;
- }
-
- cc_send_uni(conn, UNIAPI_RELEASE_response, u);
-}
-
-/**********************************************************************
- *
- * INSTANCE handling
- */
-struct ccconn *
-cc_conn_create(struct ccdata *cc)
-{
- struct ccconn *conn;
-
- conn = CCZALLOC(sizeof(*conn));
- if (conn == NULL)
- return (NULL);
-
- conn->state = CONN_NULL;
- conn->port = NULL;
- conn->cc = cc;
- LIST_INIT(&conn->parties);
-
- LIST_INSERT_HEAD(&cc->orphaned_conns, conn, port_link);
-
- if (conn->cc->log & CCLOG_CONN_INST)
- cc_conn_log(conn, "created %s", "orphaned");
-
- return (conn);
-}
-
-/*
- * assign to port
- */
-void
-cc_conn_ins_port(struct ccconn *conn, struct ccport *port)
-{
-
- if (conn->port != NULL) {
- cc_conn_log(conn, "conn is already on port %u",
- conn->port->param.port);
- cc_conn_rem_port(conn);
- }
- LIST_REMOVE(conn, port_link);
-
- conn->port = port;
- LIST_INSERT_HEAD(&port->conn_list, conn, port_link);
-
-}
-
-/*
- * remove from port
- */
-void
-cc_conn_rem_port(struct ccconn *conn)
-{
-
- if (conn->port == NULL) {
- cc_conn_log(conn, "conn not on any %s", "port");
- return;
- }
- LIST_REMOVE(conn, port_link);
- conn->port = NULL;
- LIST_INSERT_HEAD(&conn->cc->orphaned_conns, conn, port_link);
-}
-
-static void
-cc_conn_flush_cookies(struct ccconn *conn)
-{
- struct ccreq *r, *r1;
-
- if (conn->port == NULL)
- return;
- TAILQ_FOREACH_SAFE(r, &conn->port->cookies, link, r1) {
- if (r->conn == conn) {
- TAILQ_REMOVE(&conn->port->cookies, r, link);
- CCFREE(r);
- }
- }
-}
-
-void
-cc_conn_reset_acceptor(struct ccconn *conn)
-{
- if (conn->acceptor != NULL) {
- conn->acceptor->accepted = NULL;
- conn->acceptor = NULL;
- }
-}
-
-/*
- * Destroy a connection
- */
-void
-cc_conn_destroy(struct ccconn *conn)
-{
- struct ccparty *p;
-
- if (conn->cc->log & CCLOG_CONN_INST)
- cc_conn_log(conn, "destroy%s", "");
-
- if (conn->user != NULL) {
- cc_conn_log(conn, "still connected to user %p\n", conn->user);
- conn->user->queue_act--;
- TAILQ_REMOVE(&conn->user->connq, conn, connq_link);
- }
-
- if (conn->acceptor != NULL)
- conn->acceptor->accepted = NULL;
-
- cc_conn_flush_cookies(conn);
- cc_conn_sig_flush(conn);
-
- LIST_REMOVE(conn, port_link);
- while ((p = LIST_FIRST(&conn->parties)) != NULL) {
- LIST_REMOVE(p, link);
- CCFREE(p);
- }
-
- CCFREE(conn);
-}
-
-struct ccparty *
-cc_party_create(struct ccconn *conn, u_int ident, u_int flag)
-{
- struct ccparty *party;
-
- party = CCZALLOC(sizeof(*party));
- if (party == NULL)
- return (NULL);
-
- party->conn = conn;
- party->state = PARTY_NULL;
- IE_SETPRESENT(party->epref);
- party->epref.flag = flag;
- party->epref.epref = ident;
- LIST_INSERT_HEAD(&conn->parties, party, link);
-
- if (party->conn->cc->log & CCLOG_PARTY_INST)
- cc_party_log(party, "created %u.%u", flag, ident);
-
- return (party);
-}
-
-static void
-cc_party_destroy(struct ccparty *party)
-{
-
- if (party->conn->cc->log & CCLOG_PARTY_INST)
- cc_party_log(party, "destroyed %u.%u", party->epref.flag,
- party->epref.epref);
-
- LIST_REMOVE(party, link);
- CCFREE(party);
-}
-
-static struct ccparty *
-cc_party_find(struct ccconn *conn, u_int ident)
-{
- struct ccparty *party;
-
- LIST_FOREACH(party, &conn->parties, link)
- if (party->epref.epref == ident)
- return (party);
- return (NULL);
-}
-/*
- * Abort connection from down stream (because of the UNI hook beeing
- * disconnected). This is called from two places:
- * 1) the shutdown code.
- * In this case the connections should be already dissociated from
- * users and be only in states waiting for the UNI stack.
- * 2) from the disconnect code.
- */
-void
-cc_conn_abort(struct ccconn *conn, int shutdown)
-{
- struct ccuser *u = conn->user;
- struct ccparty *p, *p1;
-
- if (shutdown) {
- CCASSERT(u == NULL, ("still in use"));
- CCASSERT(conn->acceptor == NULL, ("still in use"));
- cc_conn_destroy(conn);
- return;
- }
-
- /*
- * Look whether any parties are blocked waiting for a response
- * from the stack. We don't use extra party states to handle
- * user aborts, so check that there is a user before using it.
- */
- if (u == NULL) {
- while ((p = LIST_FIRST(&conn->parties)) != NULL)
- cc_party_destroy(p);
- } else {
- LIST_FOREACH_SAFE(p, &conn->parties, link, p1) {
- switch (p->state) {
-
- case PARTY_NULL: /* P0 */
- /* should not happen */
- goto dpty;
-
- case PARTY_ACTIVE: /* P1 */
- /* don't send a drop - user'll get a rel */
- goto dpty;
-
- case PARTY_ADD_WAIT_CREATE: /* P2 */
- case PARTY_ADD_WAIT_OK: /* P3 */
- /* we're adding - synthesise an error */
- cc_user_sig(u, USER_SIG_ADD_PARTY_ERR,
- NULL, ATMERR_BAD_PORT);
- goto dpty;
-
- case PARTY_ADD_WAIT_ACK: /* P4 */
- /* don't send a drop - user'll get a rel */
- goto dpty;
-
- case PARTY_DROP_WAIT_OK: /* P5 */
- case PARTY_DROP_WAIT_ACK: /* P6 */
- case PARTY_ADD_DROP_WAIT_OK: /* P11 */
- /* we're dropping - synthesis an ok */
- cc_user_sig(u, USER_SIG_DROP_PARTY_OK,
- NULL, p->epref.epref);
- goto dpty;
-
- case PARTY_WAIT_DESTROY: /* P7 */
- goto dpty;
-
- case PARTY_WAIT_SETUP_COMPL: /* P8 */
- case PARTY_WAIT_SETUP_CONF: /* P10 */
- /* first party - nothing to do */
- goto dpty;
-
- case PARTY_WAIT_DROP_ACK_OK: /* P9 */
- case PARTY_ADD_DROPACK_WAIT_OK:/* P12 */
- /* we're dropping - nothing to do */
- goto dpty;
- }
- cc_party_log(p, "bad uabort for party in state %s",
- ptab[p->state]);
- dpty:
- cc_party_destroy(p);
- }
- }
-
- /*
- * Now do what the connection needs
- */
- switch (conn->state) {
-
- case CONN_NULL: /* 0 */
- case CONN_OUT_PREPARING: /* 1 */
- /* may not happen because we're not associated with
- * aport yet */
- break;
-
- case CONN_OUT_WAIT_CREATE: /* 2 */
- case CONN_OUT_WAIT_OK: /* 3 */
- case CONN_OUT_WAIT_DESTROY: /* 37 */
- /* return an error to the user, go back to C1/U1
- * reset cref (for C37, C3) and cookie */
- conn->cref.flag = 0;
- conn->cref.cref = 0;
- cc_conn_flush_cookies(conn);
- cc_conn_set_state(conn, CONN_OUT_PREPARING);
- cc_conn_rem_port(conn);
- cc_user_sig(u, USER_SIG_CONNECT_OUTGOING_ERR,
- NULL, ATMERR_BAD_PORT);
- return;
-
- case CONN_OUT_WAIT_CONF: /* 4 */
- case CONN_ACTIVE: /* 5 */
- case CONN_IN_WAIT_COMPL: /* 13 */
- /* emulate a RELEASE.confirm */
- memset(&u->cause, 0, sizeof(u->cause));
- cc_user_sig(u, USER_SIG_RELEASE_CONFIRM, NULL, 0);
- cc_disconnect_from_user(conn);
- cc_conn_destroy(conn);
- return;
-
- case CONN_IN_PREPARING: /* 10 */
- case CONN_AB_WAIT_REQ_OK: /* 33 */
- case CONN_AB_WAIT_RESP_OK: /* 34 */
- case CONN_AB_FLUSH_IND: /* 35 */
- /* no user - destroy */
- cc_conn_destroy(conn);
- return;
-
- case CONN_IN_ARRIVED: /* 11 */
- u->aborted = 1;
- cc_disconnect_from_user(conn);
- cc_conn_destroy(conn);
- return;
-
- case CONN_IN_WAIT_ACCEPT_OK: /* 12 */
- /* return ACCEPT error */
- cc_disconnect_from_user(conn);
- cc_conn_reset_acceptor(conn);
- cc_user_sig(u, USER_SIG_ACCEPT_ERR,
- u, ATMERR_PREVIOUSLY_ABORTED);
- cc_conn_destroy(conn);
- return;
-
- case CONN_REJ_WAIT_OK: /* 14 */
- /* return REJECT ok */
- cc_disconnect_from_user(conn);
- cc_conn_destroy(conn);
- cc_user_sig(u, USER_SIG_REJECT_OK, NULL, 0);
- return;
-
- case CONN_REL_IN_WAIT_OK: /* 15 */
- case CONN_REL_WAIT_OK: /* 20 */
- /* confirm destroy */
- if (u != NULL) {
- /* connection not aborted */
- memset(&u->cause, 0, sizeof(u->cause));
- cc_user_sig(u, USER_SIG_RELEASE_CONFIRM, NULL, 0);
- cc_disconnect_from_user(conn);
- }
- cc_conn_destroy(conn);
- return;
-
- case CONN_IN_WAITING: /* 21 */
- /* user has not seen the connection - destroy */
- cc_disconnect_from_user(conn);
- cc_conn_destroy(conn);
- return;
- }
- cc_conn_log(conn, "bad state %s", stab[conn->state]);
-}
-
-#ifdef DEBUG_MATCH
-static void
-print_sap(const struct uni_sap *sap)
-{
- static const char *const tags[] = {
- [UNISVE_ABSENT] "absent",
- [UNISVE_PRESENT]"present",
- [UNISVE_ANY] "any",
- };
- u_int i;
-
- printf("addr={%s", tags[sap->addr.tag]);
- if (sap->addr.tag == UNISVE_PRESENT) {
- printf(",%d-%d", sap->addr.type, sap->addr.plan);
- for (i = 0; i < sap->addr.len; i++)
- printf("%c%02x", ",:"[i!=0], sap->addr.addr[i]);
- }
- printf("}\n");
-
- printf("selector={%s", tags[sap->selector.tag]);
- if (sap->selector.tag == UNISVE_PRESENT)
- printf(",%02x", sap->selector.selector);
- printf("}\n");
-
- printf("blli_id2={%s", tags[sap->blli_id2.tag]);
- if (sap->blli_id2.tag == UNISVE_PRESENT)
- printf(",%02x,%02x", sap->blli_id2.proto, sap->blli_id2.user);
- printf("}\n");
-
- printf("blli_id3={%s", tags[sap->blli_id3.tag]);
- if (sap->blli_id3.tag == UNISVE_PRESENT)
- printf(",%02x,%02x,%02x,%06x,%04x,%d",
- sap->blli_id3.proto, sap->blli_id3.user,
- sap->blli_id3.ipi, sap->blli_id3.oui,
- sap->blli_id3.pid, sap->blli_id3.noipi);
- printf("}\n");
-
- printf("bhli={%s", tags[sap->bhli.tag]);
- if (sap->bhli.tag == UNISVE_PRESENT) {
- printf(",%d", sap->bhli.type);
- for (i = 0; i < sap->bhli.len; i++)
- printf("%c%02x", ",:"[i!=0], sap->bhli.info[i]);
- }
- printf("}\n");
-}
-#endif
-
-/*********************************************************************
- *
- * DISPATCH incoming call
- */
-void
-cc_conn_dispatch(struct ccconn *conn)
-{
- struct ccdata *priv = conn->port->cc;
- struct ccuser *user;
- u_int blli_index;
-
-#ifdef DEBUG_MATCH
- static char buf[1000];
- static struct unicx cx;
- static int init = 1;
-
- if (init) {
- uni_initcx(&cx);
- init = 0;
- }
-#endif
-
- /*
- * Do call dispatching according to 4.6
- */
-#ifdef DEBUG_MATCH
- printf("+++++ DISPATCH++++++\n");
-#endif
- for (blli_index = 0; blli_index < UNI_NUM_IE_BLLI; blli_index++) {
- if (blli_index > 0 && !IE_ISGOOD(conn->blli[blli_index]))
- break;
-#ifdef DEBUG_MATCH
- if (IE_ISPRESENT(conn->called)) {
- uni_print_ie(buf, sizeof(buf), UNI_IE_CALLED,
- (union uni_ieall *)&conn->called, &cx);
- printf("called=%s\n", buf);
- }
- if (IE_ISPRESENT(conn->bhli)) {
- uni_print_ie(buf, sizeof(buf), UNI_IE_BHLI,
- (union uni_ieall *)&conn->bhli, &cx);
- printf("bhli=%s\n", buf);
- }
- if (IE_ISPRESENT(conn->blli[blli_index])) {
- uni_print_ie(buf, sizeof(buf), UNI_IE_BLLI,
- (union uni_ieall *)&conn->blli[blli_index], &cx);
- printf("%s\n", buf);
- }
-#endif
- LIST_FOREACH(user, &priv->user_list, node_link) {
- if ((user->state == USER_IN_WAITING ||
- user->state == USER_IN_ARRIVED ||
- user->state == USER_IN_WAIT_ACC ||
- user->state == USER_IN_WAIT_REJ) &&
- !unisve_is_catchall(user->sap)) {
-#ifdef DEBUG_MATCH
- printf("TRYING user=%p\n", user);
- print_sap(user->sap);
-#endif
- if (unisve_match(user->sap, &conn->called,
- &conn->blli[blli_index], &conn->bhli))
- goto found;
- }
- }
- }
-#ifdef DEBUG_MATCH
- printf("TRYING CATCHALL\n");
-#endif
- blli_index = 0;
- LIST_FOREACH(user, &priv->user_list, node_link) {
- if ((user->state == USER_IN_WAITING ||
- user->state == USER_IN_ARRIVED ||
- user->state == USER_IN_WAIT_ACC ||
- user->state == USER_IN_WAIT_REJ) &&
- unisve_is_catchall(user->sap))
- goto found;
- }
-#ifdef DEBUG_MATCH
- printf("SORRY\n");
-#endif
-
- /*
- * No application found - reject call.
- */
- do_release_response(conn, UNI_CAUSE_INCOMP, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- return;
-
- found:
-#ifdef DEBUG_MATCH
- printf("MATCH\n");
-#endif
- if (user->queue_max == user->queue_act) {
- do_release_response(conn, UNI_CAUSE_BUSY, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- return;
- }
-
- if (blli_index == 0 && !IE_ISGOOD(conn->blli[blli_index]))
- conn->blli_selector = 0;
- else
- conn->blli_selector = blli_index + 1;
-
- cc_conn_set_state(conn, CONN_IN_WAITING);
- cc_connect_to_user(conn, user);
-
- cc_user_sig(user, USER_SIG_SETUP_IND, NULL, 0);
-}
-
-static void
-cc_party_setup_conf(struct ccconn *conn)
-{
- struct ccparty *party;
-
- party = cc_party_find(conn, conn->epref.epref);
- if (party == NULL) {
- cc_party_log(party, "no party for %s",
- cc_conn_sigtab[CONN_SIG_SETUP_CONFIRM]);
- return;
- }
- if (party->state != PARTY_WAIT_SETUP_CONF) {
- cc_party_log(party, "bad state=%s for signal=%s",
- ptab[party->state], cc_conn_sigtab[CONN_SIG_SETUP_CONFIRM]);
- return;
- }
- cc_party_set_state(party, PARTY_ACTIVE);
-}
-
-static void
-cc_party_add_ack_ind(struct ccconn *conn, const struct uni_ie_epref *epref)
-{
- struct ccparty *party;
-
- party = cc_party_find(conn, epref->epref);
- if (party == NULL) {
- cc_party_log(party, "no party for %s",
- cc_conn_sigtab[CONN_SIG_PARTY_ADD_ACK_IND]);
- }
- if (party->state != PARTY_ADD_WAIT_ACK) {
- cc_party_log(party, "bad state=%s for signal=%s",
- ptab[party->state],
- cc_conn_sigtab[CONN_SIG_PARTY_ADD_ACK_IND]);
- return;
- }
- cc_party_set_state(party, PARTY_ACTIVE);
- cc_user_sig(conn->user, USER_SIG_ADD_PARTY_ACK,
- NULL, epref->epref);
-}
-
-static void
-cc_party_add_rej_ind(struct ccconn *conn, const struct uni_ie_epref *epref)
-{
- struct ccparty *party;
-
- party = cc_party_find(conn, epref->epref);
- if (party == NULL) {
- cc_party_log(party, "no party for %s",
- cc_conn_sigtab[CONN_SIG_PARTY_ADD_REJ_IND]);
- return;
- }
- if (party->state != PARTY_ADD_WAIT_ACK) {
- cc_party_log(party, "bad state=%s for signal=%s",
- ptab[party->state],
- cc_conn_sigtab[CONN_SIG_PARTY_ADD_REJ_IND]);
- return;
- }
- cc_party_set_state(party, PARTY_WAIT_DESTROY);
- cc_user_sig(conn->user, USER_SIG_ADD_PARTY_REJ, NULL, epref->epref);
-}
-
-static void
-cc_party_drop_ack_ind(struct ccconn *conn,
- const struct uni_drop_party *drop)
-{
- struct ccparty *party;
-
- party = cc_party_find(conn, drop->epref.epref);
- if (party == NULL) {
- cc_party_log(party, "no party for %s",
- cc_conn_sigtab[CONN_SIG_DROP_PARTY_ACK_IND]);
- return;
- }
- switch (party->state) {
-
- case PARTY_ACTIVE: /* P1 */
- memset(&conn->user->cause[1], 0, sizeof(conn->user->cause[1]));
- conn->user->cause[0] = drop->cause;
- cc_party_set_state(party, PARTY_WAIT_DESTROY);
- cc_user_sig(conn->user, USER_SIG_DROP_PARTY_IND,
- NULL, party->epref.epref);
- break;
-
- case PARTY_ADD_WAIT_ACK: /* P4 */
- memset(&conn->user->cause[1], 0, sizeof(conn->user->cause[1]));
- conn->user->cause[0] = drop->cause;
- cc_party_set_state(party, PARTY_WAIT_DESTROY);
- cc_user_sig(conn->user, USER_SIG_ADD_PARTY_REJ,
- NULL, party->epref.epref);
- break;
-
- case PARTY_DROP_WAIT_ACK: /* P6 */
- cc_party_set_state(party, PARTY_WAIT_DESTROY);
- cc_user_sig(conn->user, USER_SIG_DROP_PARTY_OK, NULL, 0);
- break;
-
- case PARTY_WAIT_SETUP_COMPL: /* P8 */
- case PARTY_WAIT_SETUP_CONF: /* P10 */
- cc_party_set_state(party, PARTY_WAIT_DESTROY);
- break;
-
- default:
- cc_party_log(party, "bad state=%s for signal=%s",
- ptab[party->state],
- cc_conn_sigtab[CONN_SIG_DROP_PARTY_ACK_IND]);
- break;
- }
-}
-
-/*
- * Handle a signal to this connection
- */
-void
-cc_conn_sig_handle(struct ccconn *conn, enum conn_sig sig,
- void *arg, u_int iarg)
-{
- struct ccparty *party;
-
- if (conn->cc->log & CCLOG_CONN_SIG)
- cc_conn_log(conn, "signal %s in state %s", cc_conn_sigtab[sig],
- stab[conn->state]);
-
- switch (sig) {
-
- case CONN_SIG_CONNECT_OUTGOING:
- /* Do SETUP */
- {
- struct uni_msg *u;
- struct uniapi_setup_request *setup;
-
- if (conn->state != CONN_OUT_PREPARING)
- goto bad_state;
-
- if (IE_ISGOOD(conn->bearer) &&
- conn->bearer.cfg == UNI_BEARER_MP) {
- IE_SETPRESENT(conn->epref);
- conn->epref.flag = 0;
- conn->epref.epref = 0;
- }
-
- /*
- * Construct message to UNI.
- */
- u = uni_msg_alloc(sizeof(struct uniapi_setup_request));
- if (u == NULL) {
- cc_user_sig(conn->user, USER_SIG_CONNECT_OUTGOING_ERR,
- NULL, ATMERR_NOMEM);
- return;
- }
- setup = uni_msg_wptr(u, struct uniapi_setup_request *);
- memset(setup, 0, sizeof(*setup));
- u->b_wptr += sizeof(struct uniapi_setup_request);
-
- setup->setup.hdr.act = UNI_MSGACT_DEFAULT;
- memcpy(setup->setup.blli, conn->blli, sizeof(conn->blli));
- setup->setup.bearer = conn->bearer;
- setup->setup.traffic = conn->traffic;
- setup->setup.qos = conn->qos;
- setup->setup.exqos = conn->exqos;
- setup->setup.called = conn->called;
- setup->setup.calledsub[0] = conn->calledsub;
- setup->setup.aal = conn->aal;
- setup->setup.epref = conn->epref;
- setup->setup.eetd = conn->eetd;
- setup->setup.abrsetup = conn->abrsetup;
- setup->setup.abradd = conn->abradd;
- setup->setup.calling = conn->calling;
- setup->setup.callingsub[0] = conn->callingsub;
- setup->setup.connid = conn->connid;
- memcpy(setup->setup.tns, conn->tns, sizeof(conn->tns));
- setup->setup.atraffic = conn->atraffic;
- setup->setup.mintraffic = conn->mintraffic;
- setup->setup.cscope = conn->cscope;
- setup->setup.bhli = conn->bhli;
- setup->setup.mdcr = conn->mdcr;
-
- cc_conn_set_state(conn, CONN_OUT_WAIT_CREATE);
- cc_send_uni(conn, UNIAPI_SETUP_request, u);
-
- break;
- }
-
-
- case CONN_SIG_ARRIVAL:
- /* user informed of arrival of this call */
- if (conn->state != CONN_IN_WAITING)
- goto bad_state;
- cc_conn_set_state(conn, CONN_IN_ARRIVED);
- break;
-
-
- case CONN_SIG_RELEASE:
- {
- /* Release this call */
- struct uni_msg *u;
- struct uniapi_release_request *req;
-
- if (conn->state != CONN_ACTIVE &&
- conn->state != CONN_IN_WAIT_COMPL)
- goto bad_state;
-
- if ((u = uni_msg_alloc(sizeof(*req))) == NULL)
- return;
-
- req = uni_msg_wptr(u, struct uniapi_release_request *);
- memset(req, 0, sizeof(*req));
- u->b_wptr += sizeof(struct uniapi_release_request);
-
- req->release.hdr.cref = conn->cref;
- req->release.hdr.act = UNI_MSGACT_DEFAULT;
-
- req->release.cause[0] = conn->cause[0];
- req->release.cause[1] = conn->cause[1];
-
- if (conn->state == CONN_ACTIVE)
- cc_conn_set_state(conn, CONN_REL_WAIT_OK);
- else
- cc_conn_set_state(conn, CONN_REL_IN_WAIT_OK);
-
- cc_send_uni(conn, UNIAPI_RELEASE_request, u);
- break;
- }
-
- case CONN_SIG_REJECT:
- {
- /* reject from user */
- struct ccuser *user = conn->user;
-
- if (conn->state != CONN_IN_ARRIVED) {
- cc_user_sig(user, USER_SIG_REJECT_ERR,
- NULL, ATMERR_BAD_STATE);
- break;
- }
- cc_conn_set_state(conn, CONN_REJ_WAIT_OK);
- do_release_response(conn, 0, conn->cause);
- break;
- }
-
-
- case CONN_SIG_ACCEPT:
- {
- /* User accepts. */
- struct ccuser *newep = arg;
- struct uni_msg *u;
- struct uniapi_setup_response *resp;
- struct ccuser *user = conn->user;
-
- if (conn->state != CONN_IN_ARRIVED) {
- cc_user_sig(user, USER_SIG_ACCEPT_ERR,
- NULL, ATMERR_PREVIOUSLY_ABORTED);
- break;
- }
-
- u = uni_msg_alloc(sizeof(struct uniapi_setup_response));
- if (u == NULL) {
- cc_user_sig(user, USER_SIG_ACCEPT_ERR,
- NULL, ATMERR_NOMEM);
- return;
- }
-
- /*
- * Link to the new endpoint
- */
- conn->acceptor = newep;
- newep->accepted = conn;
-
- /*
- * Construct connect message
- */
- resp = uni_msg_wptr(u, struct uniapi_setup_response *);
- memset(resp, 0, sizeof(*resp));
- u->b_wptr += sizeof(*resp);
-
- resp->connect.hdr.act = UNI_MSGACT_DEFAULT;
- resp->connect.hdr.cref = conn->cref;
-
- /*
- * attributes
- */
- if (conn->dirty_attr & CCDIRTY_AAL)
- resp->connect.aal = conn->aal;
- if (conn->dirty_attr & CCDIRTY_BLLI)
- resp->connect.blli =
- conn->blli[conn->blli_selector - 1];
- if (conn->dirty_attr & CCDIRTY_CONNID)
- resp->connect.connid = conn->connid;
- /* XXX NOTIFY */
- if (conn->dirty_attr & CCDIRTY_EETD)
- resp->connect.eetd = conn->eetd;
- /* XXX GIT */
- /* XXX UU */
- if (conn->dirty_attr & CCDIRTY_TRAFFIC)
- resp->connect.traffic = conn->traffic;
- if (conn->dirty_attr & CCDIRTY_EXQOS)
- resp->connect.exqos = conn->exqos;
- if (conn->dirty_attr & CCDIRTY_ABRSETUP)
- resp->connect.abrsetup = conn->abrsetup;
- if (conn->dirty_attr & CCDIRTY_ABRADD)
- resp->connect.abradd = conn->abradd;
-
- /*
- * If the SETUP had an endpoint reference - echo it back
- */
- if (IE_ISPRESENT(conn->epref)) {
- resp->connect.epref = conn->epref;
- resp->connect.epref.flag = !resp->connect.epref.flag;
- }
-
- cc_conn_set_state(conn, CONN_IN_WAIT_ACCEPT_OK);
- cc_send_uni(conn, UNIAPI_SETUP_response, u);
- break;
- }
-
-
- case CONN_SIG_ADD_PARTY:
- {
- /* request to add party from user */
- struct uni_msg *u;
- struct uniapi_add_party_request *req;
-
- if (conn->state != CONN_ACTIVE)
- goto bad_state;
-
- /* create the party */
- party = cc_party_create(conn, (u_int)(uintptr_t)arg, 0);
- if (party == NULL) {
- cc_user_sig(conn->user, USER_SIG_ADD_PARTY_ERR,
- NULL, ATMERR_NOMEM);
- return;
- }
- party->called = conn->called;
-
- /* Construct message to UNI. */
- u = uni_msg_alloc(sizeof(struct uniapi_setup_request));
- if (u == NULL) {
- cc_party_destroy(party);
- cc_user_sig(conn->user, USER_SIG_ADD_PARTY_ERR,
- NULL, ATMERR_NOMEM);
- return;
- }
-
- req = uni_msg_wptr(u, struct uniapi_add_party_request *);
- memset(req, 0, sizeof(*req));
- u->b_wptr += sizeof(struct uniapi_add_party_request);
-
- req->add.hdr.act = UNI_MSGACT_DEFAULT;
- req->add.hdr.cref = conn->cref;
- req->add.epref = party->epref;
- req->add.called = party->called;
-
- cc_party_set_state(party, PARTY_ADD_WAIT_CREATE);
- cc_send_uni(conn, UNIAPI_ADD_PARTY_request, u);
- break;
- }
-
-
- case CONN_SIG_DROP_PARTY:
- {
- /* user request to drop a party */
- struct uni_msg *u;
- struct uniapi_drop_party_request *req;
-
- if (conn->state != CONN_ACTIVE)
- goto bad_state;
-
- party = cc_party_find(conn, (u_int)(uintptr_t)arg);
- if (party == NULL) {
- cc_user_sig(conn->user, USER_SIG_DROP_PARTY_ERR,
- NULL, ATMERR_BAD_PARTY);
- return;
- }
-
- switch (party->state) {
-
- case PARTY_ACTIVE:
- case PARTY_ADD_WAIT_ACK:
- break;
-
- default:
- cc_user_sig(conn->user, USER_SIG_DROP_PARTY_ERR,
- NULL, ATMERR_BAD_STATE);
- return;
-
- }
- /*
- * Construct message to UNI.
- */
- u = uni_msg_alloc(sizeof(*req));
- if (u == NULL) {
- cc_user_sig(conn->user, USER_SIG_DROP_PARTY_ERR,
- NULL, ATMERR_NOMEM);
- return;
- }
-
- req = uni_msg_wptr(u, struct uniapi_drop_party_request *);
- memset(req, 0, sizeof(*req));
- u->b_wptr += sizeof(struct uniapi_drop_party_request);
-
- req->drop.hdr.act = UNI_MSGACT_DEFAULT;
- req->drop.hdr.cref = conn->cref;
- req->drop.epref = party->epref;
- req->drop.cause = conn->cause[0];
-
- if (party->state == PARTY_ACTIVE)
- cc_party_set_state(party, PARTY_DROP_WAIT_OK);
- else
- cc_party_set_state(party, PARTY_ADD_DROP_WAIT_OK);
- cc_send_uni(conn, UNIAPI_DROP_PARTY_request, u);
- break;
- }
-
- case CONN_SIG_DROP_PARTY_ACK_IND:
- {
- struct uni_msg *msg = arg;
- struct uniapi_drop_party_ack_indication *ind = uni_msg_rptr(msg,
- struct uniapi_drop_party_ack_indication *);
-
- cc_party_drop_ack_ind(conn, &ind->drop);
- break;
- }
-
-
- case CONN_SIG_USER_ABORT:
- /*
- * Aborting a connection. This is callable in all states.
- * The connection is already disconnected from the user.
- * The cause is in cause[].
- */
- switch (conn->state) {
-
- case CONN_NULL: /* C0 */
- case CONN_OUT_PREPARING: /* C1 */
- cc_conn_destroy(conn);
- break;
-
- case CONN_OUT_WAIT_CONF: /* C4 */
- case CONN_ACTIVE: /* C5 */
- do_release_request(conn, conn->cause);
- cc_conn_set_state(conn, CONN_AB_WAIT_REQ_OK);
- break;
-
- case CONN_IN_WAITING: /* C21 */
- /* that should not happen */
- goto bad_state;
- break;
-
- case CONN_IN_ARRIVED: /* C11 */
- /*
- * This is called only for the first connection
- * of the user - the others are re-dispatched.
- */
- do_release_response(conn, 0, conn->cause);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- break;
-
- case CONN_IN_WAIT_COMPL: /* C13 */
- do_release_request(conn, conn->cause);
- cc_conn_set_state(conn, CONN_AB_WAIT_REQ_OK);
- break;
-
- case CONN_OUT_WAIT_DESTROY: /* C20 */
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- break;
-
- case CONN_IN_WAIT_ACCEPT_OK: /* C12 */
- case CONN_AB_WAIT_REQ_OK: /* C33 */
- case CONN_AB_WAIT_RESP_OK: /* C34 */
- case CONN_AB_FLUSH_IND: /* C35 */
- /* just ignore */
- break;
-
- /*
- * The following states may not happen, because
- * we're waiting for a response from the UNI stack.
- * As soon as the response comes the ABORT is undefered
- * and will hit us (but in another state).
- */
- case CONN_OUT_WAIT_CREATE: /* C2 */
- case CONN_OUT_WAIT_OK: /* C3 */
- case CONN_IN_PREPARING: /* C10 */
- case CONN_REJ_WAIT_OK: /* C14 */
- case CONN_REL_IN_WAIT_OK: /* C15 */
- case CONN_REL_WAIT_OK: /* C20 */
- goto bad_state;
- }
- break;
-
-
- case CONN_SIG_CREATED:
- {
- /*
- * CALL_CREATED message from UNI. This can happen for either
- * incoming or outgoing connections.
- */
- struct uni_msg *msg = arg;
- struct uniapi_call_created *cr = uni_msg_rptr(msg,
- struct uniapi_call_created *);
-
- switch (conn->state) {
-
- case CONN_OUT_WAIT_CREATE:
- conn->cref = cr->cref;
- cc_conn_set_state(conn, CONN_OUT_WAIT_OK);
- break;
-
- case CONN_NULL:
- conn->cref = cr->cref;
- cc_conn_set_state(conn, CONN_IN_PREPARING);
- break;
-
- default:
- goto bad_state;
- }
- break;
- }
-
- case CONN_SIG_DESTROYED:
- /*
- * CALL_DESTROYED message from UNI.
- */
- switch (conn->state) {
-
- case CONN_OUT_WAIT_DESTROY:
- cc_conn_rem_port(conn);
- cc_conn_set_state(conn, CONN_OUT_PREPARING);
- if (conn->user != NULL)
- cc_user_sig(conn->user,
- USER_SIG_CONNECT_OUTGOING_ERR,
- NULL, ATM_MKUNIERR(conn->reason));
- break;
-
- case CONN_AB_FLUSH_IND:
- cc_conn_destroy(conn);
- break;
-
- case CONN_IN_PREPARING:
- cc_conn_destroy(conn);
- break;
-
- default:
- goto bad_state;
- }
- break;
-
-
- case CONN_SIG_SETUP_CONFIRM:
- /* Setup confirm from the UNI. */
- {
- struct uni_msg *msg = arg;
- struct uniapi_setup_confirm *conf = uni_msg_rptr(msg,
- struct uniapi_setup_confirm *);
-
- switch (conn->state) {
-
- case CONN_OUT_WAIT_CONF:
- /*
- * Shuffle attributes and inform the user.
- * Negotiable attributes are condititionally shuffled,
- * because not returning it means accepting it
- * (in case of blli the first instance of it).
- * All others are shuffled unconditionally.
- * Here we should also open the VCI in the driver. (XXX)
- */
-#define SHUFFLE(ATTR) conn->ATTR = conf->connect.ATTR
-#define COND_SHUFFLE(ATTR) if (IE_ISPRESENT(conf->connect.ATTR)) SHUFFLE(ATTR)
-
- COND_SHUFFLE(aal);
- (void)memset(conn->blli + 1, 0,
- sizeof(conn->blli) - sizeof(conn->blli[0]));
- if (IE_ISPRESENT(conf->connect.blli))
- conn->blli[0] = conf->connect.blli;
- conn->blli_selector = 1;
- COND_SHUFFLE(epref);
- SHUFFLE(conned);
- SHUFFLE(connedsub);
- SHUFFLE(eetd);
- COND_SHUFFLE(traffic);
- COND_SHUFFLE(exqos);
- COND_SHUFFLE(abrsetup);
- COND_SHUFFLE(abradd);
- COND_SHUFFLE(connid);
-#undef SHUFFLE
-#undef COND_SHUFFLE
- if (IE_ISGOOD(conn->epref))
- cc_party_setup_conf(conn);
-
- cc_conn_set_state(conn, CONN_ACTIVE);
- cc_user_sig(conn->user, USER_SIG_SETUP_CONFIRM,
- NULL, 0);
- break;
-
- case CONN_AB_FLUSH_IND:
- case CONN_AB_WAIT_RESP_OK:
- break;
-
- default:
- goto bad_state;
- }
- break;
- }
-
- case CONN_SIG_SETUP_IND:
- {
- /* SETUP indication */
- struct uni_msg *msg = arg;
- struct uniapi_setup_indication *ind = uni_msg_rptr(msg,
- struct uniapi_setup_indication *);
- u_int i;
-
- if (conn->state != CONN_IN_PREPARING)
- goto bad_state;
-
- /*
- * Shuffle information elements.
- */
- for (i = 0; i < UNI_NUM_IE_BLLI; i++)
- conn->blli[i] = ind->setup.blli[i];
- conn->bearer = ind->setup.bearer;
- conn->traffic = ind->setup.traffic;
- conn->qos = ind->setup.qos;
- conn->exqos = ind->setup.exqos;
- conn->called = ind->setup.called;
- conn->calledsub = ind->setup.calledsub[0];
- conn->aal = ind->setup.aal;
- conn->epref = ind->setup.epref;
- conn->eetd = ind->setup.eetd;
- conn->abrsetup = ind->setup.abrsetup;
- conn->abradd = ind->setup.abradd;
- conn->calling = ind->setup.calling;
- conn->callingsub = ind->setup.callingsub[0];
- conn->connid = ind->setup.connid;
- for (i = 0; i < UNI_NUM_IE_TNS; i++)
- conn->tns[i] = ind->setup.tns[i];
- conn->atraffic = ind->setup.atraffic;
- conn->mintraffic = ind->setup.mintraffic;
- conn->cscope = ind->setup.cscope;
- conn->bhli = ind->setup.bhli;
- conn->mdcr = ind->setup.mdcr;
-
- cc_conn_dispatch(conn);
- break;
- }
-
-
- case CONN_SIG_SETUP_COMPL:
- {
- struct uni_msg *msg = arg;
- struct uniapi_setup_indication *ind __unused =
- uni_msg_rptr(msg, struct uniapi_setup_indication *);
-
- /* SETUP_COMPLETE.indication from UNI */
- if (conn->state == CONN_AB_FLUSH_IND ||
- conn->state == CONN_AB_WAIT_RESP_OK)
- break;
-
- if (conn->state != CONN_IN_WAIT_COMPL)
- goto bad_state;
-
- cc_conn_set_state(conn, CONN_ACTIVE);
-
- LIST_FOREACH(party, &conn->parties, link) {
- if (party->state == PARTY_WAIT_SETUP_COMPL)
- cc_party_set_state(party, PARTY_ACTIVE);
- else
- cc_party_log(party, "bad state=%s for sig=%s",
- ptab[party->state],
- cc_conn_sigtab[CONN_SIG_SETUP_COMPL]);
- }
-
- cc_user_sig(conn->user, USER_SIG_SETUP_COMPL, NULL, 0);
- break;
- }
-
-
- case CONN_SIG_PROC_IND:
- {
- /*
- * ALERTING.indication and PROCEEDING.indication are entirly
- * ignored by the specification. We need to at least save the
- * connid information element.
- */
- struct uni_msg *msg = arg;
- struct uniapi_proceeding_indication *ind = uni_msg_rptr(msg,
- struct uniapi_proceeding_indication *);
-
- switch (conn->state) {
-
- case CONN_OUT_WAIT_CONF:
- if (IE_ISGOOD(ind->call_proc.connid))
- conn->connid = ind->call_proc.connid;
- break;
-
- case CONN_AB_FLUSH_IND:
- case CONN_AB_WAIT_RESP_OK:
- break;
-
- default:
- goto bad_state;
- }
- break;
- }
-
- case CONN_SIG_ALERTING_IND:
- {
- struct uni_msg *msg = arg;
- struct uniapi_alerting_indication *ind = uni_msg_rptr(msg,
- struct uniapi_alerting_indication *);
-
- switch (conn->state) {
-
- case CONN_OUT_WAIT_CONF:
- if (IE_ISGOOD(ind->alerting.connid))
- conn->connid = ind->alerting.connid;
- break;
-
- case CONN_AB_FLUSH_IND:
- case CONN_AB_WAIT_RESP_OK:
- break;
-
- default:
- goto bad_state;
- }
- break;
- }
-
- case CONN_SIG_REL_CONF:
- {
- /* RELEASE.confirm from UNI */
- struct uni_msg *msg = arg;
- struct uniapi_release_confirm *conf = uni_msg_rptr(msg,
- struct uniapi_release_confirm *);
-
- switch (conn->state) {
-
- case CONN_OUT_WAIT_CONF:
- case CONN_ACTIVE:
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- memcpy(conn->user->cause, conf->release.cause,
- sizeof(conn->user->cause));
- /*
- * If any party is in P6, ok the user
- */
- LIST_FOREACH(party, &conn->parties, link) {
- if (party->state == PARTY_DROP_WAIT_ACK) {
- cc_party_set_state(party,
- PARTY_WAIT_DESTROY);
- cc_user_sig(conn->user,
- USER_SIG_DROP_PARTY_OK,
- NULL, party->epref.epref);
- }
- }
- cc_user_sig(conn->user, USER_SIG_RELEASE_CONFIRM,
- NULL, 0);
- cc_disconnect_from_user(conn);
- break;
-
- case CONN_AB_FLUSH_IND:
- case CONN_AB_WAIT_RESP_OK:
- break;
-
- case CONN_IN_WAITING:
- cc_disconnect_from_user(conn);
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- break;
-
- case CONN_IN_ARRIVED:
- conn->user->aborted = 1;
- memcpy(conn->user->cause, conf->release.cause,
- sizeof(conn->user->cause));
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- cc_disconnect_from_user(conn);
- break;
-
- case CONN_IN_WAIT_COMPL:
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- memcpy(conn->user->cause, conf->release.cause,
- sizeof(conn->user->cause));
- cc_user_sig(conn->user, USER_SIG_RELEASE_CONFIRM,
- NULL, 0);
- cc_disconnect_from_user(conn);
- break;
-
- default:
- goto bad_state;
- }
- break;
- }
-
- case CONN_SIG_REL_IND:
- {
- /* RELEASE.ind from UNI */
- struct uni_msg *msg = arg;
- struct uniapi_release_indication *conf = uni_msg_rptr(msg,
- struct uniapi_release_indication *);
-
- switch (conn->state) {
-
- case CONN_OUT_WAIT_CONF:
- case CONN_ACTIVE:
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- memcpy(conn->user->cause, conf->release.cause,
- sizeof(conn->user->cause));
- /*
- * If any party is in P6, ok the user
- */
- LIST_FOREACH(party, &conn->parties, link) {
- if (party->state == PARTY_DROP_WAIT_ACK) {
- cc_party_set_state(party,
- PARTY_WAIT_DESTROY);
- cc_user_sig(conn->user,
- USER_SIG_DROP_PARTY_OK,
- NULL, party->epref.epref);
- }
- }
- cc_user_sig(conn->user, USER_SIG_RELEASE_CONFIRM,
- NULL, 0);
- cc_disconnect_from_user(conn);
- break;
-
- case CONN_AB_FLUSH_IND:
- case CONN_AB_WAIT_RESP_OK:
- break;
-
- case CONN_IN_WAITING:
- cc_disconnect_from_user(conn);
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- break;
-
- case CONN_IN_ARRIVED:
- conn->user->aborted = 1;
- cc_disconnect_from_user(conn);
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- break;
-
- case CONN_IN_WAIT_COMPL:
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- memcpy(conn->user->cause, conf->release.cause,
- sizeof(conn->user->cause));
- cc_user_sig(conn->user, USER_SIG_RELEASE_CONFIRM,
- NULL, 0);
- cc_disconnect_from_user(conn);
- break;
- default:
- goto bad_state;
- break;
- }
- break;
- }
-
- case CONN_SIG_PARTY_ALERTING_IND:
- /* party alerting from UNI */
- if (conn->state == CONN_AB_FLUSH_IND)
- break;
- if (conn->state != CONN_ACTIVE)
- goto bad_state;
- /* ignore */
- break;
-
- case CONN_SIG_PARTY_ADD_ACK_IND:
- {
- /* ADD PARTY ACKNOWLEDGE from UNI */
- struct uni_msg *msg = arg;
- struct uniapi_add_party_ack_indication *ind = uni_msg_rptr(msg,
- struct uniapi_add_party_ack_indication *);
-
- if (conn->state == CONN_AB_FLUSH_IND)
- break;
- if (conn->state != CONN_ACTIVE)
- goto bad_state;
-
- cc_party_add_ack_ind(conn, &ind->ack.epref);
- break;
- }
-
-
- case CONN_SIG_PARTY_ADD_REJ_IND:
- {
- /* ADD PARTY REJECT indication */
- struct uni_msg *msg = arg;
- struct uniapi_add_party_rej_indication *ind = uni_msg_rptr(msg,
- struct uniapi_add_party_rej_indication *);
-
- if (conn->state == CONN_AB_FLUSH_IND)
- break;
- if (conn->state != CONN_ACTIVE)
- goto bad_state;
-
- memset(&conn->user->cause[1], 0, sizeof(conn->user->cause[1]));
- conn->user->cause[0] = ind->rej.cause;
-
- cc_party_add_rej_ind(conn, &ind->rej.epref);
- break;
- }
-
-
- case CONN_SIG_DROP_PARTY_IND:
- {
- /* DROP_PARTY.indication from UNI */
- struct uni_msg *msg = arg;
- struct uniapi_drop_party_indication *ind = uni_msg_rptr(msg,
- struct uniapi_drop_party_indication *);
- struct uniapi_drop_party_ack_request *req;
- struct uni_msg *u;
-
- if (conn->state == CONN_AB_FLUSH_IND)
- break;
- if (conn->state != CONN_ACTIVE)
- goto bad_state;
-
- party = cc_party_find(conn, ind->drop.epref.epref);
- if (party == NULL) {
- cc_party_log(party, "no party for %s",
- cc_conn_sigtab[sig]);
- break;
- }
-
- u = uni_msg_alloc(sizeof(*req));
- if (u == NULL)
- return;
-
- memset(&conn->user->cause[1], 0, sizeof(conn->user->cause[1]));
- conn->user->cause[0] = ind->drop.cause;
-
- switch (party->state) {
-
- default:
- cc_party_log(party, "bad state %s for DROP.ind",
- ptab[party->state]);
- /* FALLTHRU */
-
- case PARTY_ACTIVE: /* P1 -> P9 */
- cc_party_set_state(party, PARTY_WAIT_DROP_ACK_OK);
- break;
-
- case PARTY_ADD_WAIT_ACK: /* P4 -> P12 */
- cc_party_set_state(party, PARTY_ADD_DROPACK_WAIT_OK);
- break;
- }
-
- /*
- * Construct message to UNI.
- */
- req = uni_msg_wptr(u, struct uniapi_drop_party_ack_request *);
- memset(req, 0, sizeof(*req));
- u->b_wptr += sizeof(*req);
-
- IE_SETPRESENT(req->ack.epref);
- req->ack.hdr.act = UNI_MSGACT_DEFAULT;
- req->ack.hdr.cref = conn->cref;
-
- req->ack.epref.flag = 0;
- req->ack.epref.epref = ind->drop.epref.epref;
-
- cc_send_uni(conn, UNIAPI_DROP_PARTY_ACK_request, u);
- break;
- }
-
- case CONN_SIG_OK:
- {
- /* OK response from UNI */
- struct ccuser *user = conn->user;
-
- switch (conn->state) {
-
- case CONN_OUT_WAIT_OK: /* C3 */
- cc_conn_set_state(conn, CONN_OUT_WAIT_CONF);
- if (conn->user != NULL)
- cc_user_sig(conn->user,
- USER_SIG_CONNECT_OUTGOING_OK, NULL, 0);
- break;
-
- case CONN_AB_WAIT_RESP_OK: /* C33 */
- case CONN_AB_WAIT_REQ_OK: /* C34 */
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- break;
-
- case CONN_REL_WAIT_OK: /* C20 */
- case CONN_REL_IN_WAIT_OK: /* C15 */
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- if (conn->user != NULL) {
- /* connection has not been aborted */
- memset(&conn->user->cause, 0,
- sizeof(conn->user->cause));
- cc_user_sig(conn->user,
- USER_SIG_RELEASE_CONFIRM, NULL, 0);
- cc_disconnect_from_user(conn);
- }
- break;
-
- case CONN_IN_WAIT_ACCEPT_OK: /* C12 */
- if (user == NULL) {
- /* has been aborted */
- do_release_request(conn, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_REQ_OK);
- break;
- }
- cc_conn_set_state(conn, CONN_IN_WAIT_COMPL);
- cc_disconnect_from_user(conn);
- cc_user_sig(user, USER_SIG_ACCEPT_OK, NULL, 0);
- if (conn->acceptor == NULL) {
- do_release_request(conn, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_REQ_OK);
- break;
- }
- cc_connect_to_user(conn, conn->acceptor);
- cc_conn_reset_acceptor(conn);
- cc_user_sig(conn->user, USER_SIG_ACCEPTING, NULL, 0);
- break;
-
- case CONN_REJ_WAIT_OK: /* C14 */
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- if (user != NULL) {
- cc_disconnect_from_user(conn);
- cc_user_sig(user, USER_SIG_REJECT_OK, NULL, 0);
- }
- break;
-
- default:
- /* maybe it's for a party */
- LIST_FOREACH(party, &conn->parties, link) {
- switch (party->state) {
-
- case PARTY_ADD_WAIT_OK: /* P3 */
- if (user != NULL)
- cc_user_sig(user,
- USER_SIG_ADD_PARTY_OK,
- NULL, 0);
- cc_party_set_state(party,
- PARTY_ADD_WAIT_ACK);
- goto ex_party_ok;
-
- case PARTY_DROP_WAIT_OK: /* P5 */
- cc_party_set_state(party,
- PARTY_DROP_WAIT_ACK);
- goto ex_party_ok;
-
- case PARTY_WAIT_DROP_ACK_OK: /* P9 */
- case PARTY_ADD_DROPACK_WAIT_OK:/* P12 */
- {
- struct ccparty *p1;
-
- cc_party_set_state(party,
- PARTY_WAIT_DESTROY);
- /* signal to user only if there are any other parties */
- LIST_FOREACH(p1, &conn->parties, link)
- if (p1 != party)
- break;
- if (p1 != NULL && user != NULL)
- cc_user_sig(user,
- USER_SIG_DROP_PARTY_IND,
- NULL,
- party->epref.epref);
-
- goto ex_party_ok;
- }
-
- case PARTY_ADD_DROP_WAIT_OK: /* P11 */
- cc_party_set_state(party,
- PARTY_DROP_WAIT_ACK);
- goto ex_party_ok;
-
- default:
- break;
- }
- }
- goto bad_state;
- ex_party_ok:
- break;
- }
- break;
- }
-
- case CONN_SIG_ERROR:
- {
- /* error response from UNI */
- u_int reason = (iarg >> 16) & 0xffff;
- u_int state = iarg & 0xffff;
- struct ccuser *user = conn->user;
-
- switch (conn->state) {
-
- case CONN_OUT_WAIT_CREATE: /* C2 */
- cc_conn_rem_port(conn);
- cc_conn_set_state(conn, CONN_OUT_PREPARING);
- if (conn->user != NULL)
- cc_user_sig(conn->user,
- USER_SIG_CONNECT_OUTGOING_ERR,
- NULL, ATM_MKUNIERR(reason));
- break;
-
- case CONN_OUT_WAIT_OK: /* C3 */
- cc_conn_set_state(conn, CONN_OUT_WAIT_DESTROY);
- conn->reason = reason;
- break;
-
- case CONN_AB_WAIT_REQ_OK: /* C33 */
- if (state == UNI_CALLSTATE_U12) {
- do_release_response(conn, 0, conn->cause);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- break;
- }
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- break;
-
- case CONN_AB_WAIT_RESP_OK: /* C34 */
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- break;
-
- case CONN_REL_WAIT_OK: /* C20 */
- if (user == NULL) {
- /* connection has been aborted. */
- if (state == UNI_CALLSTATE_U10) {
- /* do what we can */
- do_release_request(conn, conn->cause);
- cc_conn_set_state(conn,
- CONN_AB_WAIT_REQ_OK);
- } else if (state == UNI_CALLSTATE_U12) {
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn,
- CONN_AB_WAIT_RESP_OK);
- } else {
- cc_conn_set_state(conn,
- CONN_AB_FLUSH_IND);
- }
- break;
- }
- if (state == UNI_CALLSTATE_U10) {
- cc_conn_set_state(conn, CONN_ACTIVE);
- cc_user_sig(conn->user, USER_SIG_RELEASE_ERR,
- NULL, reason);
- } else if (state == UNI_CALLSTATE_U12) {
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- memset(&conn->user->cause, 0,
- sizeof(conn->user->cause));
- cc_user_sig(conn->user,
- USER_SIG_RELEASE_CONFIRM, NULL, 0);
- cc_disconnect_from_user(conn);
- } else {
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- memset(&conn->user->cause, 0,
- sizeof(conn->user->cause));
- cc_user_sig(conn->user,
- USER_SIG_RELEASE_CONFIRM, NULL, 0);
- cc_disconnect_from_user(conn);
- }
- break;
-
- case CONN_IN_WAIT_ACCEPT_OK: /* C12 */
- if (user == NULL) {
- /* connection was aborted */
- if (state == UNI_CALLSTATE_U6 ||
- state == UNI_CALLSTATE_U7 ||
- state == UNI_CALLSTATE_U9 ||
- state == UNI_CALLSTATE_U12) {
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn,
- CONN_AB_WAIT_RESP_OK);
- } else {
- cc_conn_set_state(conn,
- CONN_AB_FLUSH_IND);
- }
- break;
- }
- cc_conn_reset_acceptor(conn);
- if (state == UNI_CALLSTATE_U6 ||
- state == UNI_CALLSTATE_U9 ||
- state == UNI_CALLSTATE_U7) {
- cc_user_sig(user, USER_SIG_ACCEPT_ERR,
- NULL, ATM_MKUNIERR(reason));
- cc_conn_set_state(conn, CONN_IN_ARRIVED);
- } else if (state == UNI_CALLSTATE_U12) {
- do_release_response(conn, 0, NULL);
- cc_disconnect_from_user(conn);
- cc_user_sig(user, USER_SIG_ACCEPT_ERR,
- user, ATMERR_PREVIOUSLY_ABORTED);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- } else {
- cc_disconnect_from_user(conn);
- cc_user_sig(user, USER_SIG_ACCEPT_ERR,
- user, ATMERR_PREVIOUSLY_ABORTED);
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- }
- break;
-
- case CONN_REJ_WAIT_OK: /* C14 */
- if (user == NULL) {
- /* connection has been aborted. */
- if (state == UNI_CALLSTATE_U6 ||
- state == UNI_CALLSTATE_U7 ||
- state == UNI_CALLSTATE_U9 ||
- state == UNI_CALLSTATE_U12) {
- /* do what we can */
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn,
- CONN_AB_WAIT_RESP_OK);
- } else {
- cc_conn_set_state(conn,
- CONN_AB_FLUSH_IND);
- }
- break;
- }
- if (state == UNI_CALLSTATE_U6 ||
- state == UNI_CALLSTATE_U9 ||
- state == UNI_CALLSTATE_U7) {
- cc_user_sig(user, USER_SIG_REJECT_ERR,
- NULL, ATM_MKUNIERR(reason));
- cc_conn_set_state(conn, CONN_IN_ARRIVED);
- } else {
- cc_disconnect_from_user(conn);
- cc_user_sig(user, USER_SIG_REJECT_OK, NULL, 0);
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- }
- break;
-
- case CONN_REL_IN_WAIT_OK: /* C15 */
- if (user == NULL) {
- /* connection has been aborted. */
- if (state == UNI_CALLSTATE_U8) {
- /* do what we can */
- do_release_request(conn, conn->cause);
- cc_conn_set_state(conn,
- CONN_AB_WAIT_REQ_OK);
- } else if (state == UNI_CALLSTATE_U12) {
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn,
- CONN_AB_WAIT_RESP_OK);
- } else {
- cc_conn_set_state(conn,
- CONN_AB_FLUSH_IND);
- }
- break;
- }
- if (state == UNI_CALLSTATE_U8) {
- cc_conn_set_state(conn, CONN_IN_WAIT_COMPL);
- cc_user_sig(conn->user, USER_SIG_RELEASE_ERR,
- NULL, reason);
- } else if (state == UNI_CALLSTATE_U12) {
- do_release_response(conn, 0, NULL);
- cc_conn_set_state(conn, CONN_AB_WAIT_RESP_OK);
- memset(&conn->user->cause, 0,
- sizeof(conn->user->cause));
- cc_user_sig(conn->user,
- USER_SIG_RELEASE_CONFIRM, NULL, 0);
- cc_disconnect_from_user(conn);
- } else {
- cc_conn_set_state(conn, CONN_AB_FLUSH_IND);
- memset(&conn->user->cause, 0,
- sizeof(conn->user->cause));
- cc_user_sig(conn->user,
- USER_SIG_RELEASE_CONFIRM, NULL, 0);
- cc_disconnect_from_user(conn);
- }
- break;
-
- default:
- /* maybe it's for a party */
- LIST_FOREACH(party, &conn->parties, link) {
- switch (party->state) {
-
- case PARTY_ADD_WAIT_CREATE: /* P2 */
- cc_party_destroy(party);
- if (user != NULL)
- cc_user_sig(user,
- USER_SIG_ADD_PARTY_ERR,
- NULL, ATM_MKUNIERR(reason));
- goto ex_party_err;
-
- case PARTY_ADD_WAIT_OK: /* P3 */
- cc_party_set_state(party,
- PARTY_WAIT_DESTROY);
- if (user != NULL)
- cc_user_sig(user,
- USER_SIG_ADD_PARTY_ERR,
- NULL, ATM_MKUNIERR(reason));
- goto ex_party_err;
-
- case PARTY_DROP_WAIT_OK: /* P5 */
- cc_party_set_state(party,
- PARTY_ACTIVE);
- if (user != NULL)
- cc_user_sig(user,
- USER_SIG_DROP_PARTY_ERR,
- NULL, ATM_MKUNIERR(reason));
- goto ex_party_err;
-
- case PARTY_WAIT_DROP_ACK_OK: /* P9 */
- cc_party_set_state(party,
- PARTY_ACTIVE);
- goto ex_party_err;
-
- case PARTY_ADD_DROP_WAIT_OK: /* P11 */
- cc_party_set_state(party,
- PARTY_ADD_WAIT_ACK);
- if (user != NULL)
- cc_user_sig(user,
- USER_SIG_DROP_PARTY_ERR,
- NULL, ATM_MKUNIERR(reason));
- goto ex_party_err;
-
- case PARTY_ADD_DROPACK_WAIT_OK:/* P12 */
- cc_party_set_state(party,
- PARTY_ADD_WAIT_ACK);
- goto ex_party_err;
-
- default:
- break;
- }
- }
- cc_conn_log(conn, "unexpected reason=%u ustate=%u "
- "state=%s\n", reason, state, stab[conn->state]);
- ex_party_err:
- break;
- }
- break;
- }
-
- case CONN_SIG_PARTY_CREATED:
- {
- struct uni_msg *msg = arg;
- struct uniapi_party_created *pcr = uni_msg_rptr(msg,
- struct uniapi_party_created *);
-
- party = cc_party_find(conn, pcr->epref.epref);
- if (party == NULL) {
- /* for incoming connections we see the party-created
- * immediately after the call-create so that we
- * must be in C10 */
- switch (conn->state) {
-
- case CONN_IN_PREPARING:
- party = cc_party_create(conn,
- pcr->epref.epref, 1);
- if (party == NULL)
- break;
- cc_party_set_state(party,
- PARTY_WAIT_SETUP_COMPL);
- break;
-
- case CONN_OUT_WAIT_OK:
- party = cc_party_create(conn,
- pcr->epref.epref, 0);
- if (party == NULL)
- break;
- cc_party_set_state(party,
- PARTY_WAIT_SETUP_CONF);
- break;
-
- default:
- goto bad_state;
- }
- break;
- }
- /* this is for an ADD-PARTY */
- if (conn->state != CONN_ACTIVE)
- goto bad_state;
- if (party->state != PARTY_ADD_WAIT_CREATE)
- goto bad_party_state;
- cc_party_set_state(party, PARTY_ADD_WAIT_OK);
- break;
- }
-
- case CONN_SIG_PARTY_DESTROYED:
- {
- struct uni_msg *msg = arg;
- struct uniapi_party_destroyed *pcr = uni_msg_rptr(msg,
- struct uniapi_party_destroyed *);
-
- party = cc_party_find(conn, pcr->epref.epref);
- if (party == NULL) {
- cc_conn_log(conn, "no party to destroy %u/%u",
- pcr->epref.flag, pcr->epref.epref);
- break;
- }
- cc_party_destroy(party);
- break;
- }
-
- }
-
- return;
-
- bad_state:
- cc_conn_log(conn, "bad state=%s for signal=%s",
- stab[conn->state], cc_conn_sigtab[sig]);
- return;
-
- bad_party_state:
- cc_conn_log(conn, "bad party state=%s for signal=%s",
- ptab[party->state], cc_conn_sigtab[sig]);
- return;
-}
diff --git a/sys/contrib/ngatm/netnatm/api/cc_data.c b/sys/contrib/ngatm/netnatm/api/cc_data.c
deleted file mode 100644
index bf607de1e45b..000000000000
--- a/sys/contrib/ngatm/netnatm/api/cc_data.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
-* Copyright (c) 2004
-* Hartmut Brandt
-* All rights reserved.
-*
-* Author: Harti Brandt <harti@freebsd.org>
-*
-* Redistribution of this software and documentation and use in source and
-* binary forms, with or without modification, are permitted provided that
-* the following conditions are met:
-*
-* 1. Redistributions of source code or documentation must retain the above
-* copyright notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
-* AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-* $Begemot: libunimsg/netnatm/api/cc_data.c,v 1.1 2004/07/08 08:21:50 brandt Exp $
-*
-* ATM API as defined per af-saa-0108
-*/
-#include <netnatm/unimsg.h>
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/msg/unimsglib.h>
-#include <netnatm/api/unisap.h>
-#include <netnatm/sig/unidef.h>
-#include <netnatm/api/atmapi.h>
-#include <netnatm/api/ccatm.h>
-#include <netnatm/api/ccpriv.h>
-
-/*
- * Create a new call control instance
- */
-struct ccdata *
-cc_create(const struct cc_funcs *vtab)
-{
- struct ccdata *cc;
-
- cc = CCMALLOC(sizeof(*cc));
- if (cc == NULL)
- return (NULL);
-
- LIST_INIT(&cc->user_list);
- TAILQ_INIT(&cc->port_list);
- LIST_INIT(&cc->orphaned_conns);
- TAILQ_INIT(&cc->sigs);
- TAILQ_INIT(&cc->def_sigs);
- TAILQ_INIT(&cc->free_sigs);
- cc->funcs = vtab;
- cc->cookie = 0;
-
- return (cc);
-}
-
-/*
- * Reset everything the hard way by just freeing the data
- */
-void
-cc_reset(struct ccdata *cc)
-{
-
- while (!LIST_EMPTY(&cc->user_list))
- cc_user_destroy(LIST_FIRST(&cc->user_list));
-
- while (!TAILQ_EMPTY(&cc->port_list))
- cc_port_destroy(TAILQ_FIRST(&cc->port_list), 1);
-
- while (!LIST_EMPTY(&cc->orphaned_conns))
- cc_conn_destroy(LIST_FIRST(&cc->orphaned_conns));
-
- CCASSERT(LIST_EMPTY(&cc->user_list),
- ("user list not empty"));
- CCASSERT(LIST_EMPTY(&cc->orphaned_conns),
- ("still orphaned conns"));
-
- cc_sig_flush_all(cc);
-
- cc->cookie = 0;
-}
-
-/*
- * Destroy a call control instance and free all data
- */
-void
-cc_destroy(struct ccdata *cc)
-{
-
- cc_reset(cc);
- CCFREE(cc);
-}
-
-/*
- * set/get logging flags
- */
-void
-cc_set_log(struct ccdata *cc, u_int flags)
-{
- cc->log = flags;
-}
-u_int
-cc_get_log(const struct ccdata *cc)
-{
- return (cc->log);
-}
-
-/* get extended status */
-int
-cc_get_extended_status(const struct ccdata *cc, struct atm_exstatus *status,
- struct atm_exstatus_ep **pep, struct atm_exstatus_port **pport,
- struct atm_exstatus_conn **pconn, struct atm_exstatus_party **pparty)
-{
- const struct ccuser *user;
- const struct ccport *port;
- const struct ccconn *conn;
- const struct ccparty *party;
- struct atm_exstatus_ep *eep;
- struct atm_exstatus_port *eport;
- struct atm_exstatus_conn *econn;
- struct atm_exstatus_party *eparty;
-
- /* count and allocate */
- status->neps = 0;
- LIST_FOREACH(user, &cc->user_list, node_link)
- status->neps++;
-
- status->nports = 0;
- status->nconns = 0;
- status->nparties = 0;
- LIST_FOREACH(conn, &cc->orphaned_conns, port_link) {
- status->nconns++;
- LIST_FOREACH(party, &conn->parties, link)
- status->nparties++;
- }
- TAILQ_FOREACH(port, &cc->port_list, node_link) {
- status->nports++;
- LIST_FOREACH(conn, &port->conn_list, port_link) {
- status->nconns++;
- LIST_FOREACH(party, &conn->parties, link)
- status->nparties++;
- }
- }
-
- *pep = CCMALLOC(sizeof(**pep) * status->neps);
- *pport = CCMALLOC(sizeof(**pport) * status->nports);
- *pconn = CCMALLOC(sizeof(**pconn) * status->nconns);
- *pparty = CCMALLOC(sizeof(**pparty) * status->nparties);
-
- if (*pep == NULL || *pport == NULL ||
- *pconn == NULL || *pparty == NULL) {
- CCFREE(*pep);
- CCFREE(*pport);
- CCFREE(*pconn);
- CCFREE(*pparty);
- return (ENOMEM);
- }
-
- eep = *pep;
- eport = *pport;
- econn = *pconn;
- eparty = *pparty;
-
- /* collect information */
- LIST_FOREACH(user, &cc->user_list, node_link) {
- strcpy(eep->name, user->name);
- eep->state = user->state;
- eep++;
- }
-
- LIST_FOREACH(conn, &cc->orphaned_conns, port_link) {
- econn->id = econn - *pconn;
- econn->port = 0;
- if (conn->user != NULL)
- strcpy(econn->ep, conn->user->name);
- else
- econn->ep[0] = '\0';
- econn->state = conn->state;
- econn->cref = conn->cref.cref;
- if (conn->cref.flag)
- econn->cref |= (1 << 23);
- LIST_FOREACH(party, &conn->parties, link) {
- eparty->connid = econn - *pconn;
- eparty->epref = party->epref.epref;
- eparty->state = party->state;
- eparty++;
- }
- econn++;
- }
-
- TAILQ_FOREACH(port, &cc->port_list, node_link) {
- eport->portno = port->param.port;
- eport->state = port->admin;
- LIST_FOREACH(conn, &port->conn_list, port_link) {
- econn->id = econn - *pconn;
- econn->port = port->param.port;
- if (conn->user != NULL)
- strcpy(econn->ep, conn->user->name);
- else
- econn->ep[0] = '\0';
- econn->state = conn->state;
- econn->cref = conn->cref.cref;
- if (conn->cref.flag)
- econn->cref |= (1 << 23);
- LIST_FOREACH(party, &conn->parties, link) {
- eparty->connid = econn - *pconn;
- eparty->epref = party->epref.epref;
- eparty->state = party->state;
- eparty++;
- }
- econn++;
- }
- eport++;
- }
- return (0);
-}
diff --git a/sys/contrib/ngatm/netnatm/api/cc_dump.c b/sys/contrib/ngatm/netnatm/api/cc_dump.c
deleted file mode 100644
index 245f8b7b5f04..000000000000
--- a/sys/contrib/ngatm/netnatm/api/cc_dump.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (c) 2003-2004
- * Hartmut Brandt
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution of this software and documentation and use in source and
- * binary forms, with or without modification, are permitted provided that
- * the following conditions are met:
- *
- * 1. Redistributions of source code or documentation must retain the above
- * copyright notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
- * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/api/cc_dump.c,v 1.3 2004/08/05 07:10:56 brandt Exp $
- *
- * ATM API as defined per af-saa-0108
- */
-
-#include <netnatm/unimsg.h>
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/msg/unimsglib.h>
-#include <netnatm/api/unisap.h>
-#include <netnatm/sig/unidef.h>
-#include <netnatm/api/atmapi.h>
-#include <netnatm/api/ccatm.h>
-#include <netnatm/api/ccpriv.h>
-
-#ifdef _KERNEL
-#ifdef __FreeBSD__
-#include <machine/stdarg.h>
-#endif
-#else /* !_KERNEL */
-#include <stdarg.h>
-#endif
-
-/*
- * local structure to reduce number of arguments to functions
- */
-struct dump {
- struct ccdata *cc; /* what to dump */
- size_t maxsiz; /* size of user buffer */
- cc_dump_f func; /* user function */
- void *uarg; /* user supplied argument */
- char *buf; /* user buffer */
- size_t len; /* current string length */
- int ret; /* return code */
-};
-
-static void cc_dumpf(struct dump *, const char *, ...) __printflike(2, 3);
-
-static void
-cc_dumpf(struct dump *d, const char *fmt, ...)
-{
- va_list ap;
- int n;
-
- if (d->ret != 0)
- return;
- if (d->len >= d->maxsiz - 1) {
- d->ret = d->func(d->cc, d->uarg, d->buf);
- if (d->ret != 0)
- return;
- d->buf[0] = '\0';
- d->len = 0;
- }
- va_start(ap, fmt);
- n = vsnprintf(d->buf + d->len, d->maxsiz - d->len, fmt, ap);
- va_end(ap);
-
- if (n < 0) {
- d->ret = CCGETERRNO();
- return;
- }
- if ((size_t)n < d->maxsiz - d->len) {
- d->len += n;
- return;
- }
-
- /* undo the vsnprintf() and flush */
- d->buf[d->len] = '\0';
- d->ret = d->func(d->cc, d->uarg, d->buf);
- if (d->ret != 0)
- return;
- d->buf[0] = '\0';
- d->len = 0;
-
- va_start(ap, fmt);
- n = vsnprintf(d->buf, d->maxsiz, fmt, ap);
- va_end(ap);
-
- if (n < 0) {
- d->ret = CCGETERRNO();
- return;
- }
- if ((size_t)n >= d->maxsiz) {
- /* ok, truncate */
- d->len = d->maxsiz - 1;
- return;
- }
- d->len = n;
-}
-
-/*
- * Dump a SAP
- */
-static void
-cc_dump_sap(struct dump *d, const struct uni_sap *sap)
-{
- static const char *const tagtab[] = {
- [UNISVE_ABSENT] = "absent",
- [UNISVE_ANY] = "any",
- [UNISVE_PRESENT] = "present"
- };
- static const char *const plantab[] = {
- [UNI_ADDR_E164] = "E164",
- [UNI_ADDR_ATME] = "ATME",
- };
- static const char *const hlitab[] = {
- [UNI_BHLI_ISO] = "ISO",
- [UNI_BHLI_VENDOR] = "VENDOR",
- [UNI_BHLI_USER] = "USER"
- };
- u_int i;
-
- cc_dumpf(d, " sap(%p):\n", sap);
- cc_dumpf(d, " addr=%s", tagtab[sap->addr.tag]);
- if (sap->addr.tag == UNISVE_PRESENT) {
- cc_dumpf(d, " %s %u ", plantab[sap->addr.plan], sap->addr.len);
- if (sap->addr.plan == UNI_ADDR_E164)
- for (i = 0; i < sap->addr.len; i++)
- cc_dumpf(d, "%c", sap->addr.addr[i]);
- else
- for (i = 0; i < sap->addr.len; i++)
- cc_dumpf(d, "%02x", sap->addr.addr[i]);
- }
- cc_dumpf(d, "\n");
-
- cc_dumpf(d, " selector=%s", tagtab[sap->selector.tag]);
- if (sap->selector.tag == UNISVE_PRESENT)
- cc_dumpf(d, " %02x", sap->selector.selector);
- cc_dumpf(d, "\n");
-
- cc_dumpf(d, " blli_id2=%s", tagtab[sap->blli_id2.tag]);
- if (sap->blli_id2.tag == UNISVE_PRESENT)
- cc_dumpf(d, " %02x %02x", sap->blli_id2.proto,
- sap->blli_id2.user);
- cc_dumpf(d, "\n");
-
- cc_dumpf(d, " blli_id3=%s", tagtab[sap->blli_id3.tag]);
- if (sap->blli_id3.tag == UNISVE_PRESENT)
- cc_dumpf(d, " %02x,%02x, %02x(%d),%03x,%02x",
- sap->blli_id3.proto, sap->blli_id3.user,
- sap->blli_id3.ipi, sap->blli_id3.noipi,
- sap->blli_id3.oui, sap->blli_id3.pid);
- cc_dumpf(d, "\n");
-
- cc_dumpf(d, " bhli=%s", tagtab[sap->bhli.tag]);
- if (sap->bhli.tag == UNISVE_PRESENT) {
- cc_dumpf(d, " %s ", hlitab[sap->bhli.type]);
- for (i = 0; i < sap->bhli.len; i++)
- cc_dumpf(d, "%02x", sap->bhli.info[i]);
- }
- cc_dumpf(d, "\n");
-}
-
-/*
- * Dump a user.
- */
-static void
-cc_dump_user(struct dump *d, const struct ccuser *user)
-{
- struct ccconn *conn;
-
- cc_dumpf(d, "user(%p): %s '%s' %s\n", user,
- cc_user_state2str(user->state), user->name,
- (user->config == USER_P2P) ? "p2p" :
- (user->config == USER_ROOT) ? "root" :
- (user->config == USER_LEAF) ? "leaf" : "?");
- if (user->sap)
- cc_dump_sap(d, user->sap);
-
- cc_dumpf(d, " queue=%u/%u accepted=%p aborted=%u\n", user->queue_max,
- user->queue_act, user->accepted, user->aborted);
-
- cc_dumpf(d, " connq:");
- TAILQ_FOREACH(conn, &user->connq, connq_link)
- cc_dumpf(d, "%p", conn);
- cc_dumpf(d, "\n");
-}
-
-/*
- * Dump a party
- */
-static void
-cc_dump_party(struct dump *d, const struct ccparty *party, const char *pfx)
-{
-
- cc_dumpf(d, "%s party(%p): %u.%u %s\n", pfx, party,
- party->epref.flag, party->epref.epref,
- cc_party_state2str(party->state));
-}
-
-/*
- * Dump a connection
- */
-static void
-cc_dump_conn(struct dump *d, const struct ccconn *conn, const char *pfx)
-{
- const struct ccparty *party;
-
- cc_dumpf(d, "%sconn(%p): %s\n", pfx, conn,
- cc_conn_state2str(conn->state));
- cc_dumpf(d, "%s user=%p cref=%u.%u acceptor=%p\n", pfx,
- conn->user, conn->cref.cref, conn->cref.flag,
- conn->acceptor);
-
- cc_dumpf(d, "%s blli_sel=%u\n", pfx, conn->blli_selector);
-
- LIST_FOREACH(party, &conn->parties, link)
- cc_dump_party(d, party, pfx);
-}
-
-/*
- * Dump a port
- */
-static void
-cc_dump_port(struct dump *d, const struct ccport *p)
-{
- u_int i;
- const struct ccaddr *a;
- const struct ccconn *c;
- const struct ccreq *r;
-
- static const char *const ttab[] = {
- [UNI_ADDR_UNKNOWN] = "unknown",
- [UNI_ADDR_INTERNATIONAL] = "international",
- [UNI_ADDR_NATIONAL] = "national",
- [UNI_ADDR_NETWORK] = "network",
- [UNI_ADDR_SUBSCR] = "subscr",
- [UNI_ADDR_ABBR] = "abbr",
- };
- static const char *const ptab[] = {
- [UNI_ADDR_UNKNOWN] = "unknown",
- [UNI_ADDR_E164] = "e164",
- [UNI_ADDR_ATME] = "atme",
- [UNI_ADDR_DATA] = "data",
- [UNI_ADDR_PRIVATE] = "private",
- };
-
- cc_dumpf(d, "port(%p) %u: %s\n", p, p->param.port,
- (p->admin == CCPORT_STOPPED) ? "STOPPED" :
- (p->admin == CCPORT_RUNNING) ? "RUNNING" : "????");
- cc_dumpf(d, " pcr=%u bits=%u.%u ids=%u/%u/%u esi=%02x:%02x:"
- "%02x:%02x:%02x:%02x naddrs=%u\n", p->param.pcr,
- p->param.max_vpi_bits, p->param.max_vci_bits, p->param.max_svpc_vpi,
- p->param.max_svcc_vpi, p->param.min_svcc_vci, p->param.esi[0],
- p->param.esi[1], p->param.esi[2], p->param.esi[3], p->param.esi[4],
- p->param.esi[5], p->param.num_addrs);
-
- cc_dumpf(d, " cookies:");
- TAILQ_FOREACH(r, &p->cookies, link)
- cc_dumpf(d, " %u(%p,%u)", r->cookie, r->conn, r->req);
- cc_dumpf(d, "\n");
-
- TAILQ_FOREACH(a, &p->addr_list, port_link) {
- cc_dumpf(d, " addr(%p): %s %s %u ", a,
- (a->addr.type < sizeof(ttab) / sizeof(ttab[0]) &&
- ttab[a->addr.type] != NULL) ? ttab[a->addr.type] : "?",
- (a->addr.plan < sizeof(ptab) / sizeof(ptab[0]) &&
- ptab[a->addr.plan] != NULL) ? ptab[a->addr.plan] : "?",
- a->addr.len);
- for (i = 0; i < a->addr.len; i++)
- cc_dumpf(d, "%02x", a->addr.addr[i]);
- cc_dumpf(d, "\n");
- }
- LIST_FOREACH(c, &p->conn_list, port_link)
- cc_dump_conn(d, c, " ");
-}
-
-/*
- * Produce a textual dump of the state
- */
-int
-cc_dump(struct ccdata *cc, size_t maxsiz, cc_dump_f func, void *uarg)
-{
- struct dump d;
- struct ccuser *user;
- struct ccconn *conn;
- struct ccport *port;
-
- d.ret = 0;
- d.uarg = uarg;
- d.maxsiz = maxsiz;
- d.cc = cc;
- d.func = func;
- d.buf = CCMALLOC(maxsiz);
- if (d.buf == NULL)
- return (ENOMEM);
- d.len = 0;
-
- cc_dumpf(&d, "dump of node %p\n", cc);
-
- TAILQ_FOREACH(port, &cc->port_list, node_link)
- cc_dump_port(&d, port);
-
- LIST_FOREACH(user, &cc->user_list, node_link)
- cc_dump_user(&d, user);
-
- cc_dumpf(&d, "orphaned conns:\n");
- LIST_FOREACH(conn, &cc->orphaned_conns, port_link)
- cc_dump_conn(&d, conn, "");
-
- if (d.len > 0 && d.ret == 0)
- d.ret = d.func(d.cc, d.uarg, d.buf);
-
- CCFREE(d.buf);
- return (d.ret);
-}
diff --git a/sys/contrib/ngatm/netnatm/api/cc_port.c b/sys/contrib/ngatm/netnatm/api/cc_port.c
deleted file mode 100644
index f01a723260b2..000000000000
--- a/sys/contrib/ngatm/netnatm/api/cc_port.c
+++ /dev/null
@@ -1,923 +0,0 @@
-/*
- * Copyright (c) 2003-2004
- * Hartmut Brandt
- * All rights reserved.
- *
- * Copyright (c) 2001-2002
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution of this software and documentation and use in source and
- * binary forms, with or without modification, are permitted provided that
- * the following conditions are met:
- *
- * 1. Redistributions of source code or documentation must retain the above
- * copyright notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
- * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/api/cc_port.c,v 1.1 2004/07/08 08:21:53 brandt Exp $
- *
- * ATM API as defined per af-saa-0108
- *
- * Port-global stuff (ILMI and Co.)
- */
-#include <netnatm/unimsg.h>
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/api/unisap.h>
-#include <netnatm/sig/unidef.h>
-#include <netnatm/api/atmapi.h>
-#include <netnatm/api/ccatm.h>
-#include <netnatm/api/ccpriv.h>
-
-/*
- * Find a port with a given number
- */
-static struct ccport *
-find_port(struct ccdata *cc, u_int portno)
-{
- struct ccport *port;
-
- TAILQ_FOREACH(port, &cc->port_list, node_link)
- if (port->param.port == portno)
- return (port);
- return (NULL);
-}
-
-/*
- * Create a new port structure, initialize it and link it to the node.
- * Returns 0 on success, an errno otherwise.
- */
-struct ccport *
-cc_port_create(struct ccdata *cc, void *uarg, u_int portno)
-{
- struct ccport *port, *p1;
-
- if (portno == 0 || portno > 0xffffffff)
- return (NULL);
-
- TAILQ_FOREACH(port, &cc->port_list, node_link)
- if (port->param.port == portno)
- return (NULL);
-
- port = CCZALLOC(sizeof(*port));
- if (port == NULL)
- return (NULL);
-
- port->uarg = uarg;
- port->cc = cc;
- port->admin = CCPORT_STOPPED;
- LIST_INIT(&port->conn_list);
- TAILQ_INIT(&port->addr_list);
- port->param.port = portno;
- port->param.pcr = 350053;
- port->param.max_vpi_bits = 0;
- port->param.max_vci_bits = 8;
- port->param.max_svpc_vpi = 0;
- port->param.max_svcc_vpi = 0;
- port->param.min_svcc_vci = 32;
- port->param.num_addrs = 0;
- TAILQ_INIT(&port->cookies);
-
- TAILQ_FOREACH(p1, &cc->port_list, node_link)
- if (p1->param.port > portno) {
- TAILQ_INSERT_BEFORE(p1, port, node_link);
- break;
- }
- if (p1 == NULL)
- TAILQ_INSERT_TAIL(&cc->port_list, port, node_link);
-
- return (port);
-}
-
-/*
- * Destroy a port. This closes all connections and aborts all the users of
- * these connections.
- * This should be called only after work has returned so that no signals
- * are pending.
- */
-void
-cc_port_destroy(struct ccport *port, int shutdown)
-{
- struct ccaddr *addr;
- struct ccreq *r;
-
- TAILQ_REMOVE(&port->cc->port_list, port, node_link);
-
- while ((r = TAILQ_FIRST(&port->cookies)) != NULL) {
- TAILQ_REMOVE(&port->cookies, r, link);
- CCFREE(r);
- }
-
- /*
- * Abort all connections.
- */
- while (!LIST_EMPTY(&port->conn_list))
- cc_conn_abort(LIST_FIRST(&port->conn_list), shutdown);
-
- /*
- * Free addresses.
- */
- while ((addr = TAILQ_FIRST(&port->addr_list)) != NULL) {
- TAILQ_REMOVE(&port->addr_list, addr, port_link);
- CCFREE(addr);
- }
-
- CCFREE(port);
-}
-
-/*
- * Management is given up on this node. Remove all addresses from the port.
- */
-void
-cc_unmanage(struct ccdata *cc)
-{
- struct ccport *port;
- struct ccaddr *addr;
-
- TAILQ_FOREACH(port, &cc->port_list, node_link) {
- while ((addr = TAILQ_FIRST(&port->addr_list)) != NULL) {
- TAILQ_REMOVE(&port->addr_list, addr, port_link);
- CCFREE(addr);
- }
- }
-}
-
-/*
- * Compare two addresses
- */
-static __inline int
-addr_eq(const struct uni_addr *a1, const struct uni_addr *a2)
-{
- return (a1->type == a2->type && a1->plan == a2->plan &&
- a1->len == a2->len && memcmp(a1->addr, a2->addr, a1->len) == 0);
-}
-
-
-/*
- * retrieve addresses
- */
-int
-cc_get_addrs(struct ccdata *cc, u_int portno,
- struct uni_addr **pa, u_int **ports, u_int *count)
-{
- struct ccport *port = NULL;
- struct ccaddr *addr;
- struct uni_addr *buf, *ptr;
- u_int *pports;
-
- /*
- * If a port number is specified and the port does not exist,
- * return an error.
- */
- if (portno != 0)
- if ((port = find_port(cc, portno)) == NULL)
- return (ENOENT);
-
- /*
- * Count the addresses
- */
- *count = 0;
- if (portno != 0) {
- TAILQ_FOREACH(addr, &port->addr_list, port_link)
- (*count)++;
- } else {
- TAILQ_FOREACH(port, &cc->port_list, node_link)
- TAILQ_FOREACH(addr, &port->addr_list, port_link)
- (*count)++;
- }
-
- buf = CCMALLOC(*count * sizeof(struct uni_addr));
- if (buf == NULL)
- return (ENOMEM);
- ptr = buf;
-
- *ports = CCMALLOC(*count * sizeof(u_int));
- if (*ports == NULL) {
- CCFREE(buf);
- return (ENOMEM);
- }
- pports = *ports;
-
- if (portno != 0) {
- TAILQ_FOREACH(addr, &port->addr_list, port_link) {
- *ptr++ = addr->addr;
- *pports++ = portno;
- }
- } else {
- TAILQ_FOREACH(port, &cc->port_list, node_link)
- TAILQ_FOREACH(addr, &port->addr_list, port_link) {
- *ptr++ = addr->addr;
- *pports++ = port->param.port;
- }
- }
-
- *pa = buf;
- return (0);
-}
-
-/*
- * return port number
- */
-u_int
-cc_port_no(struct ccport *port)
-{
- return (port->param.port);
-}
-
-/*
- * Address unregisterd.
- */
-int
-cc_addr_unregister(struct ccdata *cc, u_int portno, const struct uni_addr *arg)
-{
- struct ccport *port;
- struct ccaddr *a;
-
- if ((port = find_port(cc, portno)) == NULL)
- return (ENOENT);
-
- /* Find the address */
- TAILQ_FOREACH(a, &port->addr_list, port_link)
- if (addr_eq(arg, &a->addr)) {
- TAILQ_REMOVE(&port->addr_list, a, port_link);
- CCFREE(a);
- return (0);
- }
-
- return (ENOENT);
-}
-
-/*
- * Address registerd.
- */
-int
-cc_addr_register(struct ccdata *cc, u_int portno, const struct uni_addr *arg)
-{
- struct ccport *port, *p1;
- struct ccaddr *a;
-
- if ((port = find_port(cc, portno)) == NULL)
- return (ENOENT);
-
- /* maybe we know it already? */
- TAILQ_FOREACH(p1, &port->cc->port_list, node_link)
- TAILQ_FOREACH(a, &p1->addr_list, port_link)
- if (addr_eq(arg, &a->addr))
- return (EISCONN);
-
- a = CCZALLOC(sizeof(*a));
- if (a == NULL)
- return (ENOMEM);
- a->addr = *arg;
-
- TAILQ_INSERT_TAIL(&port->addr_list, a, port_link);
-
- return (0);
-}
-
-/*
- * Set/get port parameters.
- */
-int
-cc_port_get_param(struct ccdata *cc, u_int portno,
- struct atm_port_info *param)
-{
- struct ccport *port;
-
- if ((port = find_port(cc, portno)) == NULL)
- return (ENOENT);
-
- *param = port->param;
- return (0);
-}
-
-/* XXX maybe allow only in stopped. */
-int
-cc_port_set_param(struct ccdata *cc, const struct atm_port_info *param)
-{
- struct ccport *port;
- struct ccaddr *addr;
-
- if ((port = find_port(cc, param->port)) == NULL)
- return (ENOENT);
-
- port->param = *param;
-
- port->param.num_addrs = 0;
- TAILQ_FOREACH(addr, &port->addr_list, port_link)
- port->param.num_addrs++;
-
- return (0);
-}
-
-/*
- * get port list
- */
-int
-cc_port_getlist(struct ccdata *cc, u_int *cnt, u_int **ports)
-{
- struct ccport *p;
- u_int n;
-
- n = 0;
- TAILQ_FOREACH(p, &cc->port_list, node_link)
- n++;
-
- *ports = CCMALLOC(n * sizeof(u_int));
- if (*ports == NULL)
- return (ENOMEM);
-
- n = 0;
- TAILQ_FOREACH(p, &cc->port_list, node_link)
- (*ports)[n++] = p->param.port;
- *cnt = n;
-
- return (0);
-}
-
-/*
- * START and STOP signalling
- */
-int
-cc_port_start(struct ccdata *cc, u_int portno)
-{
- struct ccport *port;
-
- if ((port = find_port(cc, portno)) == NULL)
- return (ENOENT);
- if (port->admin != CCPORT_STOPPED)
- return (EISCONN);
-
- cc->funcs->send_uni_glob(port, port->uarg,
- UNIAPI_LINK_ESTABLISH_request, 0, NULL);
- port->admin = CCPORT_RUNNING;
-
- return (0);
-}
-
-int
-cc_port_stop(struct ccdata *cc, u_int portno)
-{
- struct ccport *port;
-
- if ((port = find_port(cc, portno)) == NULL)
- return (ENOENT);
- if (port->admin != CCPORT_RUNNING)
- return (ENOTCONN);
-
- port->admin = CCPORT_STOPPED;
-
- /*
- * Abort all connections.
- */
- while (!LIST_EMPTY(&port->conn_list))
- cc_conn_destroy(LIST_FIRST(&port->conn_list));
-
- return (0);
-}
-
-/*
- * is port running?
- */
-int
-cc_port_isrunning(struct ccdata *cc, u_int portno, int *state)
-{
- struct ccport *port;
-
- if ((port = find_port(cc, portno)) == NULL)
- return (ENOENT);
- if (port->admin == CCPORT_RUNNING)
- *state = 1;
- else
- *state = 0;
- return (0);
-}
-
-/*
- * Clear address and prefix information from the named port.
- */
-int
-cc_port_clear(struct ccdata *cc, u_int portno)
-{
- struct ccaddr *addr;
- struct ccport *port;
-
- if ((port = find_port(cc, portno)) == NULL)
- return (ENOENT);
-
- while ((addr = TAILQ_FIRST(&port->addr_list)) != NULL) {
- TAILQ_REMOVE(&port->addr_list, addr, port_link);
- CCFREE(addr);
- }
- return (0);
-}
-
-/*
- * retrieve info on local ports
- */
-struct atm_port_list *
-cc_get_local_port_info(struct ccdata *cc, u_int portno, size_t *lenp)
-{
- struct atm_port_list *list;
- struct atm_port_info *pp;
- struct uni_addr *aa;
- struct ccaddr *addr;
- struct ccport *port;
- u_int nports, naddrs;
-
- /*
- * Count ports and addresses.
- */
- nports = 0;
- naddrs = 0;
- TAILQ_FOREACH(port, &cc->port_list, node_link) {
- if (portno == 0 || port->param.port == portno) {
- nports++;
- TAILQ_FOREACH(addr, &port->addr_list, port_link)
- naddrs++;
- }
- }
-
- /*
- * Size and allocate message
- */
- *lenp = sizeof(*list) + nports * sizeof(*pp) + naddrs * sizeof(*aa);
-
- list = CCZALLOC(*lenp);
- if (list == NULL)
- return (NULL);
-
- /*
- * Fill the message.
- */
- list->num_ports = nports;
- list->num_addrs = naddrs;
-
- pp = (void *)((u_char *)list + sizeof(*list));
- aa = (void *)((u_char *)list + sizeof(*list) + nports * sizeof(*pp));
-
- TAILQ_FOREACH(port, &cc->port_list, node_link) {
- if (portno == 0 || port->param.port == portno) {
- *pp = port->param;
- pp->num_addrs = 0;
- TAILQ_FOREACH(addr, &port->addr_list, port_link) {
- *aa++ = addr->addr;
- pp->num_addrs++;
- }
- pp++;
- }
- }
-
- return (list);
-}
-
-static struct ccreq *
-find_cookie(struct ccport *port, u_int cookie)
-{
- struct ccreq *r;
-
- TAILQ_FOREACH(r, &port->cookies, link)
- if (r->cookie == cookie)
- return (r);
- return (NULL);
-}
-
-/*
- * input a response from the UNI layer to CC
- */
-int
-cc_uni_response(struct ccport *port, u_int cookie, u_int reason, u_int state)
-{
- struct ccconn *conn;
- struct ccreq *req;
-
- if (cookie == 0)
- return (EINVAL);
-
- if (port->admin != CCPORT_RUNNING)
- return (ENOTCONN);
-
- if ((req = find_cookie(port, cookie)) == NULL) {
- cc_port_log(port, "UNI response for unknown cookie %u", cookie);
- return (EINVAL);
- }
- conn = req->conn;
-
- TAILQ_REMOVE(&port->cookies, req, link);
- CCFREE(req);
-
- if (reason == UNIAPI_OK)
- return (cc_conn_resp(conn, CONN_SIG_OK,
- cookie, reason, state));
- else
- return (cc_conn_resp(conn, CONN_SIG_ERROR,
- cookie, reason, state));
-}
-
-static struct ccconn *
-find_cref(const struct ccport *port, const struct uni_cref *cref)
-{
- struct ccconn *conn;
-
- LIST_FOREACH(conn, &port->conn_list, port_link)
- if (conn->cref.cref == cref->cref &&
- conn->cref.flag == cref->flag)
- return (conn);
- return (NULL);
-}
-
-/*
- * Signal from UNI on this port
- */
-int
-cc_uni_signal(struct ccport *port, u_int cookie, u_int sig, struct uni_msg *msg)
-{
- int error = 0;
- size_t len, ilen = 0;
- struct uni_cref *cref;
- struct ccconn *conn;
-
- if (port->admin != CCPORT_RUNNING) {
- error = ENOTCONN;
- goto out;
- }
- len = (msg != NULL) ? uni_msg_len(msg) : 0;
-
- switch ((enum uni_sig)sig) {
-
- case UNIAPI_ERROR:
- /* handled above */
- cc_port_log(port, "bad UNIAPI_ERROR cookie=%u", cookie);
- error = EINVAL;
- break;
-
- case UNIAPI_CALL_CREATED:
- ilen = sizeof(struct uniapi_call_created);
- if (len != ilen)
- goto bad_len;
-
- if (cookie != 0) {
- /* outgoing call */
- struct ccreq *req;
-
- if ((req = find_cookie(port, cookie)) == NULL) {
- cc_port_log(port, "bad cookie %u in CREATE",
- cookie);
- error = EINVAL;
- goto out;
- }
- conn = req->conn;
-
- } else {
- if ((conn = cc_conn_create(port->cc)) == NULL) {
- error = ENOMEM;
- goto out;
- }
- cc_conn_ins_port(conn, port);
- }
-
- cc_conn_sig_msg_nodef(conn, CONN_SIG_CREATED, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_CALL_DESTROYED:
- ilen = sizeof(struct uniapi_call_destroyed);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_call_destroyed *)->cref;
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig(conn, CONN_SIG_DESTROYED, NULL);
- goto out;
-
- case UNIAPI_LINK_ESTABLISH_confirm:
- goto out;
-
- case UNIAPI_LINK_RELEASE_confirm:
- /* Ups. If we administratively up, restart the link */
- if (port->admin == CCPORT_RUNNING)
- port->cc->funcs->send_uni_glob(port, port->uarg,
- UNIAPI_LINK_ESTABLISH_request, 0, NULL);
- goto out;
-
- case UNIAPI_PARTY_CREATED:
- ilen = sizeof(struct uniapi_party_created);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_party_created *)->cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg_nodef(conn,
- CONN_SIG_PARTY_CREATED, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_PARTY_DESTROYED:
- ilen = sizeof(struct uniapi_party_destroyed);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg,
- struct uniapi_party_destroyed *)->cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_PARTY_DESTROYED, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_DROP_PARTY_ACK_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_drop_party_ack_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg,
- struct uniapi_drop_party_ack_indication *)->drop.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_DROP_PARTY_ACK_IND, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_RESET_indication: /* UNI -> API */
- {
- /*
- * XXX - do the right thing
- */
- struct uniapi_reset_indication *ind = uni_msg_rptr(msg,
- struct uniapi_reset_indication *);
- struct uniapi_reset_response *resp;
- struct uni_msg *u;
-
- /*
- * Construct message to UNI.
- */
- if ((u = uni_msg_alloc(sizeof(*resp))) == NULL)
- return (ENOMEM);
-
- resp = uni_msg_wptr(u, struct uniapi_reset_response *);
- memset(resp, 0, sizeof(*resp));
- u->b_wptr += sizeof(*resp);
-
- resp->restart = ind->restart;
- resp->connid = ind->connid;
-
- port->cc->funcs->send_uni_glob(port, port->uarg,
- UNIAPI_RESET_response, 0, u);
-
- goto out;
- }
-
- case UNIAPI_RELEASE_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_release_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_release_indication *)
- ->release.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_REL_IND, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_RELEASE_confirm: /* UNI -> API */
- ilen = sizeof(struct uniapi_release_confirm);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_release_confirm *)
- ->release.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_REL_CONF, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_SETUP_confirm: /* UNI -> API */
- ilen = sizeof(struct uniapi_setup_confirm);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_setup_confirm *)
- ->connect.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_SETUP_CONFIRM, msg);
- msg = NULL;
- goto out;
-
-
- case UNIAPI_ALERTING_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_alerting_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_alerting_indication *)
- ->alerting.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_ALERTING_IND, msg);
- msg = NULL;
- goto out;
-
-
- case UNIAPI_PROCEEDING_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_proceeding_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_proceeding_indication *)
- ->call_proc.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_PROC_IND, msg);
- msg = NULL;
- goto out;
-
-
- case UNIAPI_SETUP_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_setup_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_setup_indication *)
- ->setup.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_SETUP_IND, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_SETUP_COMPLETE_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_setup_complete_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg,
- struct uniapi_setup_complete_indication *)
- ->connect_ack.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_SETUP_COMPL, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_PARTY_ALERTING_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_party_alerting_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg,
- struct uniapi_party_alerting_indication *)->alert.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_PARTY_ALERTING_IND, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_ADD_PARTY_ACK_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_add_party_ack_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg,
- struct uniapi_add_party_ack_indication *)->ack.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_PARTY_ADD_ACK_IND, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_ADD_PARTY_REJ_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_add_party_rej_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg,
- struct uniapi_add_party_rej_indication *)->rej.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_PARTY_ADD_REJ_IND, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_DROP_PARTY_indication: /* UNI -> API */
- ilen = sizeof(struct uniapi_drop_party_indication);
- if (len != ilen)
- goto bad_len;
-
- cref = &uni_msg_rptr(msg, struct uniapi_drop_party_indication *)
- ->drop.hdr.cref;
-
- if ((conn = find_cref(port, cref)) == NULL)
- goto unk_call;
-
- error = cc_conn_sig_msg(conn, CONN_SIG_DROP_PARTY_IND, msg);
- msg = NULL;
- goto out;
-
- case UNIAPI_RESET_confirm: /* UNI -> API */
- case UNIAPI_RESET_ERROR_indication: /* UNI -> API */
- case UNIAPI_RESET_STATUS_indication: /* UNI -> API */
- /* XXX */
- goto out;
-
- case UNIAPI_NOTIFY_indication: /* UNI -> API */
- case UNIAPI_STATUS_indication: /* UNI -> API */
- break;
-
- case UNIAPI_ADD_PARTY_indication: /* UNI -> API */
- /* not supported by the API */
- break;
-
- /*
- * All these are illegal in this direction
- */
- case UNIAPI_LINK_ESTABLISH_request: /* API -> UNI */
- case UNIAPI_LINK_RELEASE_request: /* API -> UNI */
- case UNIAPI_RESET_request: /* API -> UNI */
- case UNIAPI_RESET_response: /* API -> UNI */
- case UNIAPI_RESET_ERROR_response: /* API -> UNI */
- case UNIAPI_SETUP_request: /* API -> UNI */
- case UNIAPI_SETUP_response: /* API -> UNI */
- case UNIAPI_ALERTING_request: /* API -> UNI */
- case UNIAPI_PROCEEDING_request: /* API -> UNI */
- case UNIAPI_RELEASE_request: /* API -> UNI */
- case UNIAPI_RELEASE_response: /* API -> UNI */
- case UNIAPI_NOTIFY_request: /* API -> UNI */
- case UNIAPI_STATUS_ENQUIRY_request: /* API -> UNI */
- case UNIAPI_ADD_PARTY_request: /* API -> UNI */
- case UNIAPI_PARTY_ALERTING_request: /* API -> UNI */
- case UNIAPI_ADD_PARTY_ACK_request: /* API -> UNI */
- case UNIAPI_ADD_PARTY_REJ_request: /* API -> UNI */
- case UNIAPI_DROP_PARTY_request: /* API -> UNI */
- case UNIAPI_DROP_PARTY_ACK_request: /* API -> UNI */
- case UNIAPI_ABORT_CALL_request: /* API -> UNI */
- case UNIAPI_SETUP_COMPLETE_request: /* API -> UNI */
- case UNIAPI_MAXSIG:
- break;
- }
- cc_port_log(port, "bad signal %u", sig);
- error = EINVAL;
- goto out;
-
- bad_len:
- cc_port_log(port, "signal %u bad length: %zu, need %zu", len, ilen);
- error = EINVAL;
- goto out;
-
- unk_call:
- cc_port_log(port, "unknown call %u/%u", cref->cref, cref->flag);
- error = EINVAL;
-
- out:
- if (msg != NULL)
- uni_msg_destroy(msg);
- return (error);
-}
-
diff --git a/sys/contrib/ngatm/netnatm/api/cc_sig.c b/sys/contrib/ngatm/netnatm/api/cc_sig.c
deleted file mode 100644
index ae6fcce51229..000000000000
--- a/sys/contrib/ngatm/netnatm/api/cc_sig.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
-* Copyright (c) 2004
-* Hartmut Brandt
-* All rights reserved.
-*
-* Author: Harti Brandt <harti@freebsd.org>
-*
-* Redistribution of this software and documentation and use in source and
-* binary forms, with or without modification, are permitted provided that
-* the following conditions are met:
-*
-* 1. Redistributions of source code or documentation must retain the above
-* copyright notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
-* AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-* THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-* $Begemot: libunimsg/netnatm/api/cc_sig.c,v 1.1 2004/07/08 08:21:54 brandt Exp $
-*
-* ATM API as defined per af-saa-0108
-*
-* Generic signal handling
-*/
-#include <netnatm/unimsg.h>
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/msg/unimsglib.h>
-#include <netnatm/api/unisap.h>
-#include <netnatm/sig/unidef.h>
-#include <netnatm/api/atmapi.h>
-#include <netnatm/api/ccatm.h>
-#include <netnatm/api/ccpriv.h>
-
-enum {
- SIG_USER,
- SIG_CONN,
-};
-
-struct ccsig {
- u_char type; /* type of target */
- u_char has_msg; /* arg1 is a message */
- void *target; /* target instance */
- u_int sig; /* signal */
- void *arg1; /* argument */
- u_int arg2; /* argument */
- TAILQ_ENTRY(ccsig) link;
-};
-
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_sig_log(CC, FMT, ARGS...) do { \
- if ((CC)->log & CCLOG_SIGS) \
- (CC)->funcs->log("%s: " FMT, __FUNCTION__ , ## ARGS); \
- } while (0)
-#else
-#define cc_sig_log(CC, FMT, ...) do { \
- if ((CC)->log & CCLOG_SIGS) \
- (CC)->funcs->log("%s: " FMT, __func__, __VA_ARGS__); \
- } while (0)
-#endif
-
-
-const char *const cc_user_sigtab[] = {
-#define DEF(N) [USER_SIG_##N] = #N,
-USER_SIGS
-#undef DEF
-};
-
-const char *const cc_conn_sigtab[] = {
-#define DEF(N) [CONN_SIG_##N] = #N,
-CONN_SIGS
-#undef DEF
-};
-
-
-/*
- * Allocate and populate a signal
- */
-static /* __inline */ struct ccsig *
-sig_alloc(struct ccdata *cc, u_int type, void *target, u_int has_msg,
- u_int sig, void *arg1, u_int arg2)
-{
- struct ccsig *s;
-
- if ((s = TAILQ_FIRST(&cc->free_sigs)) == NULL) {
- s = CCZALLOC(sizeof(struct ccsig));
- if (s == NULL) {
- cc_log(cc, "signal %u/%u lost - ENOMEM", type, sig);
- return (NULL);
- }
- } else
- TAILQ_REMOVE(&cc->free_sigs, s, link);
-
- s->type = type;
- s->has_msg = has_msg;
- s->target = target;
- s->sig = sig;
- s->arg1 = arg1;
- s->arg2 = arg2;
-
- return (s);
-}
-
-/*
- * Queue a signal to this user
- */
-int
-cc_user_sig(struct ccuser *user, enum user_sig sig, void *arg1, u_int arg2)
-{
- struct ccsig *s;
-
- s = sig_alloc(user->cc, SIG_USER, user, 0, sig, arg1, arg2);
- if (s == NULL)
- return (ENOMEM);
- TAILQ_INSERT_TAIL(&user->cc->sigs, s, link);
- cc_sig_log(user->cc, "queuing sig %s to user %p", cc_user_sigtab[sig],
- user);
- return (0);
-}
-
-/* Queue a signal with message to this user */
-int
-cc_user_sig_msg(struct ccuser *user, enum user_sig sig, struct uni_msg *msg)
-{
- struct ccsig *s;
-
- s = sig_alloc(user->cc, SIG_USER, user, msg != NULL, sig, msg, 0);
- if (s == NULL)
- return (ENOMEM);
- TAILQ_INSERT_TAIL(&user->cc->sigs, s, link);
- cc_sig_log(user->cc, "queuing sig %s to user %p", cc_user_sigtab[sig],
- user);
- return (0);
-}
-
-/*
- * Signal to connection
- */
-static int
-sig_conn(struct ccconn *conn, enum conn_sig sig, u_int has_msg, void *arg)
-{
- struct ccsig *s;
- const struct ccreq *r = NULL;
-
- s = sig_alloc(conn->cc, SIG_CONN, conn, has_msg, sig, arg, 0);
- if (s == NULL)
- return (ENOMEM);
-
- if (conn->port != NULL) {
- /* argh */
- TAILQ_FOREACH(r, &conn->port->cookies, link)
- if (r->conn == conn)
- break;
- }
- if (r == NULL) {
- TAILQ_INSERT_TAIL(&conn->cc->sigs, s, link);
- cc_sig_log(conn->cc, "queuing sig %s to conn %p",
- cc_conn_sigtab[sig], conn);
- } else {
- TAILQ_INSERT_TAIL(&conn->cc->def_sigs, s, link);
- cc_sig_log(conn->cc, "queuing defered sig %s to conn %p",
- cc_conn_sigtab[sig], conn);
- }
- return (0);
-}
-
-/*
- * Queue a signal to a connection.
- */
-int
-cc_conn_sig(struct ccconn *conn, enum conn_sig sig, void *arg1)
-{
-
- return (sig_conn(conn, sig, 0, arg1));
-}
-
-/*
- * signal with message to connection
- */
-int
-cc_conn_sig_msg(struct ccconn *conn, enum conn_sig sig, struct uni_msg *msg)
-{
-
- return (sig_conn(conn, sig, (msg != NULL), msg));
-}
-int
-cc_conn_sig_msg_nodef(struct ccconn *conn, enum conn_sig sig,
- struct uni_msg *msg)
-{
- struct ccsig *s;
-
- s = sig_alloc(conn->cc, SIG_CONN, conn, (msg != NULL), sig, msg, 0);
- if (s == NULL)
- return (ENOMEM);
-
- TAILQ_INSERT_TAIL(&conn->cc->sigs, s, link);
- cc_sig_log(conn->cc, "queuing sig %s to conn %p",
- cc_conn_sigtab[sig], conn);
-
- return (0);
-}
-
-/*
- * Queue a response signal to a connection.
- */
-int
-cc_conn_resp(struct ccconn *conn, enum conn_sig sig, u_int cookie __unused,
- u_int reason, u_int state)
-{
- struct ccsig *s, *s1, *s2;
-
- s = sig_alloc(conn->cc, SIG_CONN, conn, 0, sig, NULL,
- ((reason & 0xffff) << 16) | (state & 0xffff));
- if (s == NULL)
- return (ENOMEM);
-
- TAILQ_INSERT_TAIL(&conn->cc->sigs, s, link);
-
- cc_sig_log(conn->cc, "queuing response %s to conn %p",
- cc_conn_sigtab[sig], conn);
-
- s1 = TAILQ_FIRST(&conn->cc->def_sigs);
- while (s1 != NULL) {
- s2 = TAILQ_NEXT(s1, link);
- if (s1->type == SIG_CONN && s1->target == conn) {
- TAILQ_REMOVE(&conn->cc->def_sigs, s1, link);
- TAILQ_INSERT_AFTER(&conn->cc->sigs, s, s1, link);
- cc_sig_log(conn->cc, "undefering sig %s to conn %p",
- cc_conn_sigtab[s1->sig], conn);
- s = s1;
- }
- s1 = s2;
- }
-
- return (0);
-}
-
-/*
- * Flush all signals to a given target from both queues
- */
-static /* __inline */ void
-sig_flush(struct ccdata *cc, u_int type, void *target)
-{
- struct ccsig *s, *s1;
-
- s = TAILQ_FIRST(&cc->sigs);
- while (s != NULL) {
- s1 = TAILQ_NEXT(s, link);
- if (s->type == type && s->target == target) {
- if (s->has_msg)
- uni_msg_destroy((struct uni_msg *)s->arg1);
- TAILQ_REMOVE(&cc->sigs, s, link);
- TAILQ_INSERT_HEAD(&cc->free_sigs, s, link);
- }
- s = s1;
- }
-
- s = TAILQ_FIRST(&cc->def_sigs);
- while (s != NULL) {
- s1 = TAILQ_NEXT(s, link);
- if (s->type == type && s->target == target) {
- if (s->has_msg)
- uni_msg_destroy((struct uni_msg *)s->arg1);
- TAILQ_REMOVE(&cc->def_sigs, s, link);
- TAILQ_INSERT_HEAD(&cc->free_sigs, s, link);
- }
- s = s1;
- }
-}
-
-/*
- * Flush all signals to this user
- */
-void
-cc_user_sig_flush(struct ccuser *user)
-{
-
- cc_sig_log(user->cc, "flushing signals to user %p", user);
- sig_flush(user->cc, SIG_USER, user);
-}
-
-/*
- * Flush all signals to this connection
- */
-void
-cc_conn_sig_flush(struct ccconn *conn)
-{
-
- cc_sig_log(conn->cc, "flushing signals to conn %p", conn);
- sig_flush(conn->cc, SIG_CONN, conn);
-}
-
-/*
- * Do the work
- */
-void
-cc_work(struct ccdata *cc)
-{
- struct ccsig *s;
-
- cc_sig_log(cc, "start %s", "work");
- while ((s = TAILQ_FIRST(&cc->sigs)) != NULL) {
- TAILQ_REMOVE(&cc->sigs, s, link);
- if (s->type == SIG_USER)
- cc_user_sig_handle(s->target, s->sig, s->arg1, s->arg2);
- else {
- cc_conn_sig_handle(s->target, s->sig, s->arg1, s->arg2);
- if (s->has_msg)
- uni_msg_destroy(s->arg1);
- }
- TAILQ_INSERT_HEAD(&cc->free_sigs, s, link);
- }
- cc_sig_log(cc, "end %s", "work");
-}
-
-/*
- * flush all signals
- */
-void
-cc_sig_flush_all(struct ccdata *cc)
-{
- struct ccsig *s;
-
- while ((s = TAILQ_FIRST(&cc->sigs)) != NULL) {
- if (s->has_msg)
- uni_msg_destroy((struct uni_msg *)s->arg1);
- TAILQ_REMOVE(&cc->sigs, s, link);
- CCFREE(s);
- }
- while ((s = TAILQ_FIRST(&cc->def_sigs)) != NULL) {
- if (s->has_msg)
- uni_msg_destroy((struct uni_msg *)s->arg1);
- TAILQ_REMOVE(&cc->def_sigs, s, link);
- CCFREE(s);
- }
- while ((s = TAILQ_FIRST(&cc->free_sigs)) != NULL) {
- TAILQ_REMOVE(&cc->free_sigs, s, link);
- CCFREE(s);
- }
-}
diff --git a/sys/contrib/ngatm/netnatm/api/cc_user.c b/sys/contrib/ngatm/netnatm/api/cc_user.c
deleted file mode 100644
index 75ce91eb4e56..000000000000
--- a/sys/contrib/ngatm/netnatm/api/cc_user.c
+++ /dev/null
@@ -1,1922 +0,0 @@
-/*
- * Copyright (c) 2003-2004
- * Hartmut Brandt
- * All rights reserved.
- *
- * Copyright (c) 2001-2002
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution of this software and documentation and use in source and
- * binary forms, with or without modification, are permitted provided that
- * the following conditions are met:
- *
- * 1. Redistributions of source code or documentation must retain the above
- * copyright notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
- * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/api/cc_user.c,v 1.3 2004/07/16 18:46:55 brandt Exp $
- *
- * ATM API as defined per af-saa-0108
- *
- * User side (upper half)
- */
-
-#include <netnatm/unimsg.h>
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/msg/unimsglib.h>
-#include <netnatm/api/unisap.h>
-#include <netnatm/sig/unidef.h>
-#include <netnatm/api/atmapi.h>
-#include <netnatm/api/ccatm.h>
-#include <netnatm/api/ccpriv.h>
-
-/*
-* This file handles messages to a USER.
-*/
-static const char *stab[] = {
-#define DEF(N) [N] = #N,
- USER_STATES
-#undef DEF
-};
-
-const char *
-cc_user_state2str(u_int s)
-{
- if (s >= sizeof(stab) / sizeof(stab[0]) || stab[s] == NULL)
- return ("?");
- return (stab[s]);
-}
-
-static __inline void
-set_state(struct ccuser *user, enum user_state ns)
-{
- if (user->state != ns) {
- if (user->cc->log & CCLOG_USER_STATE)
- cc_user_log(user, "%s -> %s",
- stab[user->state], stab[ns]);
- user->state = ns;
- }
-}
-
-static __inline void
-cc_user_send(struct ccuser *user, u_int op, void *arg, size_t len)
-{
- user->cc->funcs->send_user(user, user->uarg, op, arg, len);
-}
-
-static __inline void
-cc_user_ok(struct ccuser *user, u_int data, void *arg, size_t len)
-{
- user->cc->funcs->respond_user(user, user->uarg,
- ATMERR_OK, data, arg, len);
-}
-
-static __inline void
-cc_user_err(struct ccuser *user, int err)
-{
- user->cc->funcs->respond_user(user, user->uarg,
- err, ATMRESP_NONE, NULL, 0);
-}
-
-
-/**********************************************************************
-*
-* INSTANCE MANAGEMENT
-*/
-/*
-* New endpoint created
-*/
-struct ccuser *
-cc_user_create(struct ccdata *cc, void *uarg, const char *name)
-{
- struct ccuser *user;
-
- user = CCZALLOC(sizeof(*user));
- if (user == NULL)
- return (NULL);
-
- user->cc = cc;
- user->state = USER_NULL;
- user->uarg = uarg;
- strncpy(user->name, name, sizeof(user->name));
- user->name[sizeof(user->name) - 1] = '\0';
- TAILQ_INIT(&user->connq);
- LIST_INSERT_HEAD(&cc->user_list, user, node_link);
-
- if (user->cc->log & CCLOG_USER_INST)
- cc_user_log(user, "created with name '%s'", name);
-
- return (user);
-}
-
-/*
- * Reset a user instance
- */
-static void
-cc_user_reset(struct ccuser *user)
-{
-
- CCASSERT(TAILQ_EMPTY(&user->connq), ("connq not empty"));
-
- if (user->sap != NULL) {
- CCFREE(user->sap);
- user->sap = NULL;
- }
-
- if (user->accepted != NULL) {
- user->accepted->acceptor = NULL;
- user->accepted = NULL;
- }
- user->config = USER_P2P;
- user->queue_act = 0;
- user->queue_max = 0;
- user->aborted = 0;
-
- set_state(user, USER_NULL);
-
- cc_user_sig_flush(user);
-}
-
-static void
-cc_user_abort(struct ccuser *user, const struct uni_ie_cause *cause)
-{
- struct ccconn *conn;
-
- /*
- * Although the standard state that 'all connections
- * associated with this endpoint are aborted' we only
- * have to abort the head one, because in state A6
- * (call present) the endpoint is only associated to the
- * head connection - the others are 'somewhere else' and
- * need to be redispatched.
- *
- * First bring user into a state that the connections
- * are not dispatched back to it.
- */
- set_state(user, USER_NULL);
- if (!user->aborted) {
- if ((conn = TAILQ_FIRST(&user->connq)) != NULL) {
- memset(conn->cause, 0, sizeof(conn->cause));
- if (cause != NULL)
- conn->cause[0] = *cause;
- cc_conn_reset_acceptor(conn);
- cc_disconnect_from_user(conn);
- cc_conn_sig(conn, CONN_SIG_USER_ABORT, NULL);
- }
- }
-
- while ((conn = TAILQ_FIRST(&user->connq)) != NULL) {
- /* these should be in C21 */
- cc_disconnect_from_user(conn);
- cc_conn_dispatch(conn);
- }
-
- cc_user_reset(user);
-}
-
-/*
- * Application has closed this endpoint. Clean up all user resources and
- * abort all connections. This can be called in any state.
- */
-void
-cc_user_destroy(struct ccuser *user)
-{
-
- if (user->cc->log & CCLOG_USER_INST)
- cc_user_log(user, "destroy '%s'", user->name);
-
- cc_user_abort(user, NULL);
-
- if (user->sap != NULL)
- CCFREE(user->sap);
-
- cc_user_sig_flush(user);
-
- LIST_REMOVE(user, node_link);
- CCFREE(user);
-}
-
-/**********************************************************************
- *
- * OUTGOING CALLS
- */
-/*
- * Return true when the calling address of the connection matches the address.
- */
-static int
-addr_matches(const struct ccaddr *addr, const struct ccconn *conn)
-{
-
- if (!IE_ISPRESENT(conn->calling))
- return (0);
-
- return (addr->addr.type == conn->calling.addr.type &&
- addr->addr.plan == conn->calling.addr.plan &&
- addr->addr.len == conn->calling.addr.len &&
- memcmp(addr->addr.addr, conn->calling.addr.addr,
- addr->addr.len) == 0);
-}
-
-/*
- * Check if the user's SAP (given he is in the right state) and
- * the given SAP overlap
- */
-static int
-check_overlap(struct ccuser *user, struct uni_sap *sap)
-{
- return ((user->state == USER_IN_PREPARING ||
- user->state == USER_IN_WAITING) &&
- unisve_overlap_sap(user->sap, sap));
-}
-
-/*
- * Send arrival notification to user
- */
-static void
-do_arrival(struct ccuser *user)
-{
- struct ccconn *conn;
-
- user->aborted = 0;
- if ((conn = TAILQ_FIRST(&user->connq)) != NULL) {
- set_state(user, USER_IN_ARRIVED);
- cc_user_send(user, ATMOP_ARRIVAL_OF_INCOMING_CALL, NULL, 0);
- cc_conn_sig(conn, CONN_SIG_ARRIVAL, NULL);
- }
-}
-
-/**********************************************************************
- *
- * ATTRIBUTES
- */
-/*
- * Query an attribute. This is possible only in some states: preparation
- * of an outgoing call, after an incoming call was offered to the application
- * and in the three active states (P2P, P2PLeaf, P2PRoot).
- */
-static struct ccconn *
-cc_query_check(struct ccuser *user)
-{
-
- switch (user->state) {
-
- case USER_OUT_PREPARING:
- case USER_IN_ARRIVED:
- case USER_ACTIVE:
- return (TAILQ_FIRST(&user->connq));
-
- case USER_NULL:
- /* if we are waiting for the SETUP_confirm, we are in
- * the NULL state still (we are the new endpoint), but
- * have a connection in 'accepted' that is in the
- * CONN_IN_WAIT_ACCEPT_OK state.
- */
- if (user->accepted != NULL &&
- user->accepted->state == CONN_IN_WAIT_ACCEPT_OK)
- return (user->accepted);
- /* FALLTHRU */
-
- default:
- return (NULL);
- }
-}
-
-/*
- * Query attributes
- */
-static void
-cc_attr_query(struct ccuser *user, struct ccconn *conn,
- uint32_t *attr, u_int count)
-{
- void *val, *ptr;
- size_t total, len;
- u_int i;
- uint32_t *atab;
-
- /* determine the length of the total attribute buffer */
- total = sizeof(uint32_t) + count * sizeof(uint32_t);
- for (i = 0; i < count; i++) {
- len = 0;
- switch ((enum atm_attribute)attr[i]) {
-
- case ATM_ATTR_NONE:
- break;
-
- case ATM_ATTR_BLLI_SELECTOR:
- len = sizeof(uint32_t);
- break;
-
- case ATM_ATTR_BLLI:
- len = sizeof(struct uni_ie_blli);
- break;
-
- case ATM_ATTR_BEARER:
- len = sizeof(struct uni_ie_bearer);
- break;
-
- case ATM_ATTR_TRAFFIC:
- len = sizeof(struct uni_ie_traffic);
- break;
-
- case ATM_ATTR_QOS:
- len = sizeof(struct uni_ie_qos);
- break;
-
- case ATM_ATTR_EXQOS:
- len = sizeof(struct uni_ie_exqos);
- break;
-
- case ATM_ATTR_CALLED:
- len = sizeof(struct uni_ie_called);
- break;
-
- case ATM_ATTR_CALLEDSUB:
- len = sizeof(struct uni_ie_calledsub);
- break;
-
- case ATM_ATTR_CALLING:
- len = sizeof(struct uni_ie_calling);
- break;
-
- case ATM_ATTR_CALLINGSUB:
- len = sizeof(struct uni_ie_callingsub);
- break;
-
- case ATM_ATTR_AAL:
- len = sizeof(struct uni_ie_aal);
- break;
-
- case ATM_ATTR_EPREF:
- len = sizeof(struct uni_ie_epref);
- break;
-
- case ATM_ATTR_CONNED:
- len = sizeof(struct uni_ie_conned);
- break;
-
- case ATM_ATTR_CONNEDSUB:
- len = sizeof(struct uni_ie_connedsub);
- break;
-
- case ATM_ATTR_EETD:
- len = sizeof(struct uni_ie_eetd);
- break;
-
- case ATM_ATTR_ABRSETUP:
- len = sizeof(struct uni_ie_abrsetup);
- break;
-
- case ATM_ATTR_ABRADD:
- len = sizeof(struct uni_ie_abradd);
- break;
-
- case ATM_ATTR_CONNID:
- len = sizeof(struct uni_ie_connid);
- break;
-
- case ATM_ATTR_MDCR:
- len = sizeof(struct uni_ie_mdcr);
- break;
- }
- if (len == 0) {
- cc_user_err(user, ATMERR_BAD_ATTR);
- return;
- }
- total += len;
- }
-
- /* allocate buffer */
- val = CCMALLOC(total);
- if (val == NULL)
- return;
-
- atab = val;
- atab[0] = count;
-
- /* fill */
- ptr = (u_char *)val + (sizeof(uint32_t) + count * sizeof(uint32_t));
- for (i = 0; i < count; i++) {
- len = 0;
- atab[i + 1] = attr[i];
- switch (attr[i]) {
-
- case ATM_ATTR_NONE:
- break;
-
- case ATM_ATTR_BLLI_SELECTOR:
- len = sizeof(uint32_t);
- memcpy(ptr, &conn->blli_selector, len);
- break;
-
- case ATM_ATTR_BLLI:
- /* in A6 the blli_selector may be 0 when
- * there was no blli in the SETUP.
- */
- len = sizeof(struct uni_ie_blli);
- if (conn->blli_selector == 0)
- memset(ptr, 0, len);
- else
- memcpy(ptr, &conn->blli[conn->blli_selector -
- 1], len);
- break;
-
- case ATM_ATTR_BEARER:
- len = sizeof(struct uni_ie_bearer);
- memcpy(ptr, &conn->bearer, len);
- break;
-
- case ATM_ATTR_TRAFFIC:
- len = sizeof(struct uni_ie_traffic);
- memcpy(ptr, &conn->traffic, len);
- break;
-
- case ATM_ATTR_QOS:
- len = sizeof(struct uni_ie_qos);
- memcpy(ptr, &conn->qos, len);
- break;
-
- case ATM_ATTR_EXQOS:
- len = sizeof(struct uni_ie_exqos);
- memcpy(ptr, &conn->exqos, len);
- break;
-
- case ATM_ATTR_CALLED:
- len = sizeof(struct uni_ie_called);
- memcpy(ptr, &conn->called, len);
- break;
-
- case ATM_ATTR_CALLEDSUB:
- len = sizeof(struct uni_ie_calledsub);
- memcpy(ptr, &conn->calledsub, len);
- break;
-
- case ATM_ATTR_CALLING:
- len = sizeof(struct uni_ie_calling);
- memcpy(ptr, &conn->calling, len);
- break;
-
- case ATM_ATTR_CALLINGSUB:
- len = sizeof(struct uni_ie_callingsub);
- memcpy(ptr, &conn->callingsub, len);
- break;
-
- case ATM_ATTR_AAL:
- len = sizeof(struct uni_ie_aal);
- memcpy(ptr, &conn->aal, len);
- break;
-
- case ATM_ATTR_EPREF:
- len = sizeof(struct uni_ie_epref);
- memcpy(ptr, &conn->epref, len);
- break;
-
- case ATM_ATTR_CONNED:
- len = sizeof(struct uni_ie_conned);
- memcpy(ptr, &conn->conned, len);
- break;
-
- case ATM_ATTR_CONNEDSUB:
- len = sizeof(struct uni_ie_connedsub);
- memcpy(ptr, &conn->connedsub, len);
- break;
-
- case ATM_ATTR_EETD:
- len = sizeof(struct uni_ie_eetd);
- memcpy(ptr, &conn->eetd, len);
- break;
-
- case ATM_ATTR_ABRSETUP:
- len = sizeof(struct uni_ie_abrsetup);
- memcpy(ptr, &conn->abrsetup, len);
- break;
-
- case ATM_ATTR_ABRADD:
- len = sizeof(struct uni_ie_abradd);
- memcpy(ptr, &conn->abradd, len);
- break;
-
- case ATM_ATTR_CONNID:
- len = sizeof(struct uni_ie_connid);
- memcpy(ptr, &conn->connid, len);
- break;
-
- case ATM_ATTR_MDCR:
- len = sizeof(struct uni_ie_mdcr);
- memcpy(ptr, &conn->mdcr, len);
- break;
- }
- ptr = (u_char *)ptr + len;
- }
-
- cc_user_ok(user, ATMRESP_ATTRS, val, total);
-
- CCFREE(val);
-}
-
-/*
- * Check whether the state is ok and return the connection
- */
-static struct ccconn *
-cc_set_check(struct ccuser *user)
-{
- switch(user->state) {
-
- case USER_OUT_PREPARING:
- case USER_IN_ARRIVED:
- return (TAILQ_FIRST(&user->connq));
-
- default:
- return (NULL);
- }
-}
-
-/*
- * Set connection attribute(s)
- */
-static void
-cc_attr_set(struct ccuser *user, struct ccconn *conn, uint32_t *attr,
- u_int count, u_char *val, size_t vallen)
-{
- size_t total, len;
- u_int i;
- u_char *ptr;
-
- /* determine the length of the total attribute buffer */
- total = 0;
- ptr = val;
- for (i = 0; i < count; i++) {
- len = 0;
- switch ((enum atm_attribute)attr[i]) {
-
- case ATM_ATTR_NONE:
- break;
-
- case ATM_ATTR_BLLI_SELECTOR:
- {
- uint32_t sel;
-
- if (conn->state != CONN_OUT_PREPARING)
- goto rdonly;
- memcpy(&sel, ptr, sizeof(sel));
- if (sel == 0 || sel > UNI_NUM_IE_BLLI)
- goto bad_val;
- len = sizeof(uint32_t);
- break;
- }
-
- case ATM_ATTR_BLLI:
- len = sizeof(struct uni_ie_blli);
- break;
-
- case ATM_ATTR_BEARER:
- if (conn->state != CONN_OUT_PREPARING)
- goto rdonly;
- len = sizeof(struct uni_ie_bearer);
- break;
-
- case ATM_ATTR_TRAFFIC:
- len = sizeof(struct uni_ie_traffic);
- break;
-
- case ATM_ATTR_QOS:
- if (conn->state != CONN_OUT_PREPARING)
- goto rdonly;
- len = sizeof(struct uni_ie_qos);
- break;
-
- case ATM_ATTR_EXQOS:
- len = sizeof(struct uni_ie_exqos);
- break;
-
- case ATM_ATTR_CALLED:
- goto rdonly;
-
- case ATM_ATTR_CALLEDSUB:
- if (conn->state != CONN_OUT_PREPARING)
- goto rdonly;
- len = sizeof(struct uni_ie_calledsub);
- break;
-
- case ATM_ATTR_CALLING:
- if (conn->state != CONN_OUT_PREPARING)
- goto rdonly;
- len = sizeof(struct uni_ie_calling);
- break;
-
- case ATM_ATTR_CALLINGSUB:
- if (conn->state != CONN_OUT_PREPARING)
- goto rdonly;
- len = sizeof(struct uni_ie_callingsub);
- break;
-
- case ATM_ATTR_AAL:
- len = sizeof(struct uni_ie_aal);
- break;
-
- case ATM_ATTR_EPREF:
- goto rdonly;
-
- case ATM_ATTR_CONNED:
- goto rdonly;
-
- case ATM_ATTR_CONNEDSUB:
- goto rdonly;
-
- case ATM_ATTR_EETD:
- len = sizeof(struct uni_ie_eetd);
- break;
-
- case ATM_ATTR_ABRSETUP:
- len = sizeof(struct uni_ie_abrsetup);
- break;
-
- case ATM_ATTR_ABRADD:
- len = sizeof(struct uni_ie_abradd);
- break;
-
- case ATM_ATTR_CONNID:
- len = sizeof(struct uni_ie_connid);
- break;
-
- case ATM_ATTR_MDCR:
- if (conn->state != CONN_OUT_PREPARING)
- goto rdonly;
- len = sizeof(struct uni_ie_mdcr);
- break;
- }
- if (len == 0) {
- cc_user_err(user, ATMERR_BAD_ATTR);
- return;
- }
- total += len;
- ptr += len;
- }
-
- /* check the length */
- if (vallen != total) {
- cc_user_err(user, ATMERR_BAD_ARGS);
- return;
- }
-
- ptr = val;
- for (i = 0; i < count; i++) {
- len = 0;
- switch ((enum atm_attribute)attr[i]) {
-
- case ATM_ATTR_NONE:
- break;
-
- case ATM_ATTR_BLLI_SELECTOR:
- {
- uint32_t sel;
-
- memcpy(&sel, ptr, sizeof(sel));
- conn->blli_selector = sel;
- len = sizeof(uint32_t);
- break;
- }
-
- case ATM_ATTR_BLLI:
- len = sizeof(struct uni_ie_blli);
- memcpy(&conn->blli[conn->blli_selector - 1], ptr, len);
- conn->dirty_attr |= CCDIRTY_BLLI;
- break;
-
- case ATM_ATTR_BEARER:
- len = sizeof(struct uni_ie_bearer);
- memcpy(&conn->bearer, ptr, len);
- break;
-
- case ATM_ATTR_TRAFFIC:
- len = sizeof(struct uni_ie_traffic);
- memcpy(&conn->traffic, ptr, len);
- conn->dirty_attr |= CCDIRTY_TRAFFIC;
- break;
-
- case ATM_ATTR_QOS:
- len = sizeof(struct uni_ie_qos);
- memcpy(&conn->qos, ptr, len);
- break;
-
- case ATM_ATTR_EXQOS:
- len = sizeof(struct uni_ie_exqos);
- memcpy(&conn->exqos, ptr, len);
- conn->dirty_attr |= CCDIRTY_EXQOS;
- break;
-
- case ATM_ATTR_CALLED:
- len = sizeof(struct uni_ie_called);
- break;
-
- case ATM_ATTR_CALLEDSUB:
- len = sizeof(struct uni_ie_calledsub);
- memcpy(&conn->calledsub, ptr, len);
- break;
-
- case ATM_ATTR_CALLING:
- len = sizeof(struct uni_ie_calling);
- memcpy(&conn->calling, ptr, len);
- break;
-
- case ATM_ATTR_CALLINGSUB:
- len = sizeof(struct uni_ie_callingsub);
- memcpy(&conn->callingsub, ptr, len);
- break;
-
- case ATM_ATTR_AAL:
- len = sizeof(struct uni_ie_aal);
- memcpy(&conn->aal, ptr, len);
- conn->dirty_attr |= CCDIRTY_AAL;
- break;
-
- case ATM_ATTR_EPREF:
- len = sizeof(struct uni_ie_epref);
- break;
-
- case ATM_ATTR_CONNED:
- len = sizeof(struct uni_ie_conned);
- break;
-
- case ATM_ATTR_CONNEDSUB:
- len = sizeof(struct uni_ie_connedsub);
- break;
-
- case ATM_ATTR_EETD:
- len = sizeof(struct uni_ie_eetd);
- memcpy(&conn->eetd, ptr, len);
- conn->dirty_attr |= CCDIRTY_EETD;
- break;
-
- case ATM_ATTR_ABRSETUP:
- len = sizeof(struct uni_ie_abrsetup);
- memcpy(&conn->abrsetup, ptr, len);
- conn->dirty_attr |= CCDIRTY_ABRSETUP;
- break;
-
- case ATM_ATTR_ABRADD:
- len = sizeof(struct uni_ie_abradd);
- memcpy(&conn->abradd, ptr, len);
- conn->dirty_attr |= CCDIRTY_ABRADD;
- break;
-
- case ATM_ATTR_CONNID:
- len = sizeof(struct uni_ie_connid);
- memcpy(&conn->connid, ptr, len);
- conn->dirty_attr |= CCDIRTY_CONNID;
- break;
-
- case ATM_ATTR_MDCR:
- len = sizeof(struct uni_ie_mdcr);
- memcpy(&conn->mdcr, ptr, len);
- break;
- }
- ptr += len;
- }
-
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- return;
-
- bad_val:
- cc_user_err(user, ATMERR_BAD_VALUE);
- return;
-
- rdonly:
- cc_user_err(user, ATMERR_RDONLY);
- return;
-}
-
-#ifdef CCATM_DEBUG
-static const char *op_names[] = {
-#define S(OP) [ATMOP_##OP] = #OP
- S(RESP),
- S(ABORT_CONNECTION),
- S(ACCEPT_INCOMING_CALL),
- S(ADD_PARTY),
- S(ADD_PARTY_REJECT),
- S(ADD_PARTY_SUCCESS),
- S(ARRIVAL_OF_INCOMING_CALL),
- S(CALL_RELEASE),
- S(CONNECT_OUTGOING_CALL),
- S(DROP_PARTY),
- S(GET_LOCAL_PORT_INFO),
- S(P2MP_CALL_ACTIVE),
- S(P2P_CALL_ACTIVE),
- S(PREPARE_INCOMING_CALL),
- S(PREPARE_OUTGOING_CALL),
- S(QUERY_CONNECTION_ATTRIBUTES),
- S(REJECT_INCOMING_CALL),
- S(SET_CONNECTION_ATTRIBUTES),
- S(WAIT_ON_INCOMING_CALL),
- S(SET_CONNECTION_ATTRIBUTES_X),
- S(QUERY_CONNECTION_ATTRIBUTES_X),
- S(QUERY_STATE),
-#undef S
-};
-#endif
-
-/*
- * Signal from user - map this to our internal signals and queue
- * the mapped signal.
- */
-int
-cc_user_signal(struct ccuser *user, enum atmop sig, struct uni_msg *msg)
-{
- size_t len = uni_msg_len(msg);
- int err = EINVAL;
-
- if (user->cc->log & CCLOG_USER_SIG)
- cc_user_log(user, "signal %s to user", op_names[sig]);
-
- if ((u_int)sig > ATMOP_QUERY_STATE)
- goto bad_signal;
-
- switch (sig) {
-
- case ATMOP_ABORT_CONNECTION:
- if (len != sizeof(struct atm_abort_connection))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_ABORT_CONNECTION, msg);
- break;
-
- case ATMOP_ACCEPT_INCOMING_CALL:
- if (len != sizeof(struct atm_accept_incoming_call))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_ACCEPT_INCOMING, msg);
- break;
-
- case ATMOP_ADD_PARTY:
- if (len != sizeof(struct atm_add_party))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_ADD_PARTY, msg);
- break;
-
- case ATMOP_CALL_RELEASE:
- if (len != sizeof(struct atm_call_release))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_CALL_RELEASE, msg);
- break;
-
- case ATMOP_CONNECT_OUTGOING_CALL:
- if (len != sizeof(struct atm_connect_outgoing_call))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_CONNECT_OUTGOING, msg);
- break;
-
- case ATMOP_DROP_PARTY:
- if (len != sizeof(struct atm_drop_party))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_DROP_PARTY, msg);
- break;
-
- case ATMOP_GET_LOCAL_PORT_INFO:
- if (len != sizeof(struct atm_get_local_port_info))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_GET_LOCAL_PORT_INFO, msg);
- break;
-
- case ATMOP_PREPARE_INCOMING_CALL:
- if (len != sizeof(struct atm_prepare_incoming_call))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_PREPARE_INCOMING, msg);
- break;
-
- case ATMOP_PREPARE_OUTGOING_CALL:
- if (len != 0)
- goto bad_len;
- uni_msg_destroy(msg);
- err = cc_user_sig(user, USER_SIG_PREPARE_OUTGOING, NULL, 0);
- break;
-
- case ATMOP_QUERY_CONNECTION_ATTRIBUTES:
- if (len != sizeof(struct atm_query_connection_attributes))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_QUERY_ATTR, msg);
- break;
-
- case ATMOP_REJECT_INCOMING_CALL:
- if (len != sizeof(struct atm_reject_incoming_call))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_REJECT_INCOMING, msg);
- break;
-
- case ATMOP_SET_CONNECTION_ATTRIBUTES:
- if (len < sizeof(struct atm_set_connection_attributes))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_SET_ATTR, msg);
- break;
-
- case ATMOP_WAIT_ON_INCOMING_CALL:
- if (len != 0)
- goto bad_len;
- uni_msg_destroy(msg);
- err = cc_user_sig(user, USER_SIG_WAIT_ON_INCOMING, NULL, 0);
- break;
-
- case ATMOP_QUERY_CONNECTION_ATTRIBUTES_X:
- if (len < sizeof(struct atm_set_connection_attributes_x) ||
- len != offsetof(struct atm_set_connection_attributes_x,
- attr) + uni_msg_rptr(msg,
- struct atm_set_connection_attributes_x *)->count *
- sizeof(uint32_t))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_QUERY_ATTR_X, msg);
- break;
-
- case ATMOP_SET_CONNECTION_ATTRIBUTES_X:
- if (len < sizeof(struct atm_set_connection_attributes_x))
- goto bad_len;
- err = cc_user_sig_msg(user, USER_SIG_SET_ATTR_X, msg);
- break;
-
- case ATMOP_QUERY_STATE:
- if (len != 0)
- goto bad_len;
- uni_msg_destroy(msg);
- err = cc_user_sig(user, USER_SIG_QUERY_STATE, NULL, 0);
- break;
-
- case ATMOP_RESP:
- case ATMOP_ADD_PARTY_REJECT:
- case ATMOP_ADD_PARTY_SUCCESS:
- case ATMOP_ARRIVAL_OF_INCOMING_CALL:
- case ATMOP_P2MP_CALL_ACTIVE:
- case ATMOP_P2P_CALL_ACTIVE:
- bad_signal:
- /* bad signal */
- if (user->cc->log & CCLOG_USER_SIG)
- cc_user_log(user, "bad signal %u", sig);
- cc_user_err(user, ATMERR_BAD_OP);
- uni_msg_destroy(msg);
- break;
- }
- return (err);
-
- bad_len:
- /* bad argument length */
- if (user->cc->log & CCLOG_USER_SIG)
- cc_user_log(user, "signal %s had bad len=%zu",
- op_names[sig], len);
- cc_user_err(user, ATMERR_BAD_ARGS);
- uni_msg_destroy(msg);
- return (EINVAL);
-}
-
-/*
- * Send active signal to user
- */
-static void
-cc_user_active(struct ccuser *user)
-{
- struct ccconn *conn = TAILQ_FIRST(&user->connq);
-
- set_state(user, USER_ACTIVE);
- if (conn->bearer.cfg == UNI_BEARER_P2P) {
- struct atm_p2p_call_active *act;
-
- user->config = USER_P2P;
- act = CCZALLOC(sizeof(*act));
- if (act == NULL)
- return;
- act->connid = conn->connid;
- cc_user_send(user, ATMOP_P2P_CALL_ACTIVE, act, sizeof(*act));
- CCFREE(act);
- } else {
- struct atm_p2mp_call_active *act;
-
- user->config = USER_ROOT;
- act = CCZALLOC(sizeof(*act));
- if (act == NULL)
- return;
- act->connid = conn->connid;
- cc_user_send(user, ATMOP_P2MP_CALL_ACTIVE, act, sizeof(*act));
- CCFREE(act);
- }
-}
-
-/*
-* Handle a signal to this user
-*/
-void
-cc_user_sig_handle(struct ccuser *user, enum user_sig sig,
- void *arg, u_int arg2)
-{
-
- if (user->cc->log & CCLOG_USER_SIG)
- cc_user_log(user, "signal %s to user state %s",
- cc_user_sigtab[sig], stab[user->state]);
-
- switch (sig) {
-
-
- case USER_SIG_PREPARE_OUTGOING:
- {
- /*
- * Here we create a connection for the call we soon will make.
- * We put this call on the list of orphaned connections,
- * because we don't know yet, which port will get the
- * connection. It is assigned, when the user issues the call
- * to connect.
- */
- struct ccconn *conn;
-
- if (user->state != USER_NULL) {
- cc_user_err(user, ATMERR_BAD_STATE);
- goto bad_state;
- }
- conn = cc_conn_create(user->cc);
- if (conn == NULL) {
- cc_user_err(user, ATMERR_NOMEM);
- return;
- }
- set_state(user, USER_OUT_PREPARING);
- cc_conn_set_state(conn, CONN_OUT_PREPARING);
- conn->blli_selector = 1;
- cc_connect_to_user(conn, user);
-
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- return;
- }
-
-
- case USER_SIG_CONNECT_OUTGOING:
- {
- /*
- * Request to connect that call
- *
- * Here we assign the connection to a port.
- */
- struct uni_msg *msg = arg;
- struct atm_connect_outgoing_call *req = uni_msg_rptr(msg,
- struct atm_connect_outgoing_call *);
- struct ccdata *priv = user->cc;
- struct ccport *port;
- struct ccaddr *addr;
- struct ccconn *conn = TAILQ_FIRST(&user->connq);
-
- if (user->state != USER_OUT_PREPARING) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_STATE);
- goto bad_state;
- }
- if (!IE_ISPRESENT(req->called)) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_ARGS);
- return;
- }
- CCASSERT(conn->port == NULL, ("connection still on port"));
-
- if (TAILQ_EMPTY(&priv->port_list)) {
- /*
- * We have no ports - reject
- */
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_PORT);
- return;
- }
-
- /*
- * Find the correct port
- * Routing of outgoing calls goes to the lowest numbered port
- * with a matching address or, if no address match is found to
- * the lowest numbered port.
- */
- TAILQ_FOREACH(port, &priv->port_list, node_link)
- TAILQ_FOREACH(addr, &port->addr_list, port_link)
- if (addr_matches(addr, conn))
- break;
-
- if (port == NULL)
- port = TAILQ_FIRST(&priv->port_list);
-
- cc_conn_ins_port(conn, port);
- conn->called = req->called;
- uni_msg_destroy(msg);
-
- /*
- * Now move the state
- */
- set_state(user, USER_OUT_WAIT_OK);
- cc_conn_sig(conn, CONN_SIG_CONNECT_OUTGOING, NULL);
-
- return;
- }
-
-
- case USER_SIG_CONNECT_OUTGOING_ERR:
- switch (user->state) {
-
- case USER_OUT_WAIT_OK:
- set_state(user, USER_OUT_PREPARING);
- cc_user_err(user, arg2);
- break;
-
- case USER_REL_WAIT_CONN:
- {
- struct ccconn *conn;
-
- conn = TAILQ_FIRST(&user->connq);
- if (conn != NULL) {
- cc_disconnect_from_user(conn);
- cc_conn_destroy(conn);
- }
-
- cc_user_reset(user);
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- break;
- }
-
- default:
- goto bad_state;
- }
- return;
-
-
- case USER_SIG_CONNECT_OUTGOING_OK:
- switch (user->state) {
-
- case USER_OUT_WAIT_OK:
- set_state(user, USER_OUT_WAIT_CONF);
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- break;
-
- case USER_REL_WAIT_CONN:
- set_state(user, USER_REL_WAIT_SCONF);
- break;
-
- default:
- goto bad_state;
- }
- return;
-
-
- case USER_SIG_SETUP_CONFIRM:
- /*
- * SETUP.confirm from UNI stack.
- */
- switch (user->state) {
-
- case USER_OUT_WAIT_CONF:
- cc_user_active(user);
- break;
-
- case USER_REL_WAIT_SCONF:
- /* now try to release */
- set_state(user, USER_REL_WAIT_CONF);
- cc_conn_sig(TAILQ_FIRST(&user->connq),
- CONN_SIG_RELEASE, NULL);
- break;
-
- default:
- goto bad_state;
- }
- return;
-
-
- case USER_SIG_PREPARE_INCOMING:
- {
- struct uni_msg *msg = arg;
- struct ccuser *ptr;
- struct atm_prepare_incoming_call *prep = uni_msg_rptr(msg,
- struct atm_prepare_incoming_call *);
-
- if (user->state != USER_NULL) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_STATE);
- goto bad_state;
- }
-
- /*
- * Check the SAP
- */
- if (unisve_check_sap(&prep->sap) != UNISVE_OK) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_SAP);
- return;
- }
-
- /*
- * Loop through all incoming calls and check whether there
- * is an overlap in SAP space.
- */
- LIST_FOREACH(ptr, &user->cc->user_list, node_link) {
- if (check_overlap(ptr, &prep->sap)) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_OVERLAP);
- return;
- }
- }
-
- /*
- * Save info and set state
- */
- user->sap = CCZALLOC(sizeof(struct uni_sap));
- if (user->sap == NULL) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_NOMEM);
- return;
- }
- *user->sap = prep->sap;
- user->queue_max = prep->queue_size;
- user->queue_act = 0;
- uni_msg_destroy(msg);
-
- set_state(user, USER_IN_PREPARING);
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
-
- return;
- }
-
-
- case USER_SIG_WAIT_ON_INCOMING:
- if (user->state != USER_IN_PREPARING) {
- cc_user_err(user, ATMERR_BAD_STATE);
- goto bad_state;
- }
-
- set_state(user, USER_IN_WAITING);
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- return;
-
-
- case USER_SIG_SETUP_IND:
- /*
- * New connection queued up in the queue. If this is the
- * first one, inform the application of the arrival.
- */
- switch (user->state) {
-
- case USER_IN_WAITING:
- do_arrival(user);
- break;
-
- case USER_IN_ARRIVED:
- case USER_IN_WAIT_REJ:
- case USER_IN_WAIT_ACC:
- break;
-
- default:
- goto bad_state;
- }
- return;
-
-
- case USER_SIG_REJECT_INCOMING:
- {
- /*
- * User rejects call. This is done on the OLD user
- * (i.e. the one sending the arrival).
- */
- struct uni_msg *msg = arg;
- struct atm_reject_incoming_call *rej = uni_msg_rptr(msg,
- struct atm_reject_incoming_call *);
- struct ccconn *conn = TAILQ_FIRST(&user->connq);
-
- if (user->state != USER_IN_ARRIVED) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_STATE);
- goto bad_state;
- }
- if (user->aborted) {
- /* connection has disappeared. Send an ok
- * to the user and lock whether there is another
- * connection at this endpoint */
- uni_msg_destroy(msg);
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
-
- set_state(user, USER_IN_WAITING);
- do_arrival(user);
- return;
- }
- conn->cause[0] = rej->cause;
- memset(&conn->cause[1], 0, sizeof(conn->cause[1]));
- uni_msg_destroy(msg);
-
- set_state(user, USER_IN_WAIT_REJ);
- cc_conn_sig(conn, CONN_SIG_REJECT, NULL);
-
- return;
- }
-
-
- case USER_SIG_REJECT_OK:
- if (user->state != USER_IN_WAIT_REJ)
- goto bad_state;
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
-
- set_state(user, USER_IN_WAITING);
- do_arrival(user);
- return;
-
-
- case USER_SIG_REJECT_ERR:
- if (user->state != USER_IN_WAIT_REJ)
- goto bad_state;
- cc_user_err(user, arg2);
-
- if (arg == NULL)
- set_state(user, USER_IN_ARRIVED);
- else {
- set_state(user, USER_IN_WAITING);
- do_arrival(user);
- }
- return;
-
-
- case USER_SIG_ACCEPT_INCOMING:
- {
- /*
- * User accepts call. This is done on the OLD user (i.e. the one
- * sending the arrival), the message contains a pointer to the
- * new endpoint.
- */
- struct uni_msg *msg = arg;
- struct atm_accept_incoming_call *acc =
- uni_msg_rptr(msg, struct atm_accept_incoming_call *);
- struct ccuser *newep;
-
- if (user->state != USER_IN_ARRIVED) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_STATE);
- return;
- }
- if (user->aborted) {
- /* connection has disappeared. Send an error
- * to the user and lock whether there is another
- * connection at this endpoint */
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_PREVIOUSLY_ABORTED);
-
- set_state(user, USER_IN_WAITING);
- do_arrival(user);
- return;
- }
- acc->newep[sizeof(acc->newep) - 1] = '\0';
-
- LIST_FOREACH(newep, &user->cc->user_list, node_link)
- if (strcmp(acc->newep, newep->name) == 0)
- break;
- uni_msg_destroy(msg);
-
- if (newep == NULL) {
- cc_user_err(user, ATMERR_BAD_ENDPOINT);
- return;
- }
-
- if (newep->state != USER_NULL || newep->accepted != NULL) {
- cc_user_err(user, ATMERR_BAD_STATE);
- return;
- }
-
- set_state(user, USER_IN_WAIT_ACC);
- cc_conn_sig(TAILQ_FIRST(&user->connq), CONN_SIG_ACCEPT, newep);
-
- return;
- }
-
-
- case USER_SIG_ACCEPT_OK:
- if (user->state != USER_IN_WAIT_ACC)
- goto bad_state;
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
-
- set_state(user, USER_IN_WAITING);
- do_arrival(user);
- return;
-
-
- case USER_SIG_ACCEPT_ERR:
- if (user->state != USER_IN_WAIT_ACC)
- goto bad_state;
- cc_user_err(user, arg2);
-
- if (arg == NULL) {
- /* arg used as flag! */
- set_state(user, USER_IN_ARRIVED);
- } else {
- set_state(user, USER_IN_WAITING);
- do_arrival(user);
- }
- return;
-
-
- case USER_SIG_ACCEPTING:
- if (user->state != USER_NULL)
- goto bad_state;
- set_state(user, USER_IN_ACCEPTING);
- return;
-
-
- case USER_SIG_SETUP_COMPL:
- {
- struct ccconn *conn = TAILQ_FIRST(&user->connq);
-
- if (user->state != USER_IN_ACCEPTING)
- goto bad_state;
-
- user->state = USER_ACTIVE;
- if (conn->bearer.cfg == UNI_BEARER_P2P) {
- struct atm_p2p_call_active *act;
-
- user->config = USER_P2P;
- act = CCZALLOC(sizeof(*act));
- if (act == NULL)
- return;
- act->connid = conn->connid;
- cc_user_send(user, ATMOP_P2P_CALL_ACTIVE,
- act, sizeof(*act));
- CCFREE(act);
- } else {
- struct atm_p2mp_call_active *act;
-
- user->config = USER_LEAF;
- act = CCZALLOC(sizeof(*act));
- if (act == NULL)
- return;
- act->connid = conn->connid;
- cc_user_send(user, ATMOP_P2MP_CALL_ACTIVE,
- act, sizeof(*act));
- CCFREE(act);
- }
- return;
- }
-
-
- case USER_SIG_CALL_RELEASE:
- {
- struct uni_msg *msg = arg;
- struct atm_call_release *api = uni_msg_rptr(msg,
- struct atm_call_release *);
- struct ccconn *conn;
-
- conn = TAILQ_FIRST(&user->connq);
- switch (user->state) {
-
- case USER_OUT_WAIT_OK: /* U2/A3 */
- /* wait for CONN_OK first */
- conn->cause[0] = api->cause[0];
- conn->cause[1] = api->cause[1];
- set_state(user, USER_REL_WAIT_CONN);
- break;
-
- case USER_OUT_WAIT_CONF: /* U3/A3 */
- /* wait for SETUP.confirm first */
- conn->cause[0] = api->cause[0];
- conn->cause[1] = api->cause[1];
- set_state(user, USER_REL_WAIT_SCONF);
- break;
-
- case USER_IN_ACCEPTING: /* U11/A7 */
- conn->cause[0] = api->cause[0];
- conn->cause[1] = api->cause[1];
- set_state(user, USER_REL_WAIT_SCOMP);
- cc_conn_sig(conn, CONN_SIG_RELEASE, NULL);
- break;
-
- case USER_ACTIVE: /* U4/A8,A9,A10 */
- conn->cause[0] = api->cause[0];
- conn->cause[1] = api->cause[1];
- set_state(user, USER_REL_WAIT);
- cc_conn_sig(conn, CONN_SIG_RELEASE, NULL);
- break;
-
- default:
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_STATE);
- goto bad_state;
- }
- uni_msg_destroy(msg);
- return;
- }
-
-
- case USER_SIG_RELEASE_CONFIRM:
- {
- struct atm_call_release *ind;
-
- switch (user->state) {
-
- case USER_OUT_WAIT_CONF: /* U3/A3 */
- case USER_ACTIVE: /* U4/A8,A9,A10 */
- cc_user_reset(user);
- break;
-
- case USER_REL_WAIT: /* U5 /A8,A9,A10 */
- case USER_REL_WAIT_SCOMP: /* U12/A7 */
- case USER_REL_WAIT_SCONF: /* U13/A3 */
- case USER_REL_WAIT_CONF: /* U14/A3 */
- cc_user_reset(user);
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- return;
-
- case USER_IN_ACCEPTING: /* U11/A7 */
- cc_user_reset(user);
- break;
-
- default:
- goto bad_state;
- }
-
- ind = CCZALLOC(sizeof(*ind));
- if (ind == NULL)
- return;
- memcpy(ind->cause, user->cause, sizeof(ind->cause));
- cc_user_send(user, ATMOP_CALL_RELEASE, ind, sizeof(*ind));
- CCFREE(ind);
- return;
- }
-
-
- case USER_SIG_RELEASE_ERR:
- switch (user->state) {
-
- case USER_REL_WAIT: /* U5/A8,A9,A10 */
- set_state(user, USER_ACTIVE);
- cc_user_err(user, ATM_MKUNIERR(arg2));
- break;
-
- case USER_REL_WAIT_CONF: /* U14/A3 */
- cc_user_err(user, ATM_MKUNIERR(arg2));
- cc_user_active(user);
- break;
-
- case USER_REL_WAIT_SCOMP: /* U12/A7 */
- set_state(user, USER_IN_ACCEPTING);
- cc_user_err(user, ATM_MKUNIERR(arg2));
- break;
-
- default:
- goto bad_state;
- }
- return;
-
-
- case USER_SIG_ADD_PARTY:
- {
- struct uni_msg *msg = arg;
- struct atm_add_party *add = uni_msg_rptr(msg,
- struct atm_add_party *);
- struct ccconn *conn;
-
- if (user->state != USER_ACTIVE || user->config != USER_ROOT) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_STATE);
- return;
- }
-
- if (add->leaf_ident == 0 || add->leaf_ident >= 32786) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_LEAF_IDENT);
- return;
- }
-
- conn = TAILQ_FIRST(&user->connq);
- conn->called = add->called;
-
- cc_conn_sig(conn, CONN_SIG_ADD_PARTY,
- (void *)(uintptr_t)add->leaf_ident);
-
- uni_msg_destroy(msg);
- return;
- }
-
-
- case USER_SIG_ADD_PARTY_ERR:
- if (user->state != USER_ACTIVE)
- goto bad_state;
- cc_user_err(user, arg2);
- return;
-
-
- case USER_SIG_ADD_PARTY_OK:
- if (user->state != USER_ACTIVE)
- goto bad_state;
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- return;
-
-
- case USER_SIG_ADD_PARTY_ACK:
- {
- u_int leaf_ident = arg2;
- struct atm_add_party_success *succ;
-
- if (user->state != USER_ACTIVE)
- goto bad_state;
-
- succ = CCZALLOC(sizeof(*succ));
- if (succ == NULL)
- return;
-
- succ->leaf_ident = leaf_ident;
- cc_user_send(user, ATMOP_ADD_PARTY_SUCCESS,
- succ, sizeof(*succ));
-
- CCFREE(succ);
- return;
- }
-
-
- case USER_SIG_ADD_PARTY_REJ:
- {
- u_int leaf_ident = arg2;
- struct atm_add_party_reject *reject;
-
- if (user->state != USER_ACTIVE)
- goto bad_state;
-
- reject = CCZALLOC(sizeof(*reject));
- if (reject == NULL)
- return;
-
- reject->leaf_ident = leaf_ident;
- reject->cause = user->cause[0];
- cc_user_send(user, ATMOP_ADD_PARTY_REJECT,
- reject, sizeof(*reject));
-
- CCFREE(reject);
- return;
- }
-
-
- case USER_SIG_DROP_PARTY:
- {
- struct uni_msg *msg = arg;
- struct atm_drop_party *drop = uni_msg_rptr(msg,
- struct atm_drop_party *);
- struct ccconn *conn;
-
- if (user->state != USER_ACTIVE || user->config != USER_ROOT) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_STATE);
- return;
- }
-
- if (drop->leaf_ident >= 32786) {
- uni_msg_destroy(msg);
- cc_user_err(user, ATMERR_BAD_LEAF_IDENT);
- return;
- }
-
- conn = TAILQ_FIRST(&user->connq);
- conn->cause[0] = drop->cause;
- memset(&conn->cause[1], 0, sizeof(conn->cause[1]));
-
- cc_conn_sig(conn, CONN_SIG_DROP_PARTY,
- (void *)(uintptr_t)drop->leaf_ident);
-
- uni_msg_destroy(msg);
- return;
- }
-
-
- case USER_SIG_DROP_PARTY_ERR:
- if (user->state != USER_ACTIVE)
- goto bad_state;
- cc_user_err(user, arg2);
- return;
-
-
- case USER_SIG_DROP_PARTY_OK:
- if (user->state != USER_ACTIVE)
- goto bad_state;
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- return;
-
-
- case USER_SIG_DROP_PARTY_IND:
- {
- u_int leaf_ident = arg2;
- struct atm_drop_party *drop;
-
- if (user->state != USER_ACTIVE)
- goto bad_state;
-
- drop = CCZALLOC(sizeof(*drop));
- if (drop == NULL)
- return;
-
- drop->leaf_ident = leaf_ident;
- drop->cause = user->cause[0];
- cc_user_send(user, ATMOP_DROP_PARTY, drop, sizeof(*drop));
-
- CCFREE(drop);
- return;
- }
-
-
- case USER_SIG_QUERY_ATTR:
- {
- struct uni_msg *msg = arg;
- struct atm_query_connection_attributes *req;
- struct ccconn *conn;
-
- if (user->aborted) {
- cc_user_err(user, ATMERR_PREVIOUSLY_ABORTED);
- uni_msg_destroy(msg);
- return;
- }
- conn = cc_query_check(user);
- if (conn == NULL) {
- cc_user_err(user, ATMERR_BAD_STATE);
- uni_msg_destroy(msg);
- return;
- }
- req = uni_msg_rptr(msg,
- struct atm_query_connection_attributes *);
- cc_attr_query(user, conn, &req->attr, 1);
- uni_msg_destroy(msg);
- return;
- }
-
- case USER_SIG_QUERY_ATTR_X:
- {
- struct uni_msg *msg = arg;
- struct atm_query_connection_attributes_x *req;
- struct ccconn *conn;
-
- conn = cc_query_check(user);
- if (conn == NULL) {
- cc_user_err(user, ATMERR_BAD_STATE);
- uni_msg_destroy(msg);
- return;
- }
- req = uni_msg_rptr(msg,
- struct atm_query_connection_attributes_x *);
- cc_attr_query(user, conn, req->attr, req->count);
- uni_msg_destroy(msg);
- return;
- }
-
- case USER_SIG_SET_ATTR:
- {
- struct uni_msg *msg = arg;
- struct atm_set_connection_attributes *req;
- struct ccconn *conn;
-
- if (user->aborted) {
- cc_user_err(user, ATMERR_PREVIOUSLY_ABORTED);
- uni_msg_destroy(msg);
- return;
- }
- conn = cc_set_check(user);
- if (conn == NULL) {
- cc_user_err(user, ATMERR_BAD_STATE);
- uni_msg_destroy(msg);
- return;
- }
- req = uni_msg_rptr(msg, struct atm_set_connection_attributes *);
- cc_attr_set(user, conn, &req->attr, 1, (u_char *)(req + 1),
- uni_msg_len(msg) - sizeof(*req));
- uni_msg_destroy(msg);
- return;
- }
-
- case USER_SIG_SET_ATTR_X:
- {
- struct uni_msg *msg = arg;
- struct atm_set_connection_attributes_x *req;
- struct ccconn *conn;
-
- conn = cc_set_check(user);
- if (conn == NULL) {
- cc_user_err(user, ATMERR_BAD_STATE);
- uni_msg_destroy(msg);
- return;
- }
- req = uni_msg_rptr(msg,
- struct atm_set_connection_attributes_x *);
- cc_attr_set(user, conn, req->attr, req->count,
- (u_char *)req->attr + req->count * sizeof(req->attr[0]),
- uni_msg_len(msg) -
- offsetof(struct atm_set_connection_attributes_x, attr) -
- req->count * sizeof(req->attr[0]));
- uni_msg_destroy(msg);
- return;
- }
-
- case USER_SIG_QUERY_STATE:
- {
- struct atm_epstate state;
-
- strcpy(state.name, user->name);
- switch (user->state) {
-
- case USER_NULL:
- if (user->accepted != NULL)
- state.state = ATM_A7;
- else
- state.state = ATM_A1;
- break;
-
- case USER_OUT_PREPARING:
- state.state = ATM_A2;
- break;
-
- case USER_OUT_WAIT_OK:
- case USER_OUT_WAIT_CONF:
- case USER_REL_WAIT_SCONF:
- case USER_REL_WAIT_CONF:
- case USER_REL_WAIT_CONN:
- state.state = ATM_A3;
- break;
-
- case USER_ACTIVE:
- case USER_REL_WAIT:
- switch (user->config) {
-
- case USER_P2P:
- state.state = ATM_A8;
- break;
-
- case USER_ROOT:
- state.state = ATM_A9;
- break;
-
- case USER_LEAF:
- state.state = ATM_A10;
- break;
- }
- break;
-
- case USER_IN_PREPARING:
- state.state = ATM_A4;
- break;
-
- case USER_IN_WAITING:
- state.state = ATM_A5;
- break;
-
- case USER_IN_ARRIVED:
- case USER_IN_WAIT_REJ:
- case USER_IN_WAIT_ACC:
- state.state = ATM_A6;
- break;
-
- case USER_IN_ACCEPTING:
- case USER_REL_WAIT_SCOMP:
- state.state = ATM_A7;
- break;
- }
- cc_user_ok(user, ATMRESP_STATE, &state, sizeof(state));
- return;
- }
-
- case USER_SIG_GET_LOCAL_PORT_INFO:
- {
- struct uni_msg *msg = arg;
- struct atm_port_list *list;
- size_t list_len;
-
- list = cc_get_local_port_info(user->cc,
- uni_msg_rptr(msg, struct atm_get_local_port_info *)->port,
- &list_len);
- uni_msg_destroy(msg);
- if (list == NULL) {
- cc_user_err(user, ATMERR_NOMEM);
- return;
- }
- cc_user_ok(user, ATMRESP_PORTS, list, list_len);
- CCFREE(list);
- return;
- }
-
- case USER_SIG_ABORT_CONNECTION:
- {
- struct uni_msg *msg = arg;
- struct atm_abort_connection *abo = uni_msg_rptr(msg,
- struct atm_abort_connection *);
-
- cc_user_abort(user, &abo->cause);
- uni_msg_destroy(msg);
- cc_user_ok(user, ATMRESP_NONE, NULL, 0);
- return;
- }
-
- }
- if (user->cc->log & CCLOG_USER_SIG)
- cc_user_log(user, "bad signal=%u in state=%u",
- sig, user->state);
- return;
-
- bad_state:
- if (user->cc->log & CCLOG_USER_SIG)
- cc_user_log(user, "bad state=%u for signal=%u",
- user->state, sig);
- return;
-}
diff --git a/sys/contrib/ngatm/netnatm/api/ccatm.h b/sys/contrib/ngatm/netnatm/api/ccatm.h
deleted file mode 100644
index 1b4a179a3348..000000000000
--- a/sys/contrib/ngatm/netnatm/api/ccatm.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2003-2004
- * Hartmut Brandt
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution of this software and documentation and use in source and
- * binary forms, with or without modification, are permitted provided that
- * the following conditions are met:
- *
- * 1. Redistributions of source code or documentation must retain the above
- * copyright notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
- * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/api/ccatm.h,v 1.1 2004/07/08 08:21:58 brandt Exp $
- *
- * ATM API as defined per af-saa-0108
- *
- * Interface to the supporting code.
- */
-
-#ifndef _API_CCATM_H_
-#define _API_CCATM_H_
-
-struct ccuser;
-struct ccconn;
-struct ccport;
-struct ccdata;
-
-struct cc_funcs {
- /* send signal to API user */
- void (*send_user)(struct ccuser *, void *, u_int, void *, size_t);
-
- /* respond API user */
- void (*respond_user)(struct ccuser *, void *, int, u_int,
- void *, size_t);
-
- /* send signal to uni for connection */
- void (*send_uni)(struct ccconn *, void *, u_int, u_int,
- struct uni_msg *);
-
- /* send global signal to uni */
- void (*send_uni_glob)(struct ccport *, void *, u_int, u_int,
- struct uni_msg *);
-
- /* log a message */
- void (*log)(const char *, ...);
-};
-
-enum {
- CCLOG_USER_STATE = 0x00000001,
- CCLOG_USER_INST = 0x00000002,
- CCLOG_USER_SIG = 0x00000004,
- CCLOG_CONN_STATE = 0x00000010,
- CCLOG_CONN_INST = 0x00000020,
- CCLOG_CONN_SIG = 0x00000040,
- CCLOG_PARTY_STATE = 0x00000100,
- CCLOG_PARTY_INST = 0x00000200,
- CCLOG_PARTY_SIG = 0x00000400,
- CCLOG_SIGS = 0x00001000,
-};
-
-/* instance handling */
-struct ccdata *cc_create(const struct cc_funcs *);
-void cc_destroy(struct ccdata *);
-void cc_reset(struct ccdata *);
-
-/* input a response from the UNI layer to CC */
-int cc_uni_response(struct ccport *, u_int cookie, u_int reason, u_int state);
-
-/* Signal from UNI on this port */
-int cc_uni_signal(struct ccport *, u_int cookie, u_int sig, struct uni_msg *);
-
-/* retrieve addresses */
-int cc_get_addrs(struct ccdata *, u_int, struct uni_addr **, u_int **, u_int *);
-
-/* dump state */
-typedef int (*cc_dump_f)(struct ccdata *, void *, const char *);
-int cc_dump(struct ccdata *, size_t, cc_dump_f, void *);
-
-/* start/stop port */
-int cc_port_stop(struct ccdata *, u_int);
-int cc_port_start(struct ccdata *, u_int);
-
-/* is port running? */
-int cc_port_isrunning(struct ccdata *, u_int, int *);
-
-/* return port number */
-u_int cc_port_no(struct ccport *);
-
-/* Clear address and prefix information from the named port. */
-int cc_port_clear(struct ccdata *, u_int);
-
-/* Address registered. */
-int cc_addr_register(struct ccdata *, u_int, const struct uni_addr *);
-
-/* Address unregistered. */
-int cc_addr_unregister(struct ccdata *, u_int, const struct uni_addr *);
-
-/* get port info */
-int cc_port_get_param(struct ccdata *, u_int, struct atm_port_info *);
-
-/* set port info */
-int cc_port_set_param(struct ccdata *, const struct atm_port_info *);
-
-/* get port list */
-int cc_port_getlist(struct ccdata *, u_int *, u_int **);
-
-/* create a port */
-struct ccport *cc_port_create(struct ccdata *, void *, u_int);
-
-/* destroy a port */
-void cc_port_destroy(struct ccport *, int);
-
-/* New endpoint created */
-struct ccuser *cc_user_create(struct ccdata *, void *, const char *);
-
-/* destroy user endpoint */
-void cc_user_destroy(struct ccuser *);
-
-/* signal from user */
-int cc_user_signal(struct ccuser *, u_int, struct uni_msg *);
-
-/* Management is given up on this node. */
-void cc_unmanage(struct ccdata *);
-
-/* handle all queued signals */
-void cc_work(struct ccdata *);
-
-/* set/get logging flags */
-void cc_set_log(struct ccdata *, u_int);
-u_int cc_get_log(const struct ccdata *);
-
-/* get extended status */
-int cc_get_extended_status(const struct ccdata *, struct atm_exstatus *,
- struct atm_exstatus_ep **, struct atm_exstatus_port **,
- struct atm_exstatus_conn **, struct atm_exstatus_party **);
-
-#endif
diff --git a/sys/contrib/ngatm/netnatm/api/ccpriv.h b/sys/contrib/ngatm/netnatm/api/ccpriv.h
deleted file mode 100644
index c0f30750fc10..000000000000
--- a/sys/contrib/ngatm/netnatm/api/ccpriv.h
+++ /dev/null
@@ -1,562 +0,0 @@
-/*
- * Copyright (c) 2003-2004
- * Hartmut Brandt
- * All rights reserved.
- *
- * Author: Harti Brandt <harti@freebsd.org>
- *
- * Redistribution of this software and documentation and use in source and
- * binary forms, with or without modification, are permitted provided that
- * the following conditions are met:
- *
- * 1. Redistributions of source code or documentation must retain the above
- * copyright notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
- * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/api/ccpriv.h,v 1.2 2005/05/23 11:49:17 brandt_h Exp $
- *
- * ATM API as defined per af-saa-0108
- *
- * Private declarations.
- */
-#ifdef _KERNEL
-#ifdef __FreeBSD__
-#include <netgraph/atm/ccatm/ng_ccatm_cust.h>
-#endif
-#else /* !_KERNEL */
-#include "cccust.h"
-#endif
-
-struct ccuser;
-struct ccconn;
-struct ccaddr;
-struct ccport;
-struct ccdata;
-struct ccsig;
-struct ccparty;
-
-LIST_HEAD(ccuser_list, ccuser);
-LIST_HEAD(ccconn_list, ccconn);
-TAILQ_HEAD(ccaddr_list, ccaddr);
-TAILQ_HEAD(ccport_list, ccport);
-TAILQ_HEAD(ccsig_list, ccsig);
-LIST_HEAD(ccparty_list, ccparty);
-
-/*
- * Private node data.
- */
-struct ccdata {
- struct ccuser_list user_list; /* instance list */
- struct ccport_list port_list; /* list of ports */
- struct ccconn_list orphaned_conns; /* list of connections */
- struct ccsig_list sigs; /* current signals */
- struct ccsig_list def_sigs; /* deferred signals */
- struct ccsig_list free_sigs; /* free signals */
-
- const struct cc_funcs *funcs;
- uint32_t cookie; /* cookie generator */
- u_int log; /* logging flags */
-};
-
-/* retrieve info on local ports */
-struct atm_port_list *cc_get_local_port_info(struct ccdata *,
- u_int, size_t *);
-
-/* log */
-#ifdef CCATM_DEBUG
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_log(CC, FMT, ARGS...) do { \
- (CC)->funcs->log("%s (data=%p): " FMT, __FUNCTION__, \
- (CC) , ## ARGS); \
- } while (0)
-#else
-#define cc_log(CC, FMT, ...) do { \
- (CC)->funcs->log("%s (data=%p): " FMT, __func__, \
- (CC), __VA_ARGS__); \
- } while (0)
-#endif
-#else
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_log(CC, FMT, ARGS...) do { } while (0)
-#else
-#define cc_log(CC, FMT, ...) do { } while (0)
-#endif
-#endif
-
-/*
- * structure to remember cookies for outstanding requests
- * we also remember the request itself but don't use it.
- */
-struct ccreq {
- TAILQ_ENTRY(ccreq) link;
- uint32_t cookie;
- uint32_t req;
- struct ccconn *conn;
-};
-TAILQ_HEAD(ccreq_list, ccreq);
-
-/*
- * Port data. Each port has one UNI stack below.
- * The port number is in param.port. The number is assigned when the
- * hook to the uni is connected. This hook has the name 'uni<port>'.
- */
-struct ccport {
- void *uarg; /* hook to UNI protocol */
- struct ccdata *cc; /* back pointer to node */
- enum {
- CCPORT_STOPPED, /* halted */
- CCPORT_RUNNING, /* ok */
- } admin; /* admin status */
- struct ccconn_list conn_list; /* list of connections */
- struct ccaddr_list addr_list; /* list of network addresses */
- struct atm_port_info param; /* parameters */
-
- /* list of outstanding requests */
- struct ccreq_list cookies;
-
- TAILQ_ENTRY(ccport) node_link;
-};
-
-#ifdef CCATM_DEBUG
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_port_log(P, FMT, ARGS...) do { \
- (P)->cc->funcs->log("%s (port=%p/%u): " FMT, __FUNCTION__, \
- (P), (P)->param.port , ## ARGS); \
- } while (0)
-#else
-#define cc_port_log(P, FMT, ...) do { \
- (P)->cc->funcs->log("%s (port=%p/%u): " FMT, __func__, \
- (P), (P)->param.port, __VA_ARGS__); \
- } while (0)
-#endif
-#else
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_port_log(P, FMT, ARGS...) do { } while (0)
-#else
-#define cc_port_log(P, FMT, ...) do { } while (0)
-#endif
-#endif
-
-#define CONN_STATES \
- DEF(CONN_NULL) /* C0 */ \
- DEF(CONN_OUT_PREPARING) /* C1 */ \
- DEF(CONN_OUT_WAIT_CREATE) /* C2 */ \
- DEF(CONN_OUT_WAIT_OK) /* C3 */ \
- DEF(CONN_OUT_WAIT_CONF) /* C4 */ \
- \
- DEF(CONN_ACTIVE) /* C5 */ \
- \
- DEF(CONN_IN_PREPARING) /* C10 */ \
- DEF(CONN_IN_WAITING) /* C21 */ \
- DEF(CONN_IN_ARRIVED) /* C11 */ \
- DEF(CONN_IN_WAIT_ACCEPT_OK) /* C12 */ \
- DEF(CONN_IN_WAIT_COMPL) /* C13 */ \
- \
- DEF(CONN_REJ_WAIT_OK) /* C14 */ \
- DEF(CONN_REL_IN_WAIT_OK) /* C15 */ \
- DEF(CONN_REL_WAIT_OK) /* C20 */ \
- \
- DEF(CONN_AB_WAIT_REQ_OK) /* C33 */ \
- DEF(CONN_AB_WAIT_RESP_OK) /* C34 */ \
- DEF(CONN_AB_FLUSH_IND) /* C35 */ \
- DEF(CONN_OUT_WAIT_DESTROY) /* C37 */
-
-enum conn_state {
-#define DEF(N) N,
- CONN_STATES
-#undef DEF
-};
-
-#define CONN_SIGS \
- DEF(CONNECT_OUTGOING) /* U */ \
- DEF(ARRIVAL) /* U */ \
- DEF(RELEASE) /* U */ \
- DEF(REJECT) /* U */ \
- DEF(ACCEPT) /* U newuser */ \
- DEF(ADD_PARTY) /* U ident */ \
- DEF(DROP_PARTY) /* U ident */ \
- DEF(USER_ABORT) /* U */ \
- \
- DEF(CREATED) /* P msg */ \
- DEF(DESTROYED) /* P */ \
- DEF(SETUP_CONFIRM) /* P msg */ \
- DEF(SETUP_IND) /* P msg */ \
- DEF(SETUP_COMPL) /* P msg */ \
- DEF(PROC_IND) /* P msg */ \
- DEF(ALERTING_IND) /* P msg */ \
- DEF(REL_CONF) /* P msg */ \
- DEF(REL_IND) /* P msg */ \
- DEF(PARTY_CREATED) /* P msg */ \
- DEF(PARTY_DESTROYED) /* P msg */ \
- DEF(PARTY_ALERTING_IND) /* P msg */ \
- DEF(PARTY_ADD_ACK_IND) /* P msg */ \
- DEF(PARTY_ADD_REJ_IND) /* P msg */ \
- DEF(DROP_PARTY_IND) /* P msg */ \
- DEF(DROP_PARTY_ACK_IND) /* P msg */ \
- \
- DEF(OK) /* P msg */ \
- DEF(ERROR) /* P msg */
-
-enum conn_sig {
-#define DEF(NAME) CONN_SIG_##NAME,
-CONN_SIGS
-#undef DEF
-};
-extern const char *const cc_conn_sigtab[];
-
-/*
- * This describes a connection and must be in sync with the UNI
- * stack.
- */
-struct ccconn {
- enum conn_state state; /* API state of the connection */
- struct ccdata *cc; /* owner node */
- struct ccport *port; /* the port we belong to */
- struct ccuser *user; /* user instance we belong to */
- TAILQ_ENTRY(ccconn) connq_link; /* queue of the owner */
- LIST_ENTRY(ccconn) port_link; /* link in list of port */
- struct uni_cref cref;
- uint8_t reason;
- struct ccuser *acceptor;
-
- /* attributes */
- uint32_t blli_selector;
- struct uni_ie_blli blli[UNI_NUM_IE_BLLI];
-
- struct uni_ie_bearer bearer;
- struct uni_ie_traffic traffic;
- struct uni_ie_qos qos;
- struct uni_ie_exqos exqos;
- struct uni_ie_called called;
- struct uni_ie_calledsub calledsub;
- struct uni_ie_aal aal;
- struct uni_ie_epref epref;
- struct uni_ie_conned conned;
- struct uni_ie_connedsub connedsub;
- struct uni_ie_eetd eetd;
- struct uni_ie_abrsetup abrsetup;
- struct uni_ie_abradd abradd;
- struct uni_ie_mdcr mdcr;
-
- struct uni_ie_calling calling;
- struct uni_ie_callingsub callingsub;
- struct uni_ie_connid connid;
- struct uni_ie_tns tns[UNI_NUM_IE_TNS];
- struct uni_ie_atraffic atraffic;
- struct uni_ie_mintraffic mintraffic;
- struct uni_ie_cscope cscope;
- struct uni_ie_bhli bhli;
-
- /* bit mask of written attributes in A6 */
- u_int dirty_attr;
-
- struct uni_ie_cause cause[2];
-
- struct ccparty_list parties;
-};
-
-/* dirty attribute mask values */
-enum {
- CCDIRTY_AAL = 0x0001,
- CCDIRTY_BLLI = 0x0002,
- CCDIRTY_CONNID = 0x0004,
- CCDIRTY_NOTIFY = 0x0008, /* XXX */
- CCDIRTY_EETD = 0x0010,
- CCDIRTY_GIT = 0x0020, /* XXX */
- CCDIRTY_UU = 0x0040, /* XXX */
- CCDIRTY_TRAFFIC = 0x0080,
- CCDIRTY_EXQOS = 0x0100,
- CCDIRTY_ABRSETUP = 0x0200,
- CCDIRTY_ABRADD = 0x0400,
-};
-
-/* set conn to new state */
-void cc_conn_set_state(struct ccconn *, enum conn_state);
-
-/* return string for state */
-const char *cc_conn_state2str(u_int);
-
-/* connect connection to user */
-void cc_connect_to_user(struct ccconn *, struct ccuser *);
-
-/* disconnect from the user */
-void cc_disconnect_from_user(struct ccconn *);
-
-/* abort the connection */
-void cc_conn_abort(struct ccconn *, int);
-
-/* destroy a connection */
-void cc_conn_destroy(struct ccconn *);
-
-/* create a connection */
-struct ccconn *cc_conn_create(struct ccdata *);
-
-/* assign to port */
-void cc_conn_ins_port(struct ccconn *, struct ccport *);
-
-/* remove from port */
-void cc_conn_rem_port(struct ccconn *);
-
-/* dispatch a connection to a user or reject it */
-void cc_conn_dispatch(struct ccconn *);
-
-/* disconnect from acceptor */
-void cc_conn_reset_acceptor(struct ccconn *);
-
-/* log on a connection */
-#ifdef CCATM_DEBUG
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_conn_log(C, FMT, ARGS...) do { \
- (C)->cc->funcs->log("%s (conn=%p): " FMT, __FUNCTION__, \
- (C) , ## ARGS); \
- } while (0)
-#else
-#define cc_conn_log(C, FMT, ...) do { \
- (C)->cc->funcs->log("%s (conn=%p): " FMT, __func__, \
- (C), __VA_ARGS__); \
- } while (0)
-#endif
-#else
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_conn_log(C, FMT, ARGS...) do { } while (0)
-#else
-#define cc_conn_log(C, FMT, ...) do { } while (0)
-#endif
-#endif
-
-/* handle signal to connection */
-void cc_conn_sig_handle(struct ccconn *, enum conn_sig, void *arg, u_int iarg);
-
-/*
- * Mp connection parties
- */
-#define PARTY_STATES \
- DEF(NULL) /* 0 created */ \
- DEF(ACTIVE) /* 1 active */ \
- DEF(ADD_WAIT_CREATE) /* 2 wait for PARTY_CREATE */ \
- DEF(ADD_WAIT_OK) /* 3 wait for OK for ADD.request */ \
- DEF(ADD_WAIT_ACK) /* 4 wait for ADD.ack/rej */ \
- DEF(DROP_WAIT_OK) /* 5 wait for OK for DROP.request */ \
- DEF(DROP_WAIT_ACK) /* 6 wait for DROP.ack */ \
- DEF(WAIT_DESTROY) /* 7 wait for destroy */ \
- DEF(WAIT_SETUP_COMPL) /* 8 wait for setup.complete */ \
- DEF(WAIT_DROP_ACK_OK) /* 9 wait for OK for DROP_ACK.request */\
- DEF(WAIT_SETUP_CONF) /* 10 wait for setup.confirm */ \
- DEF(ADD_DROP_WAIT_OK) /* 11 wait for ok to DROP.request */ \
- DEF(ADD_DROPACK_WAIT_OK)/* 12 wait for ok to DROP_ACK.req */
-
-enum party_state {
-#define DEF(N) PARTY_##N,
-PARTY_STATES
-#undef DEF
-};
-
-struct ccparty {
- struct ccconn *conn; /* owner */
- LIST_ENTRY(ccparty) link;
- enum party_state state;
- struct uni_ie_called called;
- struct uni_ie_epref epref;
-};
-
-/* set party to new state */
-void cc_party_set_state(struct ccparty *, enum party_state);
-
-/* return string for state */
-const char *cc_party_state2str(u_int);
-
-/* create new party */
-struct ccparty *cc_party_create(struct ccconn *, u_int ident, u_int flag);
-
-/* log on a party */
-#ifdef CCATM_DEBUG
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_party_log(P, FMT, ARGS...) do { \
- (P)->conn->cc->funcs->log("%s (conn=%p, party=%p): " FMT, \
- __FUNCTION__, (P)->conn, (P) , ## ARGS); \
- } while (0)
-#else
-#define cc_party_log(P, FMT, ...) do { \
- (P)->conn->cc->funcs->log("%s (conn=%p, party=%p): " FMT, \
- __func__, (P)->conn, (P), __VA_ARGS__); \
- } while (0)
-#endif
-#else
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_party_log(P, FMT, ARGS...) do { } while (0)
-#else
-#define cc_party_log(P, FMT, ...) do { } while (0)
-#endif
-#endif
-
-/*
- * This is kind of a user socket, i.e. the entity managed towards the
- * upper layer.
- */
-#define USER_STATES \
- DEF(USER_NULL) /* U0 none */ \
- DEF(USER_OUT_PREPARING) /* U1 process set/query requests */ \
- DEF(USER_OUT_WAIT_OK) /* U2 wait for OK to setup */ \
- DEF(USER_OUT_WAIT_CONF) /* U3 wait for SETUP.confirm */ \
- DEF(USER_ACTIVE) /* U4 A8-9-10/U10 */ \
- DEF(USER_REL_WAIT) /* U5 wait for release to compl */ \
- DEF(USER_IN_PREPARING) /* U6 set SAP */ \
- DEF(USER_IN_WAITING) /* U7 wait and dispatch */ \
- DEF(USER_IN_ARRIVED) /* U8 waiting for rej/acc */ \
- DEF(USER_IN_WAIT_REJ) /* U9 wait for rejecting */ \
- DEF(USER_IN_WAIT_ACC) /* U10 wait for accepting */ \
- DEF(USER_IN_ACCEPTING) /* U11 wait for SETUP_complete */ \
- DEF(USER_REL_WAIT_SCOMP)/* U12 wait for SETUP_complete */ \
- DEF(USER_REL_WAIT_SCONF)/* U13 wait for SETUP.confirm */ \
- DEF(USER_REL_WAIT_CONF) /* U14 wait for confirm */ \
- DEF(USER_REL_WAIT_CONN) /* U15 wait for CONN_OK */
-
-enum user_state {
-#define DEF(N) N,
-USER_STATES
-#undef DEF
-};
-
-#define USER_SIGS \
- DEF(PREPARE_OUTGOING) /* U */ \
- DEF(CONNECT_OUTGOING) /* U msg */ \
- DEF(PREPARE_INCOMING) /* U msg */ \
- DEF(WAIT_ON_INCOMING) /* U msg */ \
- DEF(REJECT_INCOMING) /* U msg */ \
- DEF(ACCEPT_INCOMING) /* U msg */ \
- DEF(CALL_RELEASE) /* U msg */ \
- DEF(ADD_PARTY) /* U msg */ \
- DEF(DROP_PARTY) /* U msg */ \
- DEF(QUERY_ATTR) /* U msg */ \
- DEF(QUERY_ATTR_X) /* U msg */ \
- DEF(SET_ATTR) /* U msg */ \
- DEF(SET_ATTR_X) /* U msg */ \
- DEF(QUERY_STATE) /* U */ \
- DEF(GET_LOCAL_PORT_INFO) /* U msg */ \
- DEF(ABORT_CONNECTION) /* U msg */ \
- \
- DEF(CONNECT_OUTGOING_OK) /* */ \
- DEF(CONNECT_OUTGOING_ERR) /* reason */ \
- DEF(SETUP_CONFIRM) /* */ \
- DEF(SETUP_IND) /* */ \
- DEF(REJECT_OK) /* */ \
- DEF(REJECT_ERR) /* reason */ \
- DEF(ACCEPT_OK) /* */ \
- DEF(ACCEPT_ERR) /* reason */ \
- DEF(ACCEPTING) /* */ \
- DEF(SETUP_COMPL) /* */ \
- DEF(RELEASE_CONFIRM) /* */ \
- DEF(RELEASE_ERR) /* reason */ \
- DEF(ADD_PARTY_ERR) /* reason */ \
- DEF(ADD_PARTY_OK) /* */ \
- DEF(ADD_PARTY_ACK) /* leaf-ident */ \
- DEF(ADD_PARTY_REJ) /* leaf-ident */ \
- DEF(DROP_PARTY_ERR) /* reason */ \
- DEF(DROP_PARTY_OK) /* */ \
- DEF(DROP_PARTY_IND) /* leaf-ident */ \
-
-
-enum user_sig {
-#define DEF(NAME) USER_SIG_##NAME,
-USER_SIGS
-#undef DEF
-};
-extern const char *const cc_user_sigtab[];
-
-struct ccuser {
- LIST_ENTRY(ccuser) node_link; /* link in list of node */
- enum user_state state; /* type of this instance */
- struct ccdata *cc; /* the node */
- void *uarg; /* the hook (if any) */
- char name[ATM_EPNAMSIZ];
- enum {
- USER_P2P,
- USER_ROOT,
- USER_LEAF
- } config; /* configuration */
-
- struct uni_sap *sap; /* listening SAP */
- u_int queue_max; /* maximum queue size */
- u_int queue_act; /* actual queue size */
- TAILQ_HEAD(,ccconn) connq; /* pending connections */
- struct ccconn *accepted;
- struct uni_ie_cause cause[2]; /* cause from connection */
- u_int aborted;
-};
-
-/* set user to new state */
-void cc_user_set_state(struct ccuser *, enum user_state);
-
-/* return string for state */
-const char *cc_user_state2str(u_int);
-
-/* log on a user */
-#ifdef CCATM_DEBUG
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_user_log(U, FMT, ARGS...) do { \
- (U)->cc->funcs->log("%s (user=%p): " FMT, __FUNCTION__, \
- (U) , ## ARGS); \
- } while (0)
-#else
-#define cc_user_log(U, FMT, ...) do { \
- (U)->cc->funcs->log("%s (user=%p): " FMT, __func__, \
- (U), __VA_ARGS__); \
- } while (0)
-#endif
-#else
-#if defined(__GNUC__) && __GNUC__ < 3
-#define cc_user_log(U, FMT, ARGS...) do { } while (0)
-#else
-#define cc_user_log(U, FMT, ...) do { } while (0)
-#endif
-#endif
-
-/* Handle a signal to this user */
-void cc_user_sig_handle(struct ccuser *, enum user_sig, void *, u_int);
-
-/*
- * Addresses
- */
-struct ccaddr {
- TAILQ_ENTRY(ccaddr) port_link;
- struct uni_addr addr;
-};
-
-/* signal to connection */
-int cc_conn_sig(struct ccconn *, enum conn_sig, void *arg);
-
-/* signal with message to connection */
-int cc_conn_sig_msg(struct ccconn *, enum conn_sig, struct uni_msg *);
-int cc_conn_sig_msg_nodef(struct ccconn *, enum conn_sig, struct uni_msg *);
-
-/* response signal to connection */
-int cc_conn_resp(struct ccconn *, enum conn_sig, u_int, u_int, u_int);
-
-/* flush all signals to a given connection */
-void cc_conn_sig_flush(struct ccconn *);
-
-/* Queue a signal to this user */
-int cc_user_sig(struct ccuser *, enum user_sig, void *, u_int);
-
-/* Queue a signal with message to this user */
-int cc_user_sig_msg(struct ccuser *, enum user_sig, struct uni_msg *);
-
-/* Flush all signals to a given user */
-void cc_user_sig_flush(struct ccuser *);
-
-/* flush all signals */
-void cc_sig_flush_all(struct ccdata *);
diff --git a/sys/contrib/ngatm/netnatm/api/unisap.c b/sys/contrib/ngatm/netnatm/api/unisap.c
deleted file mode 100644
index d96f39ec1b1c..000000000000
--- a/sys/contrib/ngatm/netnatm/api/unisap.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- * Copyright (c) 2004
- * Hartmut Brandt
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/api/unisap.c,v 1.4 2004/07/08 08:22:01 brandt Exp $
- */
-
-#include <sys/types.h>
-#ifdef _KERNEL
-#include <sys/ctype.h>
-#include <sys/libkern.h>
-#else
-#include <ctype.h>
-#include <string.h>
-#endif
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/api/unisap.h>
-
-int
-unisve_check_addr(const struct unisve_addr *sve)
-{
- if (sve->tag == UNISVE_ABSENT)
- return (UNISVE_OK);
- if (sve->tag == UNISVE_ANY)
- return (UNISVE_OK);
- if (sve->tag != UNISVE_PRESENT)
- return (UNISVE_ERROR_BAD_TAG);
-
- if (sve->type == UNI_ADDR_INTERNATIONAL) {
- if (sve->plan != UNI_ADDR_E164)
- return (UNISVE_ERROR_TYPE_PLAN_CONFLICT);
- if (sve->len == 0 || sve->len > 15)
- return (UNISVE_ERROR_ADDR_LEN);
-
- } else if (sve->type == UNI_ADDR_UNKNOWN) {
- if (sve->plan != UNI_ADDR_ATME)
- return (UNISVE_ERROR_TYPE_PLAN_CONFLICT);
- if (sve->len != 19)
- return (UNISVE_ERROR_ADDR_LEN);
- } else
- return (UNISVE_ERROR_BAD_ADDR_TYPE);
-
- return (UNISVE_OK);
-}
-
-int
-unisve_check_selector(const struct unisve_selector *sve)
-{
- if (sve->tag != UNISVE_PRESENT &&
- sve->tag != UNISVE_ABSENT &&
- sve->tag != UNISVE_ANY)
- return (UNISVE_ERROR_BAD_TAG);
- return (UNISVE_OK);
-}
-
-/*
- * We don't want to check the protocol values here.
- */
-int
-unisve_check_blli_id2(const struct unisve_blli_id2 *sve)
-{
- if (sve->tag != UNISVE_PRESENT &&
- sve->tag != UNISVE_ABSENT &&
- sve->tag != UNISVE_ANY)
- return (UNISVE_ERROR_BAD_TAG);
- return (UNISVE_OK);
-}
-
-/*
- * We don't want to check the protocol values here.
- */
-int
-unisve_check_blli_id3(const struct unisve_blli_id3 *sve)
-{
- if (sve->tag != UNISVE_PRESENT &&
- sve->tag != UNISVE_ABSENT &&
- sve->tag != UNISVE_ANY)
- return (UNISVE_ERROR_BAD_TAG);
- return (UNISVE_OK);
-}
-
-int
-unisve_check_bhli(const struct unisve_bhli *sve)
-{
- if (sve->tag == UNISVE_ABSENT)
- return (UNISVE_OK);
- if (sve->tag == UNISVE_ANY)
- return (UNISVE_OK);
-
- if (sve->tag != UNISVE_PRESENT)
- return (UNISVE_ERROR_BAD_TAG);
-
- if (sve->type != UNI_BHLI_ISO &&
- sve->type != UNI_BHLI_USER &&
- sve->type != UNI_BHLI_VENDOR)
- return (UNISVE_ERROR_BAD_BHLI_TYPE);
-
- if (sve->len > sizeof(sve->info))
- return (UNISVE_ERROR_BAD_BHLI_LEN);
-
- return (UNISVE_OK);
-}
-
-int
-unisve_check_sap(const struct uni_sap *sap)
-{
- int err;
-
- if ((err = unisve_check_addr(&sap->addr)) != 0 ||
- (err = unisve_check_selector(&sap->selector)) != 0 ||
- (err = unisve_check_blli_id2(&sap->blli_id2)) != 0 ||
- (err = unisve_check_blli_id3(&sap->blli_id3)) != 0 ||
- (err = unisve_check_bhli(&sap->bhli)) != 0)
- return (err);
-
- if (sap->addr.plan == UNI_ADDR_E164) {
- if (sap->selector.tag == UNISVE_PRESENT)
- return (UNISVE_ERROR_ADDR_SEL_CONFLICT);
- } else if (sap->addr.plan == UNI_ADDR_ATME) {
- if (sap->selector.tag == UNISVE_ABSENT)
- return (UNISVE_ERROR_ADDR_SEL_CONFLICT);
- }
- return (0);
-}
-
-#define COMMON_OVERLAP(A1,A2) \
- if ((A1->tag == UNISVE_ABSENT && A2->tag == UNISVE_ABSENT) || \
- A1->tag == UNISVE_ANY || A2->tag == UNISVE_ANY) \
- return (1); \
- if ((A1->tag == UNISVE_ABSENT && A2->tag == UNISVE_PRESENT) || \
- (A2->tag == UNISVE_ABSENT && A1->tag == UNISVE_PRESENT)) \
- return (0);
-
-int
-unisve_overlap_addr(const struct unisve_addr *s1, const struct unisve_addr *s2)
-{
- COMMON_OVERLAP(s1, s2);
-
- return (s1->type == s2->type && s1->plan == s2->plan &&
- s1->len == s2->len && memcmp(s1->addr, s2->addr, s1->len) == 0);
-}
-
-int
-unisve_overlap_selector(const struct unisve_selector *s1,
- const struct unisve_selector *s2)
-{
- COMMON_OVERLAP(s1, s2);
-
- return (s1->selector == s2->selector);
-}
-
-int
-unisve_overlap_blli_id2(const struct unisve_blli_id2 *s1,
- const struct unisve_blli_id2 *s2)
-{
- COMMON_OVERLAP(s1, s2);
-
- return (s1->proto == s2->proto &&
- (s1->proto != UNI_BLLI_L2_USER || s1->user == s2->user));
-}
-
-int
-unisve_overlap_blli_id3(const struct unisve_blli_id3 *s1,
- const struct unisve_blli_id3 *s2)
-{
- COMMON_OVERLAP(s1, s2);
-
- if (s1->proto != s2->proto)
- return (0);
- if (s1->proto == UNI_BLLI_L3_USER)
- return (s1->user == s2->user);
- if (s1->proto == UNI_BLLI_L3_TR9577) {
- if (s1->noipi && s2->noipi)
- return (1);
- if (!s1->noipi && !s2->noipi) {
- if (s1->ipi == s2->ipi) {
- if (s1->ipi != UNI_BLLI_L3_SNAP)
- return (1);
- if (s1->oui == s2->oui && s1->pid == s2->pid)
- return (1);
- }
- }
- return (0);
- }
- return (1);
-}
-
-int
-unisve_overlap_bhli(const struct unisve_bhli *s1, const struct unisve_bhli *s2)
-{
- COMMON_OVERLAP(s1, s2);
-
- return (s1->type == s2->type && s1->len == s2->len &&
- memcmp(s1->info, s2->info, s1->len) == 0);
-}
-
-int
-unisve_overlap_sap(const struct uni_sap *s1, const struct uni_sap *s2)
-{
- int any1, any2;
-
- /*
- * Two catch-all's SAP's are not allowed. A catch-all does never
- * overlap with a non-catch all SAP.
- */
- any1 = unisve_is_catchall(s1);
- any2 = unisve_is_catchall(s2);
-
- if (any1 && any2)
- return (1);
- if(any1 || any2)
- return (0);
-
- return (unisve_overlap_addr(&s1->addr, &s2->addr) &&
- unisve_overlap_selector(&s1->selector, &s2->selector) &&
- unisve_overlap_blli_id2(&s1->blli_id2, &s2->blli_id2) &&
- unisve_overlap_blli_id3(&s1->blli_id3, &s2->blli_id3) &&
- unisve_overlap_bhli(&s1->bhli, &s2->bhli));
-}
-
-int
-unisve_is_catchall(const struct uni_sap *sap)
-{
- return (sap->addr.tag == UNISVE_ANY &&
- sap->selector.tag == UNISVE_ANY &&
- sap->blli_id2.tag == UNISVE_ANY &&
- sap->blli_id3.tag == UNISVE_ANY &&
- sap->bhli.tag == UNISVE_ANY);
-}
-
-int
-unisve_match(const struct uni_sap *sap, const struct uni_ie_called *called,
- const struct uni_ie_blli *blli, const struct uni_ie_bhli *bhli)
-{
- switch (sap->addr.tag) {
- case UNISVE_ABSENT:
- if (IE_ISGOOD(*called))
- return (0);
- break;
-
- case UNISVE_ANY:
- break;
-
- case UNISVE_PRESENT:
- if (!IE_ISGOOD(*called))
- return (0);
- if (called->addr.type != sap->addr.type ||
- called->addr.plan != sap->addr.plan)
- return (0);
- if (called->addr.plan == UNI_ADDR_E164) {
- if (called->addr.len != sap->addr.len ||
- memcmp(called->addr.addr, sap->addr.addr,
- called->addr.len) != 0)
- return (0);
- } else if (called->addr.plan == UNI_ADDR_ATME) {
- if (called->addr.len != 20 ||
- memcmp(called->addr.addr, sap->addr.addr, 19) != 0)
- return (0);
- }
- break;
-
- default:
- return (0);
- }
-
- switch (sap->selector.tag) {
-
- case UNISVE_ABSENT:
- if (IE_ISGOOD(*called) && called->addr.plan == UNI_ADDR_ATME)
- return (0);
- break;
-
- case UNISVE_ANY:
- break;
-
- case UNISVE_PRESENT:
- if (!IE_ISGOOD(*called))
- return (0);
- if (called->addr.plan != UNI_ADDR_ATME)
- return (0);
- if (called->addr.addr[19] != sap->selector.selector)
- return (0);
- break;
-
- default:
- return (0);
- }
-
- switch (sap->blli_id2.tag) {
-
- case UNISVE_ABSENT:
- if (IE_ISGOOD(*blli) && (blli->h.present & UNI_BLLI_L2_P))
- return (0);
- break;
-
- case UNISVE_ANY:
- break;
-
- case UNISVE_PRESENT:
- if (!IE_ISGOOD(*blli) || (blli->h.present & UNI_BLLI_L2_P) == 0)
- return (0);
- if (blli->l2 != sap->blli_id2.proto)
- return (0);
- if (blli->l2 == UNI_BLLI_L2_USER) {
- if ((blli->h.present & UNI_BLLI_L2_USER_P) == 0)
- return (0);
- if (blli->l2_user != sap->blli_id2.user)
- return (0);
- }
- break;
-
- default:
- return (0);
- }
-
- switch (sap->blli_id3.tag) {
-
- case UNISVE_ABSENT:
- if (IE_ISGOOD(*blli) && (blli->h.present & UNI_BLLI_L3_P))
- return (0);
- break;
-
- case UNISVE_ANY:
- break;
-
- case UNISVE_PRESENT:
- if (!IE_ISGOOD(*blli) || (blli->h.present & UNI_BLLI_L3_P) == 0)
- return (0);
- if (blli->l3 != sap->blli_id3.proto)
- return (0);
- if (blli->l3 == UNI_BLLI_L3_USER) {
- if ((blli->h.present & UNI_BLLI_L3_USER_P) == 0)
- return (0);
- if (blli->l3_user != sap->blli_id3.user)
- return (0);
- break;
- }
- if (blli->l3 == UNI_BLLI_L3_TR9577) {
- if (sap->blli_id3.noipi) {
- if (blli->h.present & UNI_BLLI_L3_IPI_P)
- return (0);
- } else {
- if (!(blli->h.present & UNI_BLLI_L3_IPI_P))
- return (0);
- if (blli->l3_ipi != sap->blli_id3.ipi)
- return (0);
- if (blli->l3_ipi == UNI_BLLI_L3_SNAP) {
- if (!(blli->h.present &
- UNI_BLLI_L3_SNAP_P))
- return (0);
- if (blli->oui != sap->blli_id3.oui ||
- blli->pid != sap->blli_id3.pid)
- return (0);
- }
- }
- }
- break;
-
- default:
- return (0);
- }
-
- switch (sap->bhli.tag) {
-
- case UNISVE_ABSENT:
- if (IE_ISGOOD(*bhli))
- return (0);
- break;
-
- case UNISVE_ANY:
- break;
-
- case UNISVE_PRESENT:
- if (!IE_ISGOOD(*bhli))
- return (0);
- if (sap->bhli.type != bhli->type)
- return (0);
- if (sap->bhli.len != bhli->len)
- return (0);
- if (memcmp(sap->bhli.info, bhli->info, bhli->len) != 0)
- return (0);
- break;
-
- default:
- return (0);
- }
- /* Uff */
- return (1);
-}
diff --git a/sys/contrib/ngatm/netnatm/api/unisap.h b/sys/contrib/ngatm/netnatm/api/unisap.h
deleted file mode 100644
index ffbfc9fa42e8..000000000000
--- a/sys/contrib/ngatm/netnatm/api/unisap.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/api/unisap.h,v 1.6 2005/05/23 11:49:17 brandt_h Exp $
- */
-#ifndef _NETNATM_API_UNISAP_H_
-#define _NETNATM_API_UNISAP_H_
-
-#include <netnatm/msg/uni_config.h>
-
-enum unisve_tag {
- UNISVE_ABSENT, /* Element is absent */
- UNISVE_PRESENT, /* Element is present with specific value */
- UNISVE_ANY /* Any values is acceptable */
-};
-
-struct unisve_addr {
- enum unisve_tag tag;
- enum uni_addr_type type; /* type of address */
- enum uni_addr_plan plan; /* addressing plan */
- uint32_t len; /* length of address */
- u_char addr[UNI_ADDR_MAXLEN];
-};
-
-struct unisve_selector {
- enum unisve_tag tag;
- uint8_t selector;
-};
-
-struct unisve_blli_id2 {
- enum unisve_tag tag;
- u_int proto:5; /* the protocol */
- u_int user:7; /* user specific protocol */
-};
-
-struct unisve_blli_id3 {
- enum unisve_tag tag;
- u_int proto:5; /* L3 protocol */
- u_int user:7; /* user specific protocol */
- u_int ipi:8; /* ISO/IEC TR 9557 IPI */
- u_int oui:24; /* IEEE 802.1 OUI */
- u_int pid:16; /* IEEE 802.1 PID */
- uint32_t noipi; /* ISO/IEC TR 9557 per frame */
-};
-
-struct unisve_bhli {
- enum unisve_tag tag;
- enum uni_bhli type; /* type of info */
- uint32_t len; /* length of info */
- uint8_t info[8]; /* info itself */
-};
-
-struct uni_sap {
- struct unisve_addr addr;
- struct unisve_selector selector;
- struct unisve_blli_id2 blli_id2;
- struct unisve_blli_id3 blli_id3;
- struct unisve_bhli bhli;
-};
-
-int unisve_check_addr(const struct unisve_addr *);
-int unisve_check_selector(const struct unisve_selector *);
-int unisve_check_blli_id2(const struct unisve_blli_id2 *);
-int unisve_check_blli_id3(const struct unisve_blli_id3 *);
-int unisve_check_bhli(const struct unisve_bhli *);
-
-int unisve_check_sap(const struct uni_sap *);
-
-int unisve_overlap_addr(const struct unisve_addr *, const struct unisve_addr *);
-int unisve_overlap_selector(const struct unisve_selector *,
- const struct unisve_selector *);
-int unisve_overlap_blli_id2(const struct unisve_blli_id2 *,
- const struct unisve_blli_id2 *);
-int unisve_overlap_blli_id3(const struct unisve_blli_id3 *,
- const struct unisve_blli_id3 *);
-int unisve_overlap_bhli(const struct unisve_bhli *,
- const struct unisve_bhli *);
-int unisve_overlap_sap(const struct uni_sap *, const struct uni_sap *);
-
-int unisve_is_catchall(const struct uni_sap *);
-int unisve_match(const struct uni_sap *, const struct uni_ie_called *,
- const struct uni_ie_blli *, const struct uni_ie_bhli *);
-
-enum {
- UNISVE_OK = 0,
- UNISVE_ERROR_BAD_TAG,
- UNISVE_ERROR_TYPE_PLAN_CONFLICT,
- UNISVE_ERROR_ADDR_SEL_CONFLICT,
- UNISVE_ERROR_ADDR_LEN,
- UNISVE_ERROR_BAD_ADDR_TYPE,
- UNISVE_ERROR_BAD_BHLI_TYPE,
- UNISVE_ERROR_BAD_BHLI_LEN,
-};
-
-#define UNISVE_ERRSTR \
- "no error", \
- "bad SVE tag", \
- "bad address type/plan combination", \
- "bad address plan/selector tag combination", \
- "bad address length in SVE", \
- "unknown address type in SVE", \
- "bad BHLI type in SVE", \
- "BHLI info too long in SVE",
-
-#endif
diff --git a/sys/contrib/ngatm/netnatm/genfiles b/sys/contrib/ngatm/netnatm/genfiles
deleted file mode 100644
index 70fb5e880463..000000000000
--- a/sys/contrib/ngatm/netnatm/genfiles
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Author: Harti Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/genfiles,v 1.4 2004/07/08 08:21:45 brandt Exp $
-#
-awk -f ${SRC}msg/parseie.awk -f ${SRC}msg/geniec.awk ${SRC}msg/ie.def >${DST}msg/uni_ietab.h
-awk -f ${SRC}msg/parseie.awk -f ${SRC}msg/genieh.awk ${SRC}msg/ie.def >${DST}msg/uni_ie.h
-awk -f ${SRC}msg/parsemsg.awk -f ${SRC}msg/genmsgc.awk ${SRC}msg/msg.def >${DST}msg/uni_msg.c
-awk -f ${SRC}msg/parsemsg.awk -f ${SRC}msg/genmsgh.awk ${SRC}msg/msg.def >${DST}msg/uni_msg.h
-awk -f ${SRC}msg/parsemsg.awk -f ${SRC}sig/genmsgcpyh.awk ${SRC}msg/msg.def >${DST}sig/unimsgcpy.h
-awk -f ${SRC}msg/parsemsg.awk -f ${SRC}sig/genmsgcpyc.awk ${SRC}msg/msg.def >${DST}sig/sig_unimsgcpy.c
diff --git a/sys/contrib/ngatm/netnatm/misc/straddr.c b/sys/contrib/ngatm/netnatm/misc/straddr.c
deleted file mode 100644
index 7d21b8f74206..000000000000
--- a/sys/contrib/ngatm/netnatm/misc/straddr.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) 1996-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/misc/straddr.c,v 1.4 2004/07/08 08:22:02 brandt Exp $
- */
-
-#include <sys/types.h>
-#ifdef _KERNEL
-#include <sys/ctype.h>
-#include <sys/libkern.h>
-#else
-#include <ctype.h>
-#include <string.h>
-#endif
-#include <netnatm/addr.h>
-
-/*
- * Convert an NSAP address from the ASCII format to the binary.
- * ASCII format means each byte formatted as a 2-byte hex number
- * with dots freely interspersed between the bytes.
- * If the conversion is succesful, the function returns 0, -1
- * on conversion errors.
- */
-int
-uni_str2nsap(u_char *out, const char *in)
-{
- int i;
- int c;
-
- for(i = 0; i < 20; i++) {
- while((c = *in++) == '.')
- ;
- if(!isascii(c) || !isxdigit(c))
- return -1;
- out[i] = isdigit(c) ? (c - '0')
- : islower(c) ? (c - 'a' + 10)
- : (c - 'A' + 10);
- out[i] <<= 4;
- c = *in++;
- if(!isascii(c) || !isxdigit(c))
- return -1;
- out[i] |= isdigit(c) ? (c - '0')
- : islower(c) ? (c - 'a' + 10)
- : (c - 'A' + 10);
- }
- return *in != '\0';
-}
-
-/*
- * Parse an emebedded E.164 NSAP address.
- * If check is 0, the contents of the last 11 bytes are ignored
- * If check is 1, the contents of all of these but the selector byte
- * are checked to be zero. If check is 2 all 11 bytes must be 0.
- */
-int
-uni_nsap2e164(char *e164, const u_char *nsap, int check)
-{
- char *p = e164;
- u_int d;
- int i;
-
- if(nsap[0] != 0x45)
- return -1;
- if((nsap[8] & 0xf) != 0xf)
- return -1;
- for(i = 1; i <= 7; i++) {
- d = (nsap[i] >> 4) & 0xf;
- if(d == 0x00 && p == e164)
- continue;
- if(d >= 0xa)
- return -1;
- *p++ = d + '0';
-
- d = nsap[i] & 0xf;
- if(d == 0x00 && p == e164)
- continue;
- if(d >= 0xa)
- return -1;
- *p++ = d + '0';
- }
- d = (nsap[i] >> 4) & 0xf;
- if(d != 0x00 || p == e164) {
- if(d >= 0xa)
- return -1;
- *p++ = d + '0';
- }
- if(p == e164)
- return -1;
- *p++ = 0;
-
- if(check == 0)
- return 0;
- while(i < ((check == 1) ? 19 : 20)) {
- if(nsap[i] != 0x00)
- return -1;
- i++;
- }
-
- return 0;
-}
-
-/*
- * Convert a binary representation to ASCII. The standard formats are
- * recognized and dotted. Non-standard formats get no dots altogether.
- */
-void
-uni_prefix2str(char *out, const u_char *in, u_int len, int dotit)
-{
- static char hex[16] = "0123456789abcdef";
- static int fmt[3][6] = {
- { 1, 2, 10, 6, 1, 0 },
- { 1, 2, 10, 6, 1, 0 },
- { 1, 8, 4, 6, 1, 0 },
- };
- int f, b;
- u_int i;
-
- if (len > 20)
- len = 20;
-
- if(dotit) {
- switch(*in) {
-
- case 0x39: /* DCC */
- i = 0;
- fmt:
- for(f = 0; fmt[i][f]; f++) {
- if (len == 0)
- goto done;
- if(f != 0)
- *out++ = '.';
- for(b = 0; b < fmt[i][f]; b++) {
- if (len-- == 0)
- goto done;
- *out++ = hex[(*in >> 4) & 0xf];
- *out++ = hex[*in & 0xf];
- in++;
- }
- }
- done:
- *out = '\0';
- return;
-
- case 0x47: /* ICD */
- i = 1;
- goto fmt;
-
- case 0x45: /* E.164 */
- i = 2;
- goto fmt;
- }
- }
-
- /* undotted */
- for(i = 0; i < len; i++) {
- *out++ = hex[(*in >> 4) & 0xf];
- *out++ = hex[*in & 0xf];
- in++;
- }
- *out = '\0';
-}
-
-void
-uni_nsap2str(char *out, const u_char *in, int dotit)
-{
- uni_prefix2str(out, in, 20, dotit);
-}
-
-/*
- * Make an embedded E.164 NSAP address from a NSAP address.
- * The E.164 address is a string of digits, at least one digit and
- * not more than 15 digits long. The NSAP address will start with
- * byte 0x45 and then a 8 byte field, which contains the right
- * justified E.164 address in BCD coding, filled with a 0xf to the
- * right. The rest of the address is zero.
- * The function returns 0 if everything is ok, -1 in case of a wrong
- * E.164 address.
- */
-int
-uni_e1642nsap(u_char *nsap, const char *e164)
-{
- size_t len;
- int fill;
- u_int i;
-
- if((len = strlen(e164)) > 15 || len == 0)
- return -1;
- for(i = 0; i < len; i++)
- if(!isdigit(e164[i]))
- return -1;
-
- *nsap++ = 0x45;
- fill = (15 - len) / 2;
- while(fill--)
- *nsap++ = 0x00;
- if((len & 1) == 0) {
- *nsap++ = *e164++ - '0';
- len--;
- }
- while(len > 1) {
- len -= 2;
- *nsap = (*e164++ - '0') << 4;
- *nsap++ |= *e164 - '0';
- }
- *nsap++ = ((*e164++ - '0') << 4) | 0xf;
- for(fill = 0; fill < 11; fill++)
- *nsap++ = 0;
-
- return 0;
-}
diff --git a/sys/contrib/ngatm/netnatm/misc/unimsg_common.c b/sys/contrib/ngatm/netnatm/misc/unimsg_common.c
deleted file mode 100644
index 033213aef781..000000000000
--- a/sys/contrib/ngatm/netnatm/misc/unimsg_common.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2003-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Begemot: libunimsg/netnatm/misc/unimsg_common.c,v 1.3 2004/07/08 08:22:03 brandt Exp $
- */
-
-#include <netnatm/unimsg.h>
-
-/*
- * Make sure there is enough space in front of the data for
- * len bytes, and update the read pointer.
- */
-int
-uni_msg_prepend(struct uni_msg *msg, size_t len)
-{
- size_t need;
-
- if (uni_msg_leading(msg) >= len) {
- msg->b_rptr -= len;
- return (0);
- }
- need = len - uni_msg_leading(msg);
- if (uni_msg_ensure(msg, need))
- return (-1);
- memcpy(msg->b_rptr + need, msg->b_rptr, uni_msg_len(msg));
- msg->b_rptr += need - len;
- msg->b_wptr += need;
- return (0);
-}
diff --git a/sys/contrib/ngatm/netnatm/msg/geniec.awk b/sys/contrib/ngatm/netnatm/msg/geniec.awk
deleted file mode 100644
index d0620825178f..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/geniec.awk
+++ /dev/null
@@ -1,110 +0,0 @@
-#
-# Copyright (c) 2001-2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/msg/geniec.awk,v 1.4 2003/10/10 14:50:05 hbb Exp $
-#
-# Generate table for IE parsing.
-#
-# This function is called before the first line
-#
-function begin() {
- for(i = 0; i < 256; i++) {
- for(j = 0; j < 4; j++) {
- decl[i,j] = ""
- }
- }
-}
-
-#
-# This function is called after the last line.
-#
-function end() {
- print ""
- print "const struct iedecl *uni_ietable[256][4] = {"
- for(i = 0; i < 256; i++) {
- printf "\t{"
- for(j = 0; j < 4; j++) {
- if(decl[i,j] == "") {
- printf " NULL,"
- } else {
- printf " &%s,", decl[i,j]
- }
- }
- printf " }, /* 0x%02x */\n", i
- }
- print "};"
-}
-
-#
-# This function is called just when the first information element was found
-#
-function first_element() {
- print "/* This file was created automatically"
- print " * Source file: " id
- print " */"
- print ""
-}
-
-#
-# This is called, when the information element is defaulted (there is
-# only the name and the coding scheme
-#
-function element_default() {
- print ""
- print "static const struct iedecl decl_" coding "_" ie " = {"
- print "\tUNIFL_DEFAULT,"
- print "\t0,"
- print "\t(uni_print_f)NULL,"
- print "\t(uni_check_f)NULL,"
- print "\t(uni_encode_f)NULL,"
- print "\t(uni_decode_f)NULL"
- print "};"
- decl[number,ncoding] = "decl_" coding "_" ie
-}
-
-#
-# This is found for a real, non-default IE
-#
-function element() {
- print ""
- print "static void uni_ie_print_" coding "_" ie "(struct uni_ie_" ie " *, struct unicx *);"
- print "static int uni_ie_check_" coding "_" ie "(struct uni_ie_" ie " *, struct unicx *);"
- print "static int uni_ie_encode_" coding "_" ie "(struct uni_msg *, struct uni_ie_" ie " *, struct unicx *);"
- print "static int uni_ie_decode_" coding "_" ie "(struct uni_ie_" ie " *, struct uni_msg *, u_int, struct unicx *);"
- print ""
- print "static struct iedecl decl_" coding "_" ie " = {"
- if(access) print "\tUNIFL_ACCESS,"
- else print "\t0,"
- print "\t" len ","
- print "\t(uni_print_f)uni_ie_print_" coding "_" ie ","
- print "\t(uni_check_f)uni_ie_check_" coding "_" ie ","
- print "\t(uni_encode_f)uni_ie_encode_" coding "_" ie ","
- print "\t(uni_decode_f)uni_ie_decode_" coding "_" ie ""
- print "};"
- decl[number,ncoding] = "decl_" coding "_" ie
-}
diff --git a/sys/contrib/ngatm/netnatm/msg/genieh.awk b/sys/contrib/ngatm/netnatm/msg/genieh.awk
deleted file mode 100644
index 7120d7b9a020..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/genieh.awk
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Copyright (c) 2001-2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/msg/genieh.awk,v 1.4 2004/07/08 08:22:03 brandt Exp $
-#
-# Generate IE header file
-#
-function begin() {
-}
-
-function first_element() {
- print "/* This file was created automatically"
- print " * Source file: " id
- print " */"
- print ""
- print "#ifndef _NETNATM_MSG_UNI_IE_H_"
- print "#define _NETNATM_MSG_UNI_IE_H_"
- print ""
- print "union uni_ieall {"
- print " struct uni_iehdr h;"
-}
-
-function end() {
- print "};"
- print ""
- print "#endif"
-}
-
-function element_default() {
-}
-
-function element() {
- if(ie in u) return
- u[ie] = 1
- print " struct uni_ie_" ie " " ie ";"
-}
diff --git a/sys/contrib/ngatm/netnatm/msg/genmsgc.awk b/sys/contrib/ngatm/netnatm/msg/genmsgc.awk
deleted file mode 100644
index ffd69ac5fc69..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/genmsgc.awk
+++ /dev/null
@@ -1,274 +0,0 @@
-#
-# Copyright (c) 2001-2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/msg/genmsgc.awk,v 1.6 2004/07/08 08:22:04 brandt Exp $
-#
-# Generate message functions.
-#
-function begin() {
-}
-
-function first_entry() {
- print "/* This file was created automatically"
- print " * Source file: " id
- print " */"
- print ""
- print "#include <sys/types.h>"
- print "#include <sys/param.h>"
- print ""
- print "#ifdef _KERNEL"
- print "#include <sys/libkern.h>"
- print "#else"
- print "#include <string.h>"
- print "#endif"
- print "#include <netnatm/unimsg.h>"
- print "#include <netnatm/msg/unistruct.h>"
- print "#include <netnatm/msg/unimsglib.h>"
- print "#include <netnatm/msg/priv.h>"
- print "#include <netnatm/msg/privmsg.c>"
-}
-
-function end() {
- print ""
- print "const struct msgdecl *uni_msgtable[256] = {"
- for(i = 0; i < 256; i++) {
- if(decl[i] == "") {
- printf "\t&decl_unknown,"
- } else {
- printf "\t&%s,", decl[i]
- }
- printf "\t/* 0x%02x */\n", i
- }
- print "};"
-}
-
-function start_message() {
-}
-
-function end_message() {
- gen_print()
- gen_check()
- gen_encode()
- gen_decode()
- gen_reg()
-}
-
-function gen_print() {
- print ""
- print "static void"
- print "print_" msg "(struct uni_" msg " *msg, struct unicx *cx)"
- print "{"
- if(msgrep) {
- print "\tu_int i;"
- print ""
- }
- for(i = 0; i < cnt; i++) {
- ie = iename[i]
- uie = toupper(iename[i])
- if(ierep[i]) {
- print "\tif(msg->" ie "_repeat.h.present & UNI_IE_PRESENT)"
- print "\t\tuni_print_ie_internal(UNI_IE_REPEAT, (union uni_ieall *)&msg->" ie "_repeat, cx);"
- }
- if(ienum[i] == "-") {
- print "\tif(msg->" ie ".h.present & UNI_IE_PRESENT)"
- print "\t\tuni_print_ie_internal(UNI_IE_" uie ", (union uni_ieall *)&msg->" ie ", cx);"
- } else {
- print "\tfor(i = 0; i < " ienum[i] "; i++)"
- print "\t\tif(msg->" ie "[i].h.present & UNI_IE_PRESENT)"
- print "\t\t\tuni_print_ie_internal(UNI_IE_" uie ", (union uni_ieall *)&msg->" ie "[i], cx);"
- }
- }
- print "}"
-}
-
-function gen_check() {
- print ""
- print "static int"
- print "check_" msg "(struct uni_" msg " *m, struct unicx *cx)"
- print "{"
- print "\tint ret = 0;"
- if(msgrep) {
- print "\tu_int i;"
- }
- print ""
- for(i = 0; i < cnt; i++) {
- ie = iename[i]
- if(ierep[i]) {
- if(iecond[i] == "1") {
- print "\tret |= uni_check_ie(UNI_IE_REPEAT, (union uni_ieall *)&m->" ie "_repeat, cx);"
- } else {
- print "\tif(!(" iecond[i] "))"
- print "\t\tret |= IE_ISPRESENT(m->" ie "_repeat);"
- print "\telse"
- print "\t\tret |= uni_check_ie(UNI_IE_REPEAT, (union uni_ieall *)&m->" ie "_repeat, cx);"
- }
- }
- if(ienum[i] == "-") {
- if(iecond[i] == "1") {
- print "\tret |= uni_check_ie(UNI_IE_" toupper(ie) ", (union uni_ieall *)&m->" ie ", cx);"
- } else {
- print "\tif(!(" iecond[i] "))"
- print "\t\tret |= IE_ISPRESENT(m->" ie ");"
- print "\telse"
- print "\t\tret |= uni_check_ie(UNI_IE_" toupper(ie) ", (union uni_ieall *)&m->" ie ", cx);"
- }
- } else {
- print "\tfor(i = 0; i < " ienum[i]" ; i++) {"
- if(iecond[i] == "1") {
- print "\t\tret |= uni_check_ie(UNI_IE_" toupper(ie) ", (union uni_ieall *)&m->" ie "[i], cx);"
- } else {
- print "\t\tif(!(" iecond[i] "))"
- print "\t\t\tret |= IE_ISPRESENT(m->" ie "[i]);"
- print "\t\telse"
- print "\t\t\tret |= uni_check_ie(UNI_IE_" toupper(ie) ", (union uni_ieall *)&m->" ie "[i], cx);"
- }
- print "\t}"
- }
- }
- print ""
- print "\treturn ret;"
- print "}"
-}
-
-function gen_encode() {
- print ""
- print "static int"
- print "encode_" msg "(struct uni_msg *msg, struct uni_" msg " *p, struct unicx *cx)"
- print "{"
- print "\tu_int mlen;"
- if(msgrep) {
- print "\tu_int i;"
- }
- print ""
- print "\tif(uni_encode_msg_hdr(msg, &p->hdr, UNI_" toupper(msg) ", cx, &mlen))"
- print "\t\treturn (-2);"
- print ""
- for(i = 0; i < cnt; i++) {
- ie = iename[i]
- if(ierep[i]) {
- print "\tif((p->" ie "_repeat.h.present & UNI_IE_PRESENT) &&"
- print "\t uni_encode_ie(UNI_IE_" toupper(ie) ", msg, (union uni_ieall *)&p->" ie "_repeat, cx))"
- print "\t\treturn (0x10000000 + UNI_IE_" toupper(ie) ");"
- }
- if(ienum[i] == "-") {
- print "\tif((p->" ie ".h.present & UNI_IE_PRESENT) &&"
- print "\t uni_encode_ie(UNI_IE_" toupper(ie) ", msg, (union uni_ieall *)&p->" ie ", cx))"
- print "\t\treturn (UNI_IE_" toupper(ie) ");"
- } else {
- print "\tfor(i = 0; i < " ienum[i] "; i++)"
- print "\t\tif((p->" ie "[i].h.present & UNI_IE_PRESENT) &&"
- print "\t\t uni_encode_ie(UNI_IE_" toupper(ie) ", msg, (union uni_ieall *)&p->" ie "[i], cx))"
- print "\t\treturn ((i << 16) + UNI_IE_" toupper(ie) ");"
- }
- }
- print ""
- print "\tmsg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8;"
- print "\tmsg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0;"
- print ""
- print "\treturn (0);"
- print "}"
-}
-
-function gen_decode() {
- print ""
- print "static int"
- print "decode_" msg "(struct uni_" msg " *out, struct uni_msg *msg,"
- print " enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen,"
- print " struct unicx *cx)"
- print "{"
- if (msgrep) {
- print " u_int i;"
- print ""
- }
- print " switch (ie) {"
-
- rep=0
- for (i = 0; i < cnt; i++) {
- ie = iename[i]
- print ""
- print " case UNI_IE_" toupper(ie) ":"
- if (iecond[i] != "1") {
- print " if (!(" iecond[i] "))"
- print " return (DEC_ILL);"
- }
- if (ierep[i]) {
- rep=1
- print " if (IE_ISPRESENT(cx->repeat))"
- print " out->" ie "_repeat = cx->repeat;"
- }
- if (ienum[i] == "-") {
- print " out->" ie ".h = *hdr;"
- print " if (hdr->present & UNI_IE_ERROR)"
- print " return (DEC_ERR);"
- print " if(uni_decode_ie_body(UNI_IE_"toupper(ie)", (union uni_ieall *)&out->"ie", msg, ielen, cx))"
- print " return (DEC_ERR);"
-
- } else {
- print " for(i = 0; i < " ienum[i] "; i++)"
- print " if (!IE_ISPRESENT(out->" ie "[i])) {"
- print " out->" ie "[i].h = *hdr;"
- print " if (hdr->present & UNI_IE_ERROR)"
- print " return (DEC_ERR);"
- print " if(uni_decode_ie_body(UNI_IE_"toupper(ie)", (union uni_ieall *)&out->"ie"[i], msg, ielen, cx))"
- print " return (DEC_ERR);"
- print " break;"
- print " }"
- }
- print " break;"
- }
- if(rep) {
- print ""
- print " case UNI_IE_REPEAT:"
- print " cx->repeat.h = *hdr;"
- print " if (hdr->present & UNI_IE_ERROR)"
- print " return (DEC_ERR);"
- print " if (uni_decode_ie_body(UNI_IE_REPEAT, (union uni_ieall *)&cx->repeat, msg, ielen, cx))"
- print " return (DEC_ERR);"
- print " break;"
- }
-
- print ""
- print " default:"
- print " return (DEC_ILL);"
- print " }"
- print " return (DEC_OK);"
- print "}"
-}
-
-function gen_reg() {
- print ""
- print "static const struct msgdecl decl_" msg " = {"
- print "\t0,"
- print "\t\"" msg "\","
- print "\t(uni_msg_print_f)print_" msg ","
- print "\t(uni_msg_check_f)check_" msg ","
- print "\t(uni_msg_encode_f)encode_" msg ","
- print "\t(uni_msg_decode_f)decode_" msg
- print "};"
- decl[code] = "decl_" msg
-}
diff --git a/sys/contrib/ngatm/netnatm/msg/genmsgh.awk b/sys/contrib/ngatm/netnatm/msg/genmsgh.awk
deleted file mode 100644
index 8705b31e1e30..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/genmsgh.awk
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Copyright (c) 2001-2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/msg/genmsgh.awk,v 1.4 2004/07/08 08:22:04 brandt Exp $
-#
-# Generate message header
-#
-function begin() {
-}
-
-function first_entry() {
- print "/* This file was created automatically"
- print " * Source file: " id
- print " */"
- print ""
- print "#ifndef _NETNATM_MSG_UNI_MSG_H_"
- print "#define _NETNATM_MSG_UNI_MSG_H_"
-}
-
-function end() {
- print ""
- print "union uni_msgall {"
- print "\tstruct uni_msghdr\thdr;"
- for(i = 0; i < mcnt; i++) {
- m = messages[i]
- if(msgcond[i] == "") {
- print "\tstruct uni_" m "\t" m ";"
- } else {
- print "\tstruct uni_" m "\t" m ";\t/* " msgcond[i] " */"
- }
- }
- print "};"
- print ""
- print "#endif"
-}
-
-function start_message() {
-}
-
-function end_message() {
- print ""
- print "struct uni_" msg " {"
- print "\tstruct uni_msghdr\thdr;"
- for(i = 0; i < cnt; i++) {
- if(ierep[i]) {
- print "\tstruct uni_ie_repeat\t" iename[i] "_repeat;"
- }
- if(ienum[i] != "-") {
- print "\tstruct uni_ie_" iename[i] "\t" iename[i] "[" ienum[i] "];"
- } else {
- print "\tstruct uni_ie_" iename[i] "\t" iename[i] ";"
- }
- }
- print "};"
-}
diff --git a/sys/contrib/ngatm/netnatm/msg/ie.def b/sys/contrib/ngatm/netnatm/msg/ie.def
deleted file mode 100644
index fbeabe87a84c..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/ie.def
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# Copyright (c) 2001-2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/msg/ie.def,v 1.4 2003/09/29 10:47:18 hbb Exp $
-#
-# Define information elements --- no content definition
-#
-#########################################################################
-element cause 0x08 itu 34
-element cause 0x08 net 34
-element callstate 0x14 itu 5
-element facility 0x1c itu UNI_FACILITY_MAXAPDU+1+4 q2932
-element notify 0x27 itu UNI_NOTIFY_MAXLEN+4
-element eetd 0x42 itu 11
-element eetd 0x42 net 13
-element conned 0x4c itu 25 file=addr
-element connedsub 0x4d itu 25 access file=addr
-element epref 0x54 itu 7
-element epstate 0x55 itu 5
-element aal 0x58 itu 21 access
-element traffic 0x59 itu 30
-element traffic 0x59 net
-element connid 0x5a itu 9
-element qos 0x5c itu 6
-element qos 0x5c net 6
-element bhli 0x5d itu 13 access
-element bearer 0x5e itu 7
-element blli 0x5f itu 17 access
-element lshift 0x60 itu 5 0 file=shift
-element nlshift 0x61 itu 5 0 file=shift
-element scompl 0x62 itu 5 !pnni
-element repeat 0x63 itu 5
-element calling 0x6c itu 26 file=addr
-element callingsub 0x6d itu 25 access file=addr
-element called 0x70 itu 25 file=addr
-element calledsub 0x71 itu 25 access file=addr
-element tns 0x78 itu 9
-element tns 0x78 net
-element restart 0x79 itu 5
-element uu 0x7e itu UNI_UU_MAXLEN+4 access !pnni
-element git 0x7f net 33
-element mintraffic 0x81 itu 20 file=traffic
-element mintraffic 0x81 net
-element atraffic 0x82 itu 30 file=traffic
-element atraffic 0x82 net
-element abrsetup 0x84 net 36 file=abr
-element report 0x89 itu 5
-element called_soft 0xe0 net 11 file=soft pnni
-element crankback 0xe1 net 72 pnni
-element dtl 0xe2 net UNI_DTL_LOGNP_SIZE*UNI_DTL_MAXNUM+6 pnni
-element calling_soft 0xe3 net 10 file=soft pnni
-element abradd 0xe4 net 14 file=abr
-element lij_callid 0xe8 net 9 file=lij !pnni
-element lij_param 0xe9 net 5 file=lij !pnni
-element lij_seqno 0xea net 8 file=lij !pnni
-element cscope 0xeb net 6
-element exqos 0xec net 25
-element mdcr 0xf0 net 13 file=traffic
-element unrec 0xfe itu 128
diff --git a/sys/contrib/ngatm/netnatm/msg/msg.def b/sys/contrib/ngatm/netnatm/msg/msg.def
deleted file mode 100644
index 41453ec6a5c4..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/msg.def
+++ /dev/null
@@ -1,582 +0,0 @@
-#
-# Copyright (c) 2001-2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/msg/msg.def,v 1.4 2003/09/29 10:47:18 hbb Exp $
-#
-# Define message contents
-#
-#########################################################################
-#
-# ALERTING message
-#
-# References:
-# Q.2931 8, 17*
-# ...A4 4, 11*
-# Q.2957 3
-# Q.2971 6
-# UNI4.0 5
-# PNNI1.0 177...178, 184*
-#
-# Notes:
-# N-ISDN compatiblity not implemented.
-#
-start alerting 0x01
- connid - !pnni
- epref
- notify
- git UNI_NUM_IE_GIT
- uu - !pnni
- report - !pnni
- unrec
-end
-
-#########################################################################
-#
-# CALL PROCEEDING message
-#
-# References:
-# Q.2931 9, 18*
-# Q.2971 6
-# UNI4.0 5
-# PNNI1.0 178
-#
-# Notes:
-# N-ISDN compatiblity not implemented.
-#
-start call_proc 0x02
- connid
- epref
- notify - !pnni
- unrec
-end
-
-#########################################################################
-#
-# CONNECT message
-#
-# References:
-# Q.2931 p. 10, 19*
-# ...A4 6, 12*
-# Q.2932.1 p. 17
-# Q.2951 p. 30
-# Q.2957 p. 4
-# Q.2962 p. 3
-# Q.2971 p. 7
-# UNI4.0 p. 5-6, 61, 68, 77
-# PNNI1.0 pp. 178...179, 184...185*
-#
-# Notes:
-# N-ISDN compatiblity not implemented.
-#
-start connect 0x07
- aal
- blli
- connid - !pnni
- epref
- notify
- conned
- connedsub
- eetd
- git UNI_NUM_IE_GIT
- uu - !pnni
- traffic
- exqos
- facility - q2932
- abrsetup
- abradd
- called_soft - pnni
- report - !pnni
- unrec
-end
-
-#########################################################################
-#
-# CONNECT ACKNOWLEDGE message
-#
-# References:
-# Q.2931 11
-#
-start connect_ack 0x0f !pnni
- notify
- unrec
-end
-
-#########################################################################
-#
-# RELEASE message
-#
-# References:
-# Q.2931 p. 11, 22*
-# Q.2932.1 p. 18
-# Q.2957 p. 4
-# Q.2962 p. 3
-# UNI4.0 p. 6
-# PNNI1.0 pp. 179...180, 185...186*
-#
-# Notes:
-# N-ISDN compatiblity not implemented.
-#
-start release 0x4d
- cause 2
- notify
- git UNI_NUM_IE_GIT
- uu - !pnni
- facility - q2932
- crankback - pnni
- unrec
-end
-
-#########################################################################
-#
-# RELEASE COMPLETE message
-#
-# References:
-# Q.2931 p. 12
-# UNI4.0 p. 6
-# PNNI1.0 p. 180
-#
-start release_compl 0x5a
- cause 2
- git UNI_NUM_IE_GIT !pnni
- uu - !pnni
- crankback - pnni
- unrec
-end
-
-#########################################################################
-#
-# SETUP message
-#
-# References:
-# Q.2931 13-14, 23-24*
-# ...A4 7-9, 13-16*
-# Q.2957 5
-# Q.2962 3
-# Q.2971 7
-# UNI4.0 6-7, 43, 57*, 60-61, 68-69, 78
-# PNNI1.0 180...182, 186*
-# af-cs-0147.000
-#
-# Notes:
-#
-start setup 0x05
- aal
- traffic
- bearer
- bhli
- blli UNI_NUM_IE_BLLI/R
- called
- calledsub UNI_NUM_IE_CALLEDSUB
- calling
- callingsub UNI_NUM_IE_CALLINGSUB
- connid
- qos
- eetd
- notify
- scompl - !pnni
- tns UNI_NUM_IE_TNS
- epref
- atraffic
- mintraffic
- uu - !pnni
- git UNI_NUM_IE_GIT
- lij_callid - !pnni
- lij_param - !pnni
- lij_seqno - !pnni
- exqos
- abrsetup
- abradd
- cscope
- calling_soft - pnni
- called_soft - pnni
- dtl UNI_NUM_IE_DTL/R pnni
- report - !pnni
- mdcr
- unrec
-end
-
-#########################################################################
-#
-# STATUS message
-#
-# References:
-# Q.2931 p. 14
-# Q.2971 p. 8
-# PNNI1.0 p. 182
-#
-start status 0x7d
- callstate
- cause
- epref
- epstate
- unrec
-end
-
-#########################################################################
-#
-# STATUS ENQUIRY message
-#
-# References:
-# Q.2931 p. 15
-# Q.2971 p. 8
-# PNNI1.0 pp. 182...183
-#
-start status_enq 0x75
- epref
- unrec
-end
-
-#########################################################################
-#
-# NOTIFY message
-#
-# References:
-# Q.2931 p. 15
-# Q.2971 p. 8
-# PNNI1.0 p. 183
-#
-start notify 0x6e
- notify
- epref
- unrec
-end
-
-#########################################################################
-#
-# RESTART message
-#
-# References:
-# Q.2931 p. 26
-# UNI4.0 p. 7
-# PNNI1.0 pp. 186...187
-#
-start restart 0x46
- connid
- restart
- unrec
-end
-
-#########################################################################
-#
-# RESTART ACKNOWLEDGE message
-#
-# References:
-# Q.2931 p. 26
-# UNI4.0 p. 7
-# PNNI1.0 p. 187
-#
-start restart_ack 0x4e
- connid
- restart
- unrec
-end
-
-#########################################################################
-#
-# ADD PARTY message
-#
-# References:
-# Q.2971 10, 47
-# UNI4.0 39, 43-44
-# PNNI1.0 188...189
-#
-# Notes:
-#
-start add_party 0x80
- aal
- bhli
- blli
- called
- calledsub UNI_NUM_IE_CALLEDSUB
- calling
- callingsub UNI_NUM_IE_CALLINGSUB
- scompl - !pnni
- tns UNI_NUM_IE_TNS
- epref
- notify
- eetd
- uu - !pnni
- git UNI_NUM_IE_GIT
- lij_seqno - !pnni
- calling_soft - pnni
- called_soft - pnni
- dtl UNI_NUM_IE_DTL/R pnni
- unrec
-end
-
-#########################################################################
-#
-# ADD PARTY ACKNOWLEDGE message
-#
-# References:
-# Q.2971 10, 42, 47
-# UNI4.0 39
-# PNNI1.0 189
-#
-# Notes:
-#
-start add_party_ack 0x81
- epref
- aal
- blli
- notify
- eetd
- conned
- connedsub
- uu - !pnni
- git UNI_NUM_IE_GIT
- called_soft - pnni
- unrec
-end
-
-#########################################################################
-#
-# PARTY ALERTING message
-#
-# References:
-# Q.2971 12, 49
-# UNI4.0 39
-# PNNI1.0 189...190
-#
-# Notes:
-#
-start party_alerting 0x85
- epref
- notify
- uu - !pnni
- git UNI_NUM_IE_GIT
- unrec
-end
-
-#########################################################################
-#
-# ADD PARTY REJECT message
-#
-# References:
-# Q.2971 12, 48
-# UNI4.0 40
-# PNNI1.0 190
-#
-# Notes:
-#
-start add_party_rej 0x82
- cause
- epref
- uu - !pnni
- git UNI_NUM_IE_GIT
- crankback - pnni
- unrec
-end
-
-#########################################################################
-#
-# DROP PARTY message
-#
-# References:
-# Q.2971 13, 48
-# UNI4.0 40
-# PNNI1.0 191
-#
-# Notes:
-#
-start drop_party 0x83
- cause
- epref
- notify
- uu - !pnni
- git UNI_NUM_IE_GIT
- unrec
-end
-
-#########################################################################
-#
-# DROP PARTY ACKNOWLEDGE message
-#
-# References:
-# Q.2971 13, 49
-# UNI4.0 40
-# PNNI1.0 191
-#
-# Notes:
-#
-start drop_party_ack 0x84
- epref
- cause
- uu - !pnni
- git UNI_NUM_IE_GIT
- unrec
-end
-
-#########################################################################
-#
-# LEAF SETUP REQUEST message
-#
-# References:
-# UNI4.0 45...46
-#
-# Notes:
-#
-start leaf_setup_req 0x91 !pnni
- tns UNI_NUM_IE_TNS
- calling
- callingsub UNI_NUM_IE_CALLINGSUB
- called
- calledsub UNI_NUM_IE_CALLEDSUB
- lij_callid
- lij_seqno
- unrec
-end
-
-#########################################################################
-#
-# LEAF SETUP FAIL message
-#
-# References:
-# UNI4.0 45...46
-#
-# Notes:
-#
-start leaf_setup_fail 0x90 !pnni
- cause
- called
- calledsub
- lij_seqno
- tns UNI_NUM_IE_TNS
- unrec
-end
-
-#########################################################################
-#
-# CO-BI SETUP message
-#
-# References:
-# Q.2932.1 16
-#
-# Notes:
-#
-start cobisetup 0x15 !pnni&&q2932
- facility
- called
- calledsub
- calling
- notify
- unrec
-end
-
-#########################################################################
-#
-# FACILITY message
-#
-# References:
-# Q.2932.1 14...15
-#
-# Notes:
-#
-start facility 0x62 !pnni&&q2932
- facility
- called
- calledsub
- calling
- notify
- unrec
-end
-
-#########################################################################
-#
-# MODIFY REQUEST message
-#
-# References:
-# Q.2963.1 p. 6
-# Q.2963.4 p. 4
-# UNI4.0-MFY p. 3
-#
-start modify_req 0x88 !pnni
- traffic
- atraffic
- mintraffic
- notify
- git UNI_NUM_IE_GIT
- unrec
-end
-
-#########################################################################
-#
-# MODIFY ACKNOWLEDGE message
-#
-# References:
-# Q.2963.1 p.6
-# Q.2963.3 p.5
-# UNI4.0-MFY p.3
-#
-start modify_ack 0x89 !pnni
- report
- traffic
- notify
- git UNI_NUM_IE_GIT
- unrec
-end
-
-#########################################################################
-#
-# MODIFY REJECT message
-#
-# References:
-# Q.2963 p.6
-# UNI4.0-MFY p.3
-#
-start modify_rej 0x8a !pnni
- cause
- notify
- git UNI_NUM_IE_GIT
- unrec
-end
-
-#########################################################################
-#
-# CONNECTION AVAILABLE message
-#
-# References:
-# Q.2931A4 9...10
-# Q.2963 p.6
-# UNI4.0-MFY p.3
-#
-start conn_avail 0x8b !pnni
- notify
- git UNI_NUM_IE_GIT
- report
- unrec
-end
-
-#########################################################################
-#
-# UNKNOWN message
-#
-start unknown 0x100
- epref
- unrec
-end
diff --git a/sys/contrib/ngatm/netnatm/msg/parseie.awk b/sys/contrib/ngatm/netnatm/msg/parseie.awk
deleted file mode 100644
index 14bd0f876978..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/parseie.awk
+++ /dev/null
@@ -1,150 +0,0 @@
-#
-# Copyright (c) 2001-2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/msg/parseie.awk,v 1.3 2003/09/19 11:58:15 hbb Exp $
-#
-# Parse the IE definition file
-#
-match($0, "Begemot:")!=0 {
- gsub("^[^$]*", "")
- gsub("[^$]*$", "")
- id = $0
- next
-}
-
-/^#/ {
- next
-}
-NF == 0 {
- next
-}
-
-BEGIN {
- iecnt = 0
- id = " * ???"
- begin()
-}
-
-END {
- end()
-}
-
-#
-# Syntax is:
-# element <name> <code> <coding> [<maxlen> [<options>*]]
-#
-$1=="element" {
- if(iecnt == 0) first_element()
- if(NF < 4) {
- error("Bad number of args: " $0)
- }
- ie = $2
- file = $2
- number = parse_hex($3)
- coding = $4
- if(coding == "itu") {
- ncoding = 0
- } else if(coding == "net") {
- ncoding = 3
- } else {
- error("bad coding " coding)
- }
- if(NF == 4) {
- element_default()
- file=""
- } else {
- len = $5
- parse_options()
- element()
- }
- ies[iecnt] = ie
- codings[iecnt] = coding
- files[iecnt] = file
- iecnt++
- next
-}
-
-{
- error("Bad line: " $0)
-}
-
-function parse_options() {
- access = 0
- cond = ""
- for(i = 6; i <= NF; i++) {
- if($i == "access") {
- access = 1
- } else if($i == "-") {
- } else if(index($i, "file=") == 1) {
- file=substr($i, 6)
- } else {
- if(cond != "") {
- error("Too many conditions: "$0)
- }
- cond = $i
- }
- }
-}
-
-function parse_hex(str, n)
-{
- n = 0
- if(substr(str,1,2) != "0x") {
- error("bad hex number" str)
- }
- for(i = 3; i <= length(str); i++) {
- c = substr(str,i,1)
- if(match(c,"[0-9]") != 0) {
- n = 16 * n + c
- } else if(match(c,"[a-f]")) {
- if(c == "a") n = 16 * n + 10
- if(c == "b") n = 16 * n + 11
- if(c == "c") n = 16 * n + 12
- if(c == "d") n = 16 * n + 13
- if(c == "e") n = 16 * n + 14
- if(c == "f") n = 16 * n + 15
- } else if(match(c,"[A-F]")) {
- if(c == "A") n = 16 * n + 10
- if(c == "B") n = 16 * n + 11
- if(c == "C") n = 16 * n + 12
- if(c == "D") n = 16 * n + 13
- if(c == "E") n = 16 * n + 14
- if(c == "F") n = 16 * n + 15
- } else {
- error("bad hex digit '" c "'")
- }
- }
- return n
-}
-
-# function error(str)
-# {
-# print "error:" str >"/dev/stderr"
-# exit 1
-# }
-
diff --git a/sys/contrib/ngatm/netnatm/msg/parsemsg.awk b/sys/contrib/ngatm/netnatm/msg/parsemsg.awk
deleted file mode 100644
index ff13874d4509..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/parsemsg.awk
+++ /dev/null
@@ -1,138 +0,0 @@
-#
-# Copyright (c) 2001-2003
-# Fraunhofer Institute for Open Communication Systems (FhG Fokus).
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Author: Hartmut Brandt <harti@freebsd.org>
-#
-# $Begemot: libunimsg/netnatm/msg/parsemsg.awk,v 1.3 2003/09/19 11:58:15 hbb Exp $
-#
-# Parse the message definition file
-#
-match($0, "Begemot:")!=0 {
- gsub("^[^$]*", "")
- gsub("[^$]*$", "")
- id = $0
- next
-}
-
-/^#/ {
- next
-}
-NF == 0 {
- next
-}
-BEGIN {
- state=0
- id = " * ???"
- mcnt=0
- begin()
-}
-END {
- end()
-}
-
-state==0 && $1=="start" {
- if(NF < 3) error("bad number of fields in message start "$0)
- state = 1
- msg = $2
- code = parse_hex($3)
- messages[mcnt] = msg
- msgcond[mcnt] = $4
- msgrep = 0
- msgrepie = 0
- cnt = 0
- if(mcnt == 0) first_entry()
- start_message()
- next
-}
-
-state==1 && $1=="end" {
- state=0
- mcnt++
- end_message()
- next
-}
-state==1 {
- iename[cnt]=$1
- if($2 == "") $2="-"
- if(match($2, "[A-Za-z][A-Za-z0-9_]*/R") == 1) {
- ienum[cnt]=substr($2, 1, length($2)-2)
- ierep[cnt]=1
- msgrepie=1
- } else {
- ierep[cnt]=0
- ienum[cnt]=$2
- }
- if(ienum[cnt] != "-") msgrep = 1
- if($3 == "" || $3 == "-") {
- $3 = "1"
- } else {
- gsub("[a-zA-Z][a-zA-Z0-9]*", "cx->&", $3)
- }
- iecond[cnt] = $3
- cnt++
- next
-}
-
-{
- error("bad line: "$0)
-}
-
-function parse_hex(str, n)
-{
- n = 0
- if(substr(str,1,2) != "0x") {
- error("bad hex number" str)
- }
- for(i = 3; i <= length(str); i++) {
- c = substr(str,i,1)
- if(match(c,"[0-9]") != 0) {
- n = 16 * n + c
- } else if(match(c,"[a-f]")) {
- if(c == "a") n = 16 * n + 10
- if(c == "b") n = 16 * n + 11
- if(c == "c") n = 16 * n + 12
- if(c == "d") n = 16 * n + 13
- if(c == "e") n = 16 * n + 14
- if(c == "f") n = 16 * n + 15
- } else if(match(c,"[A-F]")) {
- if(c == "A") n = 16 * n + 10
- if(c == "B") n = 16 * n + 11
- if(c == "C") n = 16 * n + 12
- if(c == "D") n = 16 * n + 13
- if(c == "E") n = 16 * n + 14
- if(c == "F") n = 16 * n + 15
- } else {
- error("bad hex digit '" c "'")
- }
- }
- return n
-}
-
-function error(str)
-{
- print "error:" str >"/dev/stderr"
- exit 1
-}
diff --git a/sys/contrib/ngatm/netnatm/msg/priv.h b/sys/contrib/ngatm/netnatm/msg/priv.h
deleted file mode 100644
index aa13fc467d46..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/priv.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/netnatm/msg/priv.h,v 1.4 2003/10/10 14:50:05 hbb Exp $
- *
- * Private definitions for the IE code file.
- */
-#ifndef unimsg_priv_h
-#define unimsg_priv_h
-
-#ifdef _KERNEL
-#include <sys/systm.h>
-#include <machine/stdarg.h>
-#define PANIC(X) panic X
-#else
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#define PANIC(X) abort()
-#endif
-
-/*
- * Define a structure for the declaration of information elements.
- * For each coding scheme a quadrupel of check, print, encode and
- * decode functions must be defined. A structure of the same format
- * is used for messages.
- */
-typedef void (*uni_print_f)(const union uni_ieall *, struct unicx *);
-typedef int (*uni_check_f)(union uni_ieall *, struct unicx *);
-typedef int (*uni_encode_f)(struct uni_msg *, union uni_ieall *,
- struct unicx *);
-typedef int (*uni_decode_f)(union uni_ieall *, struct uni_msg *, u_int,
- struct unicx *);
-
-typedef void (*uni_msg_print_f)(const union uni_msgall *, struct unicx *);
-typedef int (*uni_msg_check_f)(struct uni_all *, struct unicx *);
-typedef int (*uni_msg_encode_f)(struct uni_msg *, union uni_msgall *,
- struct unicx *);
-typedef int (*uni_msg_decode_f)(union uni_msgall *, struct uni_msg *,
- enum uni_ietype, struct uni_iehdr *, u_int, struct unicx *);
-
-struct iedecl {
- u_int flags; /* information element flags */
- u_int maxlen; /* maximum size */
- uni_print_f print;
- uni_check_f check;
- uni_encode_f encode;
- uni_decode_f decode;
-};
-
-struct msgdecl {
- u_int flags;
- const char *name;
- uni_msg_print_f print;
- uni_msg_check_f check;
- uni_msg_encode_f encode;
- uni_msg_decode_f decode;
-};
-
-enum {
- UNIFL_DEFAULT = 0x0001,
- UNIFL_ACCESS = 0x0002,
-};
-
-extern const struct iedecl *uni_ietable[256][4];
-extern const struct msgdecl *uni_msgtable[256];
-
-/*
- * Need to check range here because declaring a variable as a enum does not
- * guarantee that the values will be legal.
- */
-#define GET_IEDECL(IE, CODING) \
-({ \
- const struct iedecl *_decl = NULL; \
- \
- if((CODING) <= 3 && (IE) <= 255) \
- if((_decl = uni_ietable[IE][CODING]) != NULL) \
- if((_decl->flags & UNIFL_DEFAULT) != 0) \
- if((_decl = uni_ietable[IE][0]) == NULL) \
- PANIC(("IE %02x,%02x -- no default", CODING,IE));\
- _decl; \
-})
-
-
-enum {
- DEC_OK,
- DEC_ILL,
- DEC_ERR,
-};
-
-void uni_print_ie_internal(enum uni_ietype, const union uni_ieall *,
- struct unicx *);
-
-#endif
diff --git a/sys/contrib/ngatm/netnatm/msg/privmsg.c b/sys/contrib/ngatm/netnatm/msg/privmsg.c
deleted file mode 100644
index 73e3944c06e6..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/privmsg.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/netnatm/msg/privmsg.c,v 1.8 2003/10/10 14:50:05 hbb Exp $
- *
- * Private definitions for the MSG code file.
- *
- * This file is included at the begin of the automatically generated
- * uni_msg.c.
- */
-
-/*
- * Decode a UNI message header.
- * Return values:
- * 0 - ok
- * -1 - ignore message (proto, length, CR error)
- */
-int
-uni_decode_head(struct uni_msg *msg, struct uni_all *out,
- struct unicx *cx __unused)
-{
-#if 0
- u_int mlen;
-#endif
-
- cx->errcnt = 0;
- (void)memset(out, 0, sizeof(struct uni_all));
-
- if(uni_msg_len(msg) < 9)
- return -1; /* Q.2931 5.6.2 */
- if(cx->pnni) {
- if(*msg->b_rptr++ != PNNI_PROTO)
- return -1; /* Q.2931 5.6.1 */
- } else {
- if(*msg->b_rptr++ != UNI_PROTO)
- return -1; /* Q.2931 5.6.1 */
- }
- if(*msg->b_rptr++ != 3)
- return -1; /* Q.2931 5.6.3.1 */
-
- out->u.hdr.cref.flag = (*msg->b_rptr & 0x80) ? 1 : 0;
- out->u.hdr.cref.cref = (*msg->b_rptr++ & 0x7f) << 16;
- out->u.hdr.cref.cref |= *msg->b_rptr++ << 8;
- out->u.hdr.cref.cref |= *msg->b_rptr++;
-
- out->mtype = *msg->b_rptr++;
-
- /*
- * Be not too piggy about this byte
- */
- switch(*msg->b_rptr & 0x13) {
-
- case 0x00: case 0x01: case 0x02: case 0x03:
- out->u.hdr.act = UNI_MSGACT_DEFAULT;
- break;
-
- case 0x10: case 0x11: case 0x12:
- out->u.hdr.act = *msg->b_rptr & 0x3;
- break;
-
- case 0x13: /* Q.2931 5.7.1 */
- out->u.hdr.act = UNI_MSGACT_REPORT;
- break;
- }
- if(cx->pnni && (*msg->b_rptr & 0x08))
- out->u.hdr.pass = 1;
- else
- out->u.hdr.pass = 0;
-
- msg->b_rptr++;
-
-#if 0
- mlen = *msg->b_rptr++ << 8;
- mlen |= *msg->b_rptr++;
-
- /*
- * If the message is longer than the indicated length
- * shorten it. If it is shorter, probably one of the IE
- * decoders will break, but we should proceed. 5.5.6.5
- */
- if(uni_msg_len(msg) > mlen)
- msg->b_wptr = msg->b_rptr + mlen;
-#endif
-
- return 0;
-}
-
-static int
-uni_decode_body_internal(enum uni_msgtype mtype, struct uni_msg *msg,
- union uni_msgall *out, struct unicx *cx)
-{
- enum uni_ietype ietype;
- struct uni_iehdr hdr;
- u_int ielen;
- const struct iedecl *iedecl;
- int err = 0, ret;
- u_char *end;
-
- cx->ielast = (enum uni_ietype)0;
- cx->repeat.h.present = 0;
-
- while (uni_msg_len(msg) != 0) {
- if (uni_decode_ie_hdr(&ietype, &hdr, msg, cx, &ielen)) {
- /*
- * Short header. Set the ielen to an impossible size.
- * Then we should bump out in the error handling below.
- * We should have at least an IE type here.
- */
- ielen = 0xffffffff;
- }
-#ifdef DTRACE
- printf("IE %x\n", ietype);
-#endif
-
- if ((iedecl = GET_IEDECL(ietype, hdr.coding)) == NULL ||
- ietype == UNI_IE_UNREC) {
- /*
- * entirly unknown IE. Check the length and skip it.
- * Q.2931 5.6.8.1
- */
- if (ielen > uni_msg_len(msg))
- msg->b_rptr = msg->b_wptr;
- else
- msg->b_rptr += ielen;
- (void)UNI_SAVE_IERR(cx, ietype, hdr.act, UNI_IERR_UNK);
- err = -1;
- continue;
- }
-#ifdef DTRACE
- printf("IE %x known\n", ietype);
-#endif
- if (ielen > iedecl->maxlen - 4 || ielen > uni_msg_len(msg)) {
- /*
- * Information element too long -> content error.
- * Let the decoding routine set the error flag and
- * return DEC_ERR.
- * Q.2931 5.6.8.2
- */
-#if 0
- /*
- * It is not clear how to best handle this error.
- */
- if (ielen > iedecl->maxlen - 4)
- ielen = iedecl->maxlen - 4;
-#endif
-
- if (ielen > uni_msg_len(msg))
- ielen = uni_msg_len(msg);
-
- hdr.present |= UNI_IE_ERROR;
-
-#ifdef DTRACE
- printf("IE %x length too large\n", ietype);
-#endif
- }
-
-#ifdef DTRACE
- else
- printf("IE %x length ok\n", ietype);
-#endif
- end = msg->b_rptr + ielen;
- ret = uni_msgtable[mtype]->decode(out, msg, ietype,
- &hdr, ielen, cx);
- msg->b_rptr = end;
-
-#ifdef DTRACE
- printf("IE %x ret %d\n", ietype, ret);
-#endif
-
- switch (ret) {
-
- case DEC_OK: /* ok */
- break;
-
- case DEC_ILL: /* illegal IE */
- /*
- * Unexpected but recognized.
- * Q.2931 5.6.8.3
- */
- (void)UNI_SAVE_IERR(cx, ietype, hdr.act, UNI_IERR_UNK);
- err = -1;
- break;
-
- case DEC_ERR: /* bad IE */
- if (iedecl->flags & UNIFL_ACCESS)
- /* this may be wrong: 5.6.8.2 */
- (void)UNI_SAVE_IERR(cx, ietype, hdr.act, UNI_IERR_ACC);
- else
- (void)UNI_SAVE_IERR(cx, ietype, hdr.act, UNI_IERR_BAD);
- err = -1;
- break;
-
- default:
- PANIC(("bad decode return"));
- }
- cx->ielast = ietype;
- if (ietype != UNI_IE_REPEAT)
- cx->repeat.h.present = 0;
- }
- return err;
-}
-
-/*
- * Decode the body of a message. The header is assumed to be decoded
- * already and out->hdr is filled in. Only information elements remain.
- */
-int
-uni_decode_body(struct uni_msg *msg, struct uni_all *out, struct unicx *cx)
-{
- cx->errcnt = 0;
- if (out->mtype >= 256)
- return (-1);
- if (uni_msgtable[out->mtype] == NULL)
- return (-1);
- return (uni_decode_body_internal(out->mtype, msg, &out->u, cx));
-}
-
-
-/*
- * Decode a uni message
- */
-int
-uni_decode(struct uni_msg *msg, struct uni_all *out, struct unicx *cx)
-{
- cx->errcnt = 0;
- if (uni_decode_head(msg, out, cx))
- return (-1);
- if (uni_decode_body(msg, out, cx))
- return (-2);
- return (0);
-}
-
-int
-uni_encode(struct uni_msg *msg, struct uni_all *in, struct unicx *cx)
-{
- if (in->mtype >= 256)
- return (-1);
- if (uni_msgtable[in->mtype] == NULL)
- return (-3);
-
- return ((uni_msgtable[in->mtype]->encode)(msg, &in->u, cx));
-}
-
-/*
- * Doesn't belong here
- */
-void
-uni_initcx(struct unicx *cx)
-{
- memset(cx, 0, sizeof(struct unicx));
- cx->tabsiz = 4;
-}
diff --git a/sys/contrib/ngatm/netnatm/msg/traffic.c b/sys/contrib/ngatm/netnatm/msg/traffic.c
deleted file mode 100644
index acaffdbbe7d4..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/traffic.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/netnatm/msg/traffic.c,v 1.4 2004/07/08 08:22:05 brandt Exp $
- *
- * Traffic classification
- */
-
-#include <netnatm/unimsg.h>
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/msg/unimsglib.h>
-#ifdef _KERNEL
-#include <sys/systm.h>
-#else
-#include <stdio.h>
-#endif
-
-/*
- * Try to set the parameters for the CPCS from the parameters of the
- * connection.
- */
-enum {
- T_CBR23 = 100, T_nrtVBR2_6_UBR12, T_rtVBR236, T_rtVBR2_6
-};
-
-static const u_int fmask = UNI_TRAFFIC_FPCR0_P | UNI_TRAFFIC_FPCR1_P |
- UNI_TRAFFIC_FSCR0_P | UNI_TRAFFIC_FSCR1_P | UNI_TRAFFIC_FMBS0_P |
- UNI_TRAFFIC_FMBS1_P | UNI_TRAFFIC_FABR1_P;
-static const u_int bmask = UNI_TRAFFIC_BPCR0_P | UNI_TRAFFIC_BPCR1_P |
- UNI_TRAFFIC_BSCR0_P | UNI_TRAFFIC_BSCR1_P | UNI_TRAFFIC_BMBS0_P |
- UNI_TRAFFIC_BMBS1_P | UNI_TRAFFIC_BABR1_P;
-
-static const u_int fcbr3 = UNI_TRAFFIC_FPCR0_P | UNI_TRAFFIC_FPCR1_P;
-static const u_int bcbr3 = UNI_TRAFFIC_BPCR0_P | UNI_TRAFFIC_BPCR1_P;
-static const u_int fvbr16 = UNI_TRAFFIC_FPCR1_P | UNI_TRAFFIC_FSCR1_P |
- UNI_TRAFFIC_FMBS1_P;
-static const u_int bvbr16 = UNI_TRAFFIC_BPCR1_P | UNI_TRAFFIC_BSCR1_P |
- UNI_TRAFFIC_BMBS1_P;
-static const u_int fvbr23 = UNI_TRAFFIC_FPCR1_P | UNI_TRAFFIC_FSCR0_P |
- UNI_TRAFFIC_FMBS0_P;
-static const u_int bvbr23 = UNI_TRAFFIC_BPCR1_P | UNI_TRAFFIC_BSCR0_P |
- UNI_TRAFFIC_BMBS0_P;
-static const u_int fvbr4 = UNI_TRAFFIC_FPCR0_P | UNI_TRAFFIC_FPCR1_P;
-static const u_int bvbr4 = UNI_TRAFFIC_BPCR0_P | UNI_TRAFFIC_BPCR1_P;
-
-int
-uni_classify_traffic(const struct uni_ie_bearer *bearer,
- const struct uni_ie_traffic *traffic,
- enum uni_traffic_class *fclass, enum uni_traffic_class *bclass,
- char *ebuf, size_t ebufsiz)
-{
- u_int tclass;
- u_int ft, bt, be, ftag, btag;
-
- /* classify */
- switch (bearer->bclass) {
-
- case UNI_BEARER_A:
- if (!(bearer->h.present & UNI_BEARER_ATC_P)) {
- tclass = T_CBR23;
- break;
- }
- switch (bearer->atc) {
-
- case UNI_BEARER_ATC_CBR1:
- tclass = UNI_TRAFFIC_CBR1;
- break;
-
- default:
- snprintf(ebuf, ebufsiz, "bad ATC=%#02x for BCOB-A",
- bearer->atc);
- return (-1);
- }
- break;
-
- case UNI_BEARER_C:
- if (!(bearer->h.present & UNI_BEARER_ATC_P)) {
- tclass = T_nrtVBR2_6_UBR12;
- break;
- }
- switch (bearer->atc) {
-
- case UNI_BEARER_ATC_VBR1:
- tclass = UNI_TRAFFIC_rtVBR1;
- break;
-
- case UNI_BEARER_ATC_VBR:
- tclass = T_rtVBR236;
- break;
-
- case UNI_BEARER_ATC_NVBR1:
- tclass = UNI_TRAFFIC_nrtVBR1;
- break;
-
- case UNI_BEARER_ATC_ABR:
- tclass = UNI_TRAFFIC_ABR;
- break;
-
- default:
- snprintf(ebuf, ebufsiz, "bad ATC=%#02x for BCOB-C",
- bearer->atc);
- return (-1);
- }
- break;
-
- case UNI_BEARER_X:
- if (!(bearer->h.present & UNI_BEARER_ATC_P)) {
- tclass = T_nrtVBR2_6_UBR12;
- break;
- }
- switch (bearer->atc) {
-
- case UNI_BEARER_ATC_CBR1:
- tclass = UNI_TRAFFIC_CBR1;
- break;
-
- case UNI_BEARER_ATC_CBR:
- case UNI_BEARER_ATCX_4:
- case UNI_BEARER_ATCX_6:
- tclass = T_CBR23;
- break;
-
- case UNI_BEARER_ATC_VBR1:
- tclass = UNI_TRAFFIC_rtVBR1;
- break;
-
- case UNI_BEARER_ATCX_1:
- case UNI_BEARER_ATC_VBR:
- tclass = T_rtVBR2_6;
- break;
-
- case UNI_BEARER_ATC_NVBR1:
- tclass = UNI_TRAFFIC_nrtVBR1;
- break;
-
- case UNI_BEARER_ATCX_0:
- case UNI_BEARER_ATCX_2:
- case UNI_BEARER_ATCX_8:
- case UNI_BEARER_ATC_NVBR:
- tclass = T_nrtVBR2_6_UBR12;
- break;
-
- case UNI_BEARER_ATC_ABR:
- tclass = UNI_TRAFFIC_ABR;
- break;
-
- default:
- snprintf(ebuf, ebufsiz, "bad ATC=%#02x for BCOB-X",
- bearer->atc);
- return (-1);
- }
- break;
-
- case UNI_BEARER_TVP:
- snprintf(ebuf, ebufsiz, "unsupported bearer class tVP");
- return (-1);
-
- default:
- snprintf(ebuf, ebufsiz, "bad bearer class %#02x",
- bearer->bclass);
- return (-1);
- }
-
- /*
- * Now traffic IE
- */
- ft = traffic->h.present & fmask;
- bt = traffic->h.present & bmask;
- be = traffic->h.present & UNI_TRAFFIC_BEST_P;
- ftag = (traffic->h.present & UNI_TRAFFIC_MOPT_P) && traffic->t.ftag;
- btag = (traffic->h.present & UNI_TRAFFIC_MOPT_P) && traffic->t.btag;
-
-#define NOBE(C) \
- if (be) { \
- snprintf(ebuf, ebufsiz, "illegal BE for " C); \
- return (-1); \
- }
-
-#define NOFT(C) \
- if (ftag) { \
- snprintf(ebuf, ebufsiz, "illegal forward tag in " C); \
- return (-1); \
- }
-
-#define NOBT(C) \
- if (btag) { \
- snprintf(ebuf, ebufsiz, "illegal backward tag in " C); \
- return (-1); \
- }
-
-#define FBAD(C) do { \
- snprintf(ebuf, ebufsiz, "bad forward CRs for " C); \
- return (-1); \
- } while (0)
-
-#define BBAD(C) do { \
- snprintf(ebuf, ebufsiz, "bad backward CRs for " C); \
- return (-1); \
- } while (0)
-
- switch (tclass) {
-
- case UNI_TRAFFIC_CBR1:
- NOBE("CBR.1");
- if (ft != UNI_TRAFFIC_FPCR1_P)
- FBAD("CBR.1");
- NOFT("CBR.1");
- if (bt != UNI_TRAFFIC_BPCR1_P)
- BBAD("CBR.1");
- NOBT("CBR.1");
- *fclass = *bclass = UNI_TRAFFIC_CBR1;
- break;
-
- case T_CBR23:
- NOBE("CBR.2/3");
- if (ft == UNI_TRAFFIC_FPCR0_P) {
- *fclass = UNI_TRAFFIC_CBR2;
- NOFT("CBR.2");
- } else if (ft == fcbr3) {
- *fclass = UNI_TRAFFIC_CBR3;
- if (!ftag) {
- snprintf(ebuf, ebufsiz, "need forward tagging for CBR.3");
- return (-1);
- }
- } else
- FBAD("CBR.2/3");
- if (bt == UNI_TRAFFIC_BPCR0_P) {
- *bclass = UNI_TRAFFIC_CBR2;
- NOBT("CBR.2");
- } else if (bt == bcbr3) {
- *bclass = UNI_TRAFFIC_CBR3;
- if (!btag) {
- snprintf(ebuf, ebufsiz, "need backward tagging for CBR.3");
- return (-1);
- }
- } else
- BBAD("CBR.2/3");
- break;
-
- case UNI_TRAFFIC_rtVBR1:
- NOBE("rtVBR.1");
- if (ft != fvbr16)
- FBAD("rtVBR.1");
- NOFT("rtVBR.1");
- if (bt != bvbr16)
- BBAD("rtVBR.1");
- NOBT("rtVBR.1");
- *fclass = *bclass = UNI_TRAFFIC_rtVBR1;
- break;
-
- case T_rtVBR236:
- NOBE("rtVBR.2/3/6");
- if (ft == fvbr23) {
- if (ftag)
- *fclass = UNI_TRAFFIC_rtVBR3;
- else
- *fclass = UNI_TRAFFIC_rtVBR2;
- } else if (ft == fvbr16) {
- *fclass = UNI_TRAFFIC_rtVBR6;
- NOFT("rtVBR.6");
- } else
- FBAD("rtVBR.2/3/6");
- if (bt == bvbr23) {
- if (btag)
- *bclass = UNI_TRAFFIC_rtVBR3;
- else
- *bclass = UNI_TRAFFIC_rtVBR2;
- } else if (bt == bvbr16) {
- *bclass = UNI_TRAFFIC_rtVBR6;
- NOBT("rtVBR.6");
- } else
- BBAD("rtVBR.2/3/6");
- break;
-
- case T_rtVBR2_6:
- NOBE("rtVBR.2-6");
- if (ft == fvbr23) {
- if (ftag)
- *fclass = UNI_TRAFFIC_rtVBR3;
- else
- *fclass = UNI_TRAFFIC_rtVBR2;
- } else if (ft == fvbr4) {
- *fclass = UNI_TRAFFIC_rtVBR4;
- } else if (ft == UNI_TRAFFIC_FPCR1_P) {
- *fclass = UNI_TRAFFIC_rtVBR5;
- NOFT("rtVBR.5");
- } else if (ft == fvbr16) {
- *fclass = UNI_TRAFFIC_rtVBR6;
- NOFT("rtVBR.6");
- } else
- FBAD("rtVBR.2-6");
- if (bt == bvbr23) {
- if (btag)
- *bclass = UNI_TRAFFIC_rtVBR3;
- else
- *bclass = UNI_TRAFFIC_rtVBR2;
- } else if (bt == bvbr4) {
- *bclass = UNI_TRAFFIC_rtVBR4;
- } else if (bt == UNI_TRAFFIC_BPCR1_P) {
- *bclass = UNI_TRAFFIC_rtVBR5;
- NOBT("rtVBR.5");
- } else if (bt == bvbr16) {
- *bclass = UNI_TRAFFIC_rtVBR6;
- NOBT("rtVBR.6");
- } else
- BBAD("rtVBR.2-6");
- break;
-
- case UNI_TRAFFIC_nrtVBR1:
- NOBE("nrtVBR.1");
- if (ft != fvbr16)
- FBAD("nrtVBR.1");
- NOFT("nrtVBR.1");
- if (bt != bvbr16)
- BBAD("nrtVBR.1");
- NOBT("nrtVBR.1");
- *fclass = *bclass = UNI_TRAFFIC_nrtVBR1;
- break;
-
- case T_nrtVBR2_6_UBR12:
- if (be) {
- if (ft != UNI_TRAFFIC_FPCR1_P)
- FBAD("UBR.1/2");
- if (bt != UNI_TRAFFIC_BPCR1_P)
- BBAD("UBR.1/2");
- if (ftag)
- *fclass = UNI_TRAFFIC_UBR2;
- else
- *fclass = UNI_TRAFFIC_UBR1;
- if (btag)
- *bclass = UNI_TRAFFIC_UBR2;
- else
- *bclass = UNI_TRAFFIC_UBR1;
- break;
- }
- if (ft == fvbr23) {
- if (ftag)
- *fclass = UNI_TRAFFIC_nrtVBR3;
- else
- *fclass = UNI_TRAFFIC_nrtVBR2;
- } else if (ft == fvbr4) {
- *fclass = UNI_TRAFFIC_nrtVBR4;
- } else if (ft == UNI_TRAFFIC_FPCR1_P) {
- *fclass = UNI_TRAFFIC_nrtVBR5;
- NOFT("nrtVBR.5");
- } else if (ft == fvbr16) {
- *fclass = UNI_TRAFFIC_nrtVBR6;
- NOFT("nrtVBR.6");
- } else
- FBAD("nrtVBR.2-6");
- if (bt == bvbr23) {
- if (btag)
- *bclass = UNI_TRAFFIC_nrtVBR3;
- else
- *bclass = UNI_TRAFFIC_nrtVBR2;
- } else if (bt == bvbr4) {
- *bclass = UNI_TRAFFIC_nrtVBR4;
- } else if (bt == UNI_TRAFFIC_BPCR1_P) {
- *bclass = UNI_TRAFFIC_nrtVBR5;
- NOBT("nrtVBR.5");
- } else if (bt == bvbr16) {
- *bclass = UNI_TRAFFIC_nrtVBR6;
- NOBT("nrtVBR.6");
- } else
- BBAD("nrtVBR.2-6");
- break;
-
- case UNI_TRAFFIC_ABR:
- NOBE("ABR");
- if (ft != UNI_TRAFFIC_FPCR1_P)
- FBAD("ABR");
- if (bt != UNI_TRAFFIC_BPCR1_P)
- BBAD("ABR");
- NOFT("ABR");
- NOBT("ABR");
- *fclass = *bclass = UNI_TRAFFIC_ABR;
- break;
- }
-
- return (0);
-}
diff --git a/sys/contrib/ngatm/netnatm/msg/uni_config.h b/sys/contrib/ngatm/netnatm/msg/uni_config.h
deleted file mode 100644
index e53f59b8395c..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/uni_config.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 1996-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/netnatm/msg/uni_config.h,v 1.3 2003/09/19 11:58:15 hbb Exp $
- */
-#ifndef _uni_uni_config_h_
-#define _uni_uni_config_h_
-
-enum {
- /* maximum number of reported error IEs */
- UNI_MAX_ERRIE = 50,
-
- /* maximum number of Generic Identifier Transport IE's per message */
- UNI_NUM_IE_GIT = 3,
-
- /* maximum number of BLLI's in SETUP */
- UNI_NUM_IE_BLLI = 3,
-
- /* maximum number of CALLEDSUB's */
- UNI_NUM_IE_CALLEDSUB = 2,
-
- /* maximum number of CALLINGSUB's */
- UNI_NUM_IE_CALLINGSUB = 2,
-
- /* maximum number of TNS's */
- UNI_NUM_IE_TNS = 4,
-
- /* maximum length of TNS name */
- UNI_TNS_MAXLEN = 4,
-
- /* maximum info size in user-to-user signalling IE */
- UNI_UU_MAXLEN = 128,
-
- /* maximum length of address */
- UNI_ADDR_MAXLEN = 20,
-
- /* maximum length of subaddress */
- UNI_SUBADDR_MAXLEN = 20,
-
- /* maximum number of DTLs */
- UNI_NUM_IE_DTL = 10,
- /* maximum number of identifiers in DTL */
- UNI_DTL_MAXNUM = 20,
-};
-#endif
diff --git a/sys/contrib/ngatm/netnatm/msg/uni_hdr.h b/sys/contrib/ngatm/netnatm/msg/uni_hdr.h
deleted file mode 100644
index c9a30f12be5d..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/uni_hdr.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 1996-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/netnatm/msg/uni_hdr.h,v 1.6 2004/07/08 08:22:05 brandt Exp $
- */
-#ifndef _NETNATM_MSG_UNI_HDR_H_
-#define _NETNATM_MSG_UNI_HDR_H_
-
-#include <sys/types.h>
-#ifdef _KERNEL
-#include <sys/stdint.h>
-#else
-#include <stdint.h>
-#endif
-
-#include <netnatm/msg/uni_config.h>
-
-enum {
- UNI_PROTO = 0x09, /* protocol discriminator */
- PNNI_PROTO = 0xf0, /* PNNI protocol discriminator */
-};
-
-/*
- * Message types
- */
-enum uni_msgtype {
- UNI_UNKNOWN = 0x100,/* unknown message */
-
- UNI_ALERTING = 0x01, /* alerting */
- UNI_CALL_PROC = 0x02, /* call proceeding */
- UNI_SETUP = 0x05, /* setup */
- UNI_CONNECT = 0x07, /* connect */
- UNI_CONNECT_ACK = 0x0f, /* connect ack */
-
- UNI_RESTART = 0x46, /* restart */
- UNI_RELEASE = 0x4d, /* release */
- UNI_RESTART_ACK = 0x4e, /* restart acknowledgement */
- UNI_RELEASE_COMPL = 0x5a, /* release complete */
-
- UNI_NOTIFY = 0x6e, /* notify user */
- UNI_STATUS_ENQ = 0x75, /* status enquiry */
- UNI_STATUS = 0x7d, /* status */
-
- UNI_ADD_PARTY = 0x80, /* add party */
- UNI_ADD_PARTY_ACK = 0x81, /* add party acknowledgement */
- UNI_ADD_PARTY_REJ = 0x82, /* add party reject */
- UNI_DROP_PARTY = 0x83, /* drop party */
- UNI_DROP_PARTY_ACK = 0x84, /* drop party acknowledgement */
- UNI_PARTY_ALERTING = 0x85, /* party alerting */
-
- UNI_LEAF_SETUP_FAIL = 0x90, /* leaf setup failed */
- UNI_LEAF_SETUP_REQ = 0x91, /* leaf setup request */
-
- UNI_COBISETUP = 0x15, /* Q.2932 COBI-setup */
- UNI_FACILITY = 0x62, /* Q.2932 facility */
-
- UNI_MODIFY_REQ = 0x88, /* Q.2963 Modify request */
- UNI_MODIFY_ACK = 0x89, /* Q.2963 Modify acknowledgement */
- UNI_MODIFY_REJ = 0x8a, /* Q.2963 Modify reject */
- UNI_CONN_AVAIL = 0x8b, /* Q.2963 Connection available */
-};
-
-/*
- * Information element types
- */
-enum uni_ietype {
- UNI_IE_CAUSE = 0x08, /* cause */
- UNI_IE_CALLSTATE = 0x14, /* call state */
- UNI_IE_FACILITY = 0x1C, /* Q.2932 facility IE */
- UNI_IE_NOTIFY = 0x27, /* UNI4.0 notify */
- UNI_IE_EETD = 0x42, /* UNI4.0 end-to-end transit delay */
- UNI_IE_CONNED = 0x4c, /* UNI4.0/Q.2951 connected address */
- UNI_IE_CONNEDSUB = 0x4d, /* UNI4.0/Q.2951 connected subaddress */
- UNI_IE_EPREF = 0x54, /* endpoint reference */
- UNI_IE_EPSTATE = 0x55, /* enpoint state */
- UNI_IE_AAL = 0x58, /* ATM adaptation layer parameters */
- UNI_IE_TRAFFIC = 0x59, /* ATM traffic descriptor */
- UNI_IE_CONNID = 0x5a, /* connection identifier */
- UNI_IE_QOS = 0x5c, /* quality of service parameter */
- UNI_IE_BHLI = 0x5d, /* broadband higher layer information */
- UNI_IE_BEARER = 0x5e, /* broadband bearer capability */
- UNI_IE_BLLI = 0x5f, /* broadband lower layer information */
- UNI_IE_LSHIFT = 0x60, /* broadband locking shift */
- UNI_IE_NLSHIFT = 0x61, /* broadband non-locking shift */
- UNI_IE_SCOMPL = 0x62, /* broadband sending complete */
- UNI_IE_REPEAT = 0x63, /* broadband repeat indicator */
- UNI_IE_CALLING = 0x6c, /* calling party number */
- UNI_IE_CALLINGSUB = 0x6d, /* calling party subaddress */
- UNI_IE_CALLED = 0x70, /* called party number */
- UNI_IE_CALLEDSUB = 0x71, /* called party subaddress */
- UNI_IE_TNS = 0x78, /* transit network selection */
- UNI_IE_RESTART = 0x79, /* restart indicator */
- UNI_IE_UU = 0x7e, /* UNI4.0/Q.2957 user-to-user info */
- UNI_IE_GIT = 0x7f, /* UNI4.0 generic identifier transport*/
- UNI_IE_MINTRAFFIC = 0x81, /* Q.2962 minimum traffic desc */
- UNI_IE_ATRAFFIC = 0x82, /* Q.2962 alternate traffic desc */
- UNI_IE_ABRSETUP = 0x84, /* UNI4.0 ABR setup parameters */
- UNI_IE_REPORT = 0x89, /* Q.2963 broadband report type */
- UNI_IE_CALLED_SOFT = 0xe0, /* PNNI Calling party soft PVPC */
- UNI_IE_CRANKBACK = 0xe1, /* PNNI Crankback */
- UNI_IE_DTL = 0xe2, /* PNNI designated transit list */
- UNI_IE_CALLING_SOFT = 0xe3, /* PNNI Called party soft PVPC */
- UNI_IE_ABRADD = 0xe4, /* UNI4.0 ABR additional parameters */
- UNI_IE_LIJ_CALLID = 0xe8, /* UNI4.0 LIF call identifier */
- UNI_IE_LIJ_PARAM = 0xe9, /* UNI4.0 LIF parameters */
- UNI_IE_LIJ_SEQNO = 0xea, /* UNI4.0 LIF sequence number */
- UNI_IE_CSCOPE = 0xeb, /* UNI4.0 connection scope selection */
- UNI_IE_EXQOS = 0xec, /* UNI4.0 extended QoS parameters */
- UNI_IE_MDCR = 0xf0, /* UNI4.0+ Minimum desired call rate */
- UNI_IE_UNREC = 0xfe,
-};
-
-enum uni_coding {
- UNI_CODING_ITU = 0x0,
- UNI_CODING_NET = 0x3,
-};
-
-enum uni_msgact {
- UNI_MSGACT_CLEAR = 0x0,
- UNI_MSGACT_IGNORE = 0x1,
- UNI_MSGACT_REPORT = 0x2,
-
- UNI_MSGACT_DEFAULT = 0x4
-};
-
-enum uni_ieact {
- UNI_IEACT_CLEAR = 0x00, /* clear call */
- UNI_IEACT_IGNORE = 0x01, /* ignore IE and proceed */
- UNI_IEACT_REPORT = 0x02, /* ignore IE, report and proceed */
- UNI_IEACT_MSG_IGNORE = 0x05, /* ignore message */
- UNI_IEACT_MSG_REPORT = 0x06, /* ignore message and report */
-
- UNI_IEACT_DEFAULT = 0x08
-};
-
-struct uni_cref {
- u_int flag;
- u_int cref;
-};
-
-/*
- * Message header.
- */
-struct uni_msghdr {
- struct uni_cref cref;
- enum uni_msgact act; /* action indicator */
- u_int pass:1; /* PNNI pass along request */
-};
-
-enum {
- CREF_GLOBAL = 0,
- CREF_DUMMY = 0x7fffff,
-};
-
-/*
- * General information element header.
- */
-struct uni_iehdr {
- enum uni_coding coding; /* coding standard */
- enum uni_ieact act; /* action indicator */
- u_int pass : 1; /* PNNI pass along request */
- u_int present; /* which optional elements are present */
-#define UNI_IE_EMPTY 0x80000000
-#define UNI_IE_PRESENT 0x40000000
-#define UNI_IE_ERROR 0x20000000
-#define UNI_IE_XXX 0x10000000
-#define UNI_IE_MASK 0xf0000000
-};
-
-#define IE_ISPRESENT(IE) \
- (((IE).h.present & (UNI_IE_PRESENT|UNI_IE_EMPTY)) == UNI_IE_PRESENT)
-#define IE_SETPRESENT(IE) \
- ((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \
- UNI_IE_PRESENT)
-
-#define IE_ADDPRESENT(IE) \
- ((IE).h.present = ((IE).h.present & ~UNI_IE_EMPTY) | \
- UNI_IE_PRESENT)
-
-#define IE_ISEMPTY(IE) \
- (((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT | UNI_IE_EMPTY))
-#define IE_SETEMPTY(IE) \
- ((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \
- UNI_IE_EMPTY | UNI_IE_PRESENT)
-
-#define IE_ISERROR(IE) \
- (((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT | UNI_IE_ERROR))
-#define IE_SETERROR(IE) \
- ((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \
- UNI_IE_ERROR | UNI_IE_PRESENT)
-
-#define IE_ISGOOD(IE) \
- (((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT))
-
-#endif
diff --git a/sys/contrib/ngatm/netnatm/msg/uni_ie.c b/sys/contrib/ngatm/netnatm/msg/uni_ie.c
deleted file mode 100644
index 3842279c63a1..000000000000
--- a/sys/contrib/ngatm/netnatm/msg/uni_ie.c
+++ /dev/null
@@ -1,7168 +0,0 @@
-/*
- * Copyright (c) 2001-2003
- * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Author: Hartmut Brandt <harti@freebsd.org>
- *
- * $Begemot: libunimsg/netnatm/msg/uni_ie.c,v 1.16 2005/05/23 12:06:30 brandt_h Exp $
- *
- * Private definitions for the IE code file.
- *
- * This file includes the table generated automatically.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-
-#ifdef _KERNEL
-#include <sys/libkern.h>
-#else
-#include <string.h>
-#endif
-#include <netnatm/unimsg.h>
-#include <netnatm/msg/unistruct.h>
-#include <netnatm/msg/unimsglib.h>
-#include <netnatm/msg/uniprint.h>
-#include <netnatm/msg/priv.h>
-
-#define UNUSED(_p) do { (void)(_p); } while (0)
-
-/*
- * Define internal functions.
- */
-#define DEF_IE_PRINT(Coding, IE) \
- void uni_ie_print_##Coding##_##IE(struct uni_ie_##IE *ie, struct unicx *cx)
-
-#define DEF_IE_CHECK(Coding, IE) \
- int uni_ie_check_##Coding##_##IE(struct uni_ie_##IE *ie, struct unicx *cx)
-
-#define DEF_IE_ENCODE(Coding, IE) \
- int uni_ie_encode_##Coding##_##IE(struct uni_msg *msg, struct uni_ie_##IE *ie, struct unicx *cx)
-
-#define DEF_IE_DECODE(Coding, IE) \
- int uni_ie_decode_##Coding##_##IE(struct uni_ie_##IE *ie, struct uni_msg *msg, u_int ielen, struct unicx *cx)
-
-/*
- * This structure is used to define value->string mappings. MKT() is used
- * to generate a table entry. EOT() to end the table.
- */
-#define MKT(V,N) { #N, V }
-#define EOT() { NULL, 0 }
-
-/* library internal functions */
-static void uni_entry(const char *, struct unicx *);
-static int uni_print_iehdr(const char *, struct uni_iehdr *h, struct unicx *);
-static void uni_print_ieend(struct unicx *);
-static void uni_putc(int, struct unicx *);
-
-
-/*
- * Encoding
- */
-#define APP_BYTE(M, B) do { \
- *(M)->b_wptr++ = (B); \
- } while (0)
-#define APP_16BIT(M, B) do { \
- u_int _v = (B); \
- *(M)->b_wptr++ = _v >> 8; \
- *(M)->b_wptr++ = _v; \
- } while (0)
-#define APP_24BIT(M, B) do { \
- u_int _v = (B); \
- *(M)->b_wptr++ = _v >> 16; \
- *(M)->b_wptr++ = _v >> 8; \
- *(M)->b_wptr++ = _v; \
- } while (0)
-#define APP_32BIT(M, B) do { \
- u_int _v = (B); \
- *(M)->b_wptr++ = _v >> 24; \
- *(M)->b_wptr++ = _v >> 16; \
- *(M)->b_wptr++ = _v >> 8; \
- *(M)->b_wptr++ = _v; \
- } while (0)
-#define APP_BUF(M, B, L) do { \
- (void)memcpy((M)->b_wptr, (B), (L)); \
- (M)->b_wptr += (L); \
- } while (0)
-
-#define APP_SUB_BYTE(M, T, B) do { APP_BYTE(M, T); APP_BYTE(M, B); } while (0)
-#define APP_SUB_16BIT(M, T, B) do { APP_BYTE(M, T); APP_16BIT(M, B); } while (0)
-#define APP_SUB_24BIT(M, T, B) do { APP_BYTE(M, T); APP_24BIT(M, B); } while (0)
-#define APP_SUB_32BIT(M, T, B) do { APP_BYTE(M, T); APP_32BIT(M, B); } while (0)
-
-#define APP_OPT(M, F, P, T) do { \
- if ((F) & (P)) \
- APP_BYTE((M), (T)); \
- } while (0)
-#define APP_OPT_BYTE(M, F, P, T, B) do { \
- if ((F) & (P)) \
- APP_SUB_BYTE((M), (T), (B)); \
- } while (0)
-#define APP_OPT_16BIT(M, F, P, T, B) do { \
- if ((F) & (P)) \
- APP_SUB_16BIT((M), (T), (B)); \
- } while (0)
-#define APP_OPT_24BIT(M, F, P, T, B) do { \
- if ((F) & (P)) \
- APP_SUB_24BIT((M), (T), (B)); \
- } while (0)
-
-#define START_IE(TYPE,CODE,LEN) \
- u_int ielen; \
- \
- if (uni_check_ie(CODE, (union uni_ieall *)ie, cx)) \
- return (-1); \
- if (uni_encode_ie_hdr(msg, CODE, &ie->h, (LEN), cx)) \
- return (0); \
- \
- ielen = msg->b_wptr - msg->b_rptr - 2;
-
-#define START_IE2(TYPE,CODE,LEN,REALCODE) \
- u_int ielen; \
- \
- if (uni_check_ie(CODE, (union uni_ieall *)ie, cx)) \
- return (-1); \
- if (uni_encode_ie_hdr(msg, REALCODE, &ie->h, (LEN), cx)) \
- return (0); \
- \
- ielen = msg->b_wptr - msg->b_rptr - 2;
-
-#define SET_IE_LEN(M) do { \
- (M)->b_buf[ielen + 0] = \
- (((M)->b_wptr - (M)->b_rptr) - ielen - 2) >> 8; \
- (M)->b_buf[ielen + 1] = \
- (((M)->b_wptr - (M)->b_rptr) - ielen - 2) >> 0; \
- } while (0)
-
-
-/***********************************************************************/
-/*
- * Decoding
- */
-#define IE_START(ERR) \
- if (IE_ISPRESENT(*ie)) \
- return (0); \
- if (ielen == 0) { \
- IE_SETEMPTY(*ie); \
- return (0); \
- }
-
-#define IE_END(IE) \
- IE_SETPRESENT(*ie); \
- if (uni_check_ie(UNI_IE_##IE, (union uni_ieall *)ie, cx) == 0) \
- return (0); \
- rej: \
- ie->h.present = UNI_IE_ERROR | UNI_IE_PRESENT; \
- return (1);
-
-#define DEC_GETF3(ID, F, P) \
- case UNI_##ID##_ID: \
- if (ielen < 3) \
- goto rej; \
- ielen -= 3; \
- if (!(P & UNI_##ID##_P)) { \
- P |= UNI_##ID##_P; \
- ie->F = *msg->b_rptr++ << 16; \
- ie->F |= *msg->b_rptr++ << 8; \
- ie->F |= *msg->b_rptr++; \
- } else \
- msg->b_rptr += 3; \
- break;
-
-#define DEC_GETF1(ID, F, P) \
- case UNI_##ID##_ID: \
- if (ielen < 1) \
- goto rej; \
- ielen--; \
- if (!(P & UNI_##ID##_P)) { \
- P |= UNI_##ID##_P; \
- ie->F = *msg->b_rptr++; \
- } else \
- msg->b_rptr++; \
- break;
-
-
-#define PRINT_NPREFIX (sizeof(((struct unicx *)0)->prefix) / \
- sizeof(((struct unicx *)0)->prefix[0]))
-
-/*
- * This is rather here than in privmsg.c because we need the APP macros.
- */
-int
-uni_encode_msg_hdr(struct uni_msg *msg, struct uni_msghdr *h,
- enum uni_msgtype type, struct unicx *cx, int *mlen)
-{
- u_char byte;
-
- if (uni_msg_ensure(msg, 9) != 0)
- return -1;
-
- APP_BYTE(msg, cx->pnni ? PNNI_PROTO : UNI_PROTO);
- APP_BYTE(msg, 3);
- if(h->cref.cref >= 1<<23)
- return -1;
- APP_24BIT(msg, h->cref.cref | (h->cref.flag ? 0x800000 : 0));
- APP_BYTE(msg, type);
-
- byte = 0x80;
- if(h->act != UNI_MSGACT_DEFAULT)
- byte |= 0x10 | (h->act & 3);
- if(cx->pnni && h->pass)
- byte |= 0x08;
- APP_BYTE(msg, byte);
-
- *mlen = msg->b_wptr - msg->b_rptr;
- APP_16BIT(msg, 0);
-
- return 0;
-}
-
-/*
- * Initialize printing. This must be called by all printing routines
- * that are exported to the user.
- */
-void
-uni_print_init(char *buf, size_t bufsiz, struct unicx *cx)
-{
- if (cx->dont_init)
- return;
-
- cx->indent = 0;
- cx->nprefix = 0;
- cx->doindent = 0;
- if (cx->tabsiz == 0)
- cx->tabsiz = 4;
- cx->buf = buf;
- cx->bufsiz = bufsiz;
-}
-
-/*
- * Append a character to the buffer if there is still space
- */
-static void
-uni_putc(int c, struct unicx *cx)
-{
- if(cx->bufsiz > 1) {
- *cx->buf++ = c;
- cx->bufsiz--;
- *cx->buf = '\0';
- }
-}
-
-void
-uni_printf(struct unicx *cx, const char *fmt, ...)
-{
- u_int n;
- va_list ap;
-
- if(cx->bufsiz > 1) {
- va_start(ap, fmt);
- n = vsnprintf(cx->buf, cx->bufsiz, fmt, ap);
- va_end(ap);
- if(n > 0) {
- if(n < cx->bufsiz) {
- cx->bufsiz -= n;
- cx->buf += n;
- } else {
- cx->buf += cx->bufsiz - 1;
- cx->bufsiz = 1;
- }
- }
- *cx->buf = '\0';
- }
-}
-
-/*
- * Print mode:
- * 0 - print all into one line, fully prefixed
- * 1 - print on multiple lines, full prefixed, but equal level
- * entries on one line
- * 2 - like 2, but only partial prefixed
- * 3 - like 1, but each entry onto a new line
- * 4 - like 2 + 3
- */
-
-/*
- * If we are in multiline mode, end the current line and set the
- * flag, that we need indentation. But prevent double new lines.
- */
-void
-uni_print_eol(struct unicx *cx)
-{
- if (cx->multiline) {
- if (!cx->doindent) {
- uni_putc('\n', cx);
- cx->doindent = 1;
- }
- }
-}
-
-/*
- * New entry. Do the prefixing, indentation and spacing.
- */
-static void
-doprefix(struct unicx *cx, const char *s)
-{
- u_int i;
-
- if(cx->multiline == 0) {
- uni_putc(' ', cx);
- for(i = 0; i < cx->nprefix; i++)
- if(cx->prefix[i])
- uni_printf(cx, "%s.", cx->prefix[i]);
- } else if(cx->multiline == 1) {
- if(cx->doindent) {
- uni_printf(cx, "%*s", cx->indent * cx->tabsiz, "");
- cx->doindent = 0;
- } else
- uni_putc(' ', cx);
- for(i = 0; i < cx->nprefix; i++)
- if(cx->prefix[i])
- uni_printf(cx, "%s.", cx->prefix[i]);
- } else if(cx->multiline == 2) {
- if(cx->doindent) {
- uni_printf(cx, "%*s", cx->indent * cx->tabsiz, "");
- cx->doindent = 0;
- } else
- uni_putc(' ', cx);
- } else if(cx->multiline == 3) {
- if(cx->doindent)
- cx->doindent = 0;
- else
- uni_putc('\n', cx);
- uni_printf(cx, "%*s", cx->indent * cx->tabsiz, "");
- for(i = 0; i < cx->nprefix; i++)
- if(cx->prefix[i])
- uni_printf(cx, "%s.", cx->prefix[i]);
- } else if(cx->multiline == 4) {
- if(cx->doindent)
- cx->doindent = 0;
- else
- uni_putc('\n', cx);
- uni_printf(cx, "%*s", cx->indent * cx->tabsiz, "");
- }
- uni_printf(cx, "%s", s);
-}
-static void
-uni_entry(const char *s, struct unicx *cx)
-{
- doprefix(cx, s);
- uni_putc('=', cx);
-}
-void
-uni_print_flag(const char *s, struct unicx *cx)
-{
- doprefix(cx, s);
-}
-
-
-/*
- * Start a deeper level of indendation. If multiline is in effect,
- * we end the current line.
- */
-void
-uni_print_push_prefix(const char *prefix, struct unicx *cx)
-{
- if (cx->nprefix < PRINT_NPREFIX)
- cx->prefix[cx->nprefix++] = prefix;
-}
-void
-uni_print_pop_prefix(struct unicx *cx)
-{
- if (cx->nprefix > 0)
- cx->nprefix--;
-}
-
-void
-uni_print_tbl(const char *entry, u_int val, const struct uni_print_tbl *tbl,
- struct unicx *cx)
-{
- if (entry)
- uni_entry(entry, cx);
- while (tbl->name) {
- if (tbl->val == val) {
- uni_printf(cx, "%s", tbl->name);
- return;
- }
- tbl++;
- }
- uni_printf(cx, "ERROR(0x%x)", val);
-}
-
-void
-uni_print_entry(struct unicx *cx, const char *e, const char *fmt, ...)
-{
- u_int n;
- va_list ap;
-
- uni_entry(e, cx);
-
- if (cx->bufsiz > 1) {
- va_start(ap, fmt);
- n = vsnprintf(cx->buf, cx->bufsiz, fmt, ap);
- va_end(ap);
- if (n > 0) {
- if (n < cx->bufsiz) {
- cx->bufsiz -= n;
- cx->buf += n;
- } else {
- cx->buf += cx->bufsiz - 1;
- cx->bufsiz = 1;
- }
- }
- *cx->buf = '\0';
- }
-}
-
-/**********************************************************************/
-/*
- * Printing information elements.
- */
-static int
-uni_print_iehdr(const char *name, struct uni_iehdr *h, struct unicx *cx)
-{
- static const struct uni_print_tbl act_tab[] = {
- MKT(UNI_IEACT_CLEAR, clear),
- MKT(UNI_IEACT_IGNORE, ignore),
- MKT(UNI_IEACT_REPORT, report),
- MKT(UNI_IEACT_MSG_IGNORE, ignore-msg),
- MKT(UNI_IEACT_MSG_REPORT, report-msg),
- MKT(UNI_IEACT_DEFAULT, default),
- EOT()
- };
- static const struct uni_print_tbl cod_tab[] = {
- MKT(UNI_CODING_ITU, itut),
- MKT(UNI_CODING_NET, atmf),
- EOT()
- };
-
- uni_print_entry(cx, name, "(");
- uni_print_tbl(NULL, h->act, act_tab, cx);
- uni_putc(',', cx);
- uni_print_tbl(NULL, h->coding, cod_tab, cx);
- if(cx->pnni && h->pass)
- uni_printf(cx, ",pass");
- if(IE_ISEMPTY(*(struct uni_ie_aal *)h)) {
- uni_printf(cx, ",empty)");
- uni_print_eol(cx);
- return 1;
- }
- if(IE_ISERROR(*(struct uni_ie_aal *)h)) {
- uni_printf(cx, ",error)");
- uni_print_eol(cx);
- return 1;
- }
-
- uni_putc(')', cx);
-
- uni_print_push_prefix(name, cx);
- uni_print_eol(cx);
- cx->indent++;
-
- return 0;
-}
-
-static void
-uni_print_ieend(struct unicx *cx)
-{
- uni_print_pop_prefix(cx);
- uni_print_eol(cx);
- cx->indent--;
-}
-
-void
-uni_print_ie_internal(enum uni_ietype code, const union uni_ieall *ie,
- struct unicx *cx)
-{
- const struct iedecl *iedecl;
-
- if((iedecl = GET_IEDECL(code, ie->h.coding)) != NULL)
- (*iedecl->print)(ie, cx);
-}
-
-void
-uni_print_ie(char *buf, size_t size, enum uni_ietype code,
- const union uni_ieall *ie, struct unicx *cx)
-{
- uni_print_init(buf, size, cx);
- uni_print_ie_internal(code, ie, cx);
-}
-
-int
-uni_check_ie(enum uni_ietype code, union uni_ieall *ie, struct unicx *cx)
-{
- const struct iedecl *iedecl = GET_IEDECL(code, ie->h.coding);
-
- if (iedecl != NULL)
- return (iedecl->check(ie, cx));
- else
- return (-1);
-}
-
-/*
- * Decode a information element header.
- * Returns -1 if the message is too short.
- * Strip the header from the message.
- * The header is stripped, even if it is too short.
- */
-int
-uni_decode_ie_hdr(enum uni_ietype *ietype, struct uni_iehdr *hdr,
- struct uni_msg *msg, struct unicx *cx, u_int *ielen)
-{
- u_int len;
-
- *ietype = (enum uni_ietype)0;
- *ielen = 0;
- hdr->present = 0;
- hdr->coding = UNI_CODING_ITU;
- hdr->act = UNI_IEACT_DEFAULT;
-
- if ((len = uni_msg_len(msg)) == 0)
- return (-1);
-
- *ietype = *msg->b_rptr++;
-
- if (--len == 0)
- return (-1);
-
- hdr->coding = (*msg->b_rptr >> 5) & 3;
- hdr->present = 0;
-
- switch (*msg->b_rptr & 0x17) {
-
- case 0x10: case 0x11: case 0x12:
- case 0x15: case 0x16:
- hdr->act = *msg->b_rptr & 0x7;
- break;
-
- case 0x00: case 0x01: case 0x02: case 0x03:
- case 0x04: case 0x05: case 0x06: case 0x07:
- hdr->act = UNI_IEACT_DEFAULT;
- break;
-
- default:
- /* Q.2931 5.7.2 last sentence */
- hdr->act = UNI_IEACT_REPORT;
- break;
- }
- if (cx->pnni && (*msg->b_rptr & 0x08))
- hdr->pass = 1;
- else
- hdr->pass = 0;
- msg->b_rptr++;
-
- if (--len == 0) {
- hdr->present = UNI_IE_ERROR | UNI_IE_PRESENT;
- return (-1);
- }
-
- if (len < 2) {
- msg->b_rptr += len;
- hdr->present = UNI_IE_ERROR | UNI_IE_PRESENT;
- return (-1);
- }
-
- *ielen = *msg->b_rptr++ << 8;
- *ielen |= *msg->b_rptr++;
-
- return (0);
-}
-
-/*
- * Decode the body of an information element.
- */
-int
-uni_decode_ie_body(enum uni_ietype ietype, union uni_ieall *ie,
- struct uni_msg *msg, u_int ielen, struct unicx *cx)
-{
- const struct iedecl *iedecl;
- u_char *end;
- int ret;
-
- if (ielen > uni_msg_len(msg)) {
- /*
- * Information element too long -> content error.
- * Q.2931 5.6.8.2
- */
- msg->b_rptr = msg->b_wptr;
- ie->h.present = UNI_IE_ERROR | UNI_IE_PRESENT;
- return (-1);
- }
-
- if ((iedecl = GET_IEDECL(ietype, ie->h.coding)) == NULL) {
- /*
- * entirly unknown IE.
- * Q.2931 5.6.8.1
- */
- msg->b_rptr += ielen;
- ie->h.present = UNI_IE_ERROR | UNI_IE_PRESENT;
- return (-1);
- }
-
- if (ielen > iedecl->maxlen) {
- /*
- * Information element too long -> content error.
- * Q.2931 5.6.8.2
- */
- msg->b_rptr += iedecl->maxlen;
- ie->h.present = UNI_IE_ERROR | UNI_IE_PRESENT;
- return (-1);
- }
-
- end = msg->b_rptr + ielen;
- ret = (*iedecl->decode)(ie, msg, ielen, cx);
- msg->b_rptr = end;
-
- return (ret);
-}
-
-int
-uni_encode_ie(enum uni_ietype code, struct uni_msg *msg, union uni_ieall *ie,
- struct unicx *cx)
-{
- const struct iedecl *iedecl = GET_IEDECL(code, ie->h.coding);
-
- if (iedecl == NULL)
- return (-1);
- return (iedecl->encode(msg, ie, cx));
-}
-
-int
-uni_encode_ie_hdr(struct uni_msg *msg, enum uni_ietype type,
- struct uni_iehdr *h, u_int len, struct unicx *cx)
-{
- u_char byte;
-
- if (uni_msg_ensure(msg, 4 + len) != 0)
- return -1;
- *msg->b_wptr++ = type;
-
- byte = 0x80 | (h->coding << 5);
- if(h->act != UNI_IEACT_DEFAULT)
- byte |= 0x10 | (h->act & 7);
- if(cx->pnni)
- byte |= h->pass << 3;
- *msg->b_wptr++ = byte;
-
- if(h->present & UNI_IE_EMPTY) {
- *msg->b_wptr++ = 0;
- *msg->b_wptr++ = 4;
- return -1;
- }
- *msg->b_wptr++ = 0;
- *msg->b_wptr++ = 0;
-
- return 0;
-}
-
-/*
- * Printing messages.
- */
-static void
-uni_print_cref_internal(const struct uni_cref *cref, struct unicx *cx)
-{
- uni_print_entry(cx, "cref", "%d.", cref->flag);
- if (cref->cref == CREF_GLOBAL)
- uni_printf(cx, "GLOBAL");
- else if (cref->cref == CREF_DUMMY)
- uni_printf(cx, "DUMMY");
- else
- uni_printf(cx, "%d", cref->cref);
-}
-void
-uni_print_cref(char *str, size_t len, const struct uni_cref *cref,
- struct unicx *cx)
-{
- uni_print_init(str, len, cx);
- uni_print_cref_internal(cref, cx);
-}
-
-static void
-uni_print_msghdr_internal(const struct uni_msghdr *hdr, struct unicx *cx)
-{
- static const struct uni_print_tbl tab[] = {
- MKT(UNI_MSGACT_CLEAR, clear),
- MKT(UNI_MSGACT_IGNORE, ignore),
- MKT(UNI_MSGACT_REPORT, report),
- MKT(UNI_MSGACT_DEFAULT, default),
- EOT()
- };
-
- uni_print_cref_internal(&hdr->cref, cx);
- uni_print_tbl("act", hdr->act, tab, cx);
- if (cx->pnni)
- uni_print_entry(cx, "pass", "%s", hdr->pass ? "yes" : "no");
-}
-
-void
-uni_print_msghdr(char *str, size_t len, const struct uni_msghdr *hdr,
- struct unicx *cx)
-{
- uni_print_init(str, len, cx);
- uni_print_msghdr_internal(hdr, cx);
-}
-
-
-static void
-uni_print_internal(const struct uni_all *msg, struct unicx *cx)
-{
- uni_entry("mtype", cx);
- if(msg->mtype >= 256 || uni_msgtable[msg->mtype] == NULL) {
- uni_printf(cx, "0x%02x(ERROR)", msg->mtype);
- } else {
- uni_printf(cx, "%s", uni_msgtable[msg->mtype]->name);
- uni_print_msghdr_internal(&msg->u.hdr, cx);
- cx->indent++;
- uni_print_eol(cx);
- (*uni_msgtable[msg->mtype]->print)(&msg->u, cx);
- cx->indent--;
- }
-
- if(cx->multiline == 0)
- uni_printf(cx, "\n");
-}
-
-void
-uni_print(char *buf, size_t size, const struct uni_all *all, struct unicx *cx)
-{
- uni_print_init(buf, size, cx);
- uni_print_internal(all, cx);
-}
-
-static void
-uni_print_msg_internal(u_int mtype, const union uni_msgall *msg,
- struct unicx *cx)
-{
-
- uni_entry("mtype", cx);
- if (mtype >= 256 || uni_msgtable[mtype] == NULL) {
- uni_printf(cx, "0x%02x(ERROR)", mtype);
- } else {
- uni_printf(cx, "%s", uni_msgtable[mtype]->name);
- uni_print_msghdr_internal(&msg->hdr, cx);
- cx->indent++;
- uni_print_eol(cx);
- (*uni_msgtable[mtype]->print)(msg, cx);
- cx->indent--;
- }
-
- if(cx->multiline == 0)
- uni_printf(cx, "\n");
-}
-
-void
-uni_print_msg(char *buf, size_t size, u_int mtype, const union uni_msgall *all,
- struct unicx *cx)
-{
- uni_print_init(buf, size, cx);
- uni_print_msg_internal(mtype, all, cx);
-}
-
-void
-uni_print_cx(char *buf, size_t size, struct unicx *cx)
-{
- static const char *acttab[] = {
- "clr", /* 0x00 */
- "ign", /* 0x01 */
- "rep", /* 0x02 */
- "x03", /* 0x03 */
- "x04", /* 0x04 */
- "mig", /* 0x05 */
- "mrp", /* 0x06 */
- "x07", /* 0x07 */
- "def", /* 0x08 */
- };
-
- static const char *errtab[] = {
- [UNI_IERR_UNK] = "unk", /* unknown IE */
- [UNI_IERR_LEN] = "len", /* length error */
- [UNI_IERR_BAD] = "bad", /* content error */
- [UNI_IERR_ACC] = "acc", /* access element discarded */
- [UNI_IERR_MIS] = "mis", /* missing IE */
- };
-
- u_int i;
-
- uni_print_init(buf, size, cx);
-
- uni_printf(cx, "q2932 %d\n", cx->q2932);
- uni_printf(cx, "pnni %d\n", cx->pnni);
- uni_printf(cx, "git_hard %d\n", cx->git_hard);
- uni_printf(cx, "bearer_hard %d\n", cx->bearer_hard);
- uni_printf(cx, "cause_hard %d\n", cx->cause_hard);
-
- uni_printf(cx, "multiline %d\n", cx->multiline);
- uni_printf(cx, "tabsiz %d\n", cx->tabsiz);
-
- uni_printf(cx, "errcnt %d (", cx->errcnt);
- for(i = 0; i < cx->errcnt; i++) {
- uni_printf(cx, "%02x[%s,%s%s]", cx->err[i].ie,
- errtab[cx->err[i].err], acttab[cx->err[i].act],
- cx->err[i].man ? ",M" : "");
- if(i != cx->errcnt - 1)
- uni_putc(' ', cx);
- }
- uni_printf(cx, ")\n");
-}
-
-#include <netnatm/msg/uni_ietab.h>
-
-/*********************************************************************
- *
- * Cause
- *
- * References for this IE are:
- *
- * Q.2931 pp. 69 (just a pointer to Q.2610)
- * Q.2610 (this is a small diff to Q.850)
- * Q.850 !!
- * UNI4.0 pp. 15
- * PNNI1.0 p. 198
- *
- * ITU-T and NET coding for different values.
- */
-static const struct causetab {
- const char *str;
- enum uni_diag diag;
-} itu_causes[128] = {
-
-#define D(NAME,VAL,DIAG,STD,STR) [UNI_CAUSE_##NAME] = { STR, UNI_DIAG_##DIAG },
-#define N(NAME,VAL,DIAG,STD,STR)
-
-UNI_DECLARE_CAUSE_VALUES
-
-#undef D
-#undef N
-
-}, net_causes[128] = {
-
-#define D(NAME,VAL,DIAG,STD,STR)
-#define N(NAME,VAL,DIAG,STD,STR) [UNI_CAUSE_##NAME] = { STR, UNI_DIAG_##DIAG },
-
-UNI_DECLARE_CAUSE_VALUES
-
-#undef D
-#undef N
-
-};
-
-enum uni_diag
-uni_diag(enum uni_cause cause, enum uni_coding code)
-{
- if ((int)cause >= 128)
- return (UNI_DIAG_NONE);
-
- if (code == UNI_CODING_NET)
- if (net_causes[cause].str != NULL)
- return (net_causes[cause].diag);
- if (itu_causes[cause].str != NULL)
- return (itu_causes[cause].diag);
- return (UNI_DIAG_NONE);
-}
-
-/**********************************************************************/
-
-static void
-print_cause(struct unicx *cx, struct uni_ie_cause *ie,
- const struct causetab *tab1, const struct causetab *tab2)
-{
- static const struct uni_print_tbl loc_tbl[] = {
- MKT(UNI_CAUSE_LOC_USER, user),
- MKT(UNI_CAUSE_LOC_PRIVLOC, priv-net:loc-user),
- MKT(UNI_CAUSE_LOC_PUBLOC, pub-net:loc-user),
- MKT(UNI_CAUSE_LOC_TRANSIT, transit-net),
- MKT(UNI_CAUSE_LOC_PUBREM, pub-net:rem-user),
- MKT(UNI_CAUSE_LOC_PRIVREM, priv-net:rem-user),
- MKT(UNI_CAUSE_LOC_INTERNAT, int-net),
- MKT(UNI_CAUSE_LOC_BEYOND, beyond),
- EOT()
- };
- static const struct uni_print_tbl pu_tbl[] = {
- MKT(UNI_CAUSE_PU_PROVIDER, provider),
- MKT(UNI_CAUSE_PU_USER, user),
- EOT()
- };
- static const struct uni_print_tbl na_tbl[] = {
- MKT(UNI_CAUSE_NA_NORMAL, normal),
- MKT(UNI_CAUSE_NA_ABNORMAL, abnormal),
- EOT()
- };
- static const struct uni_print_tbl cond_tbl[] = {
- MKT(UNI_CAUSE_COND_UNKNOWN, unknown),
- MKT(UNI_CAUSE_COND_PERM, permanent),
- MKT(UNI_CAUSE_COND_TRANS, transient),
- EOT()
- };
- static const struct uni_print_tbl rej_tbl[] = {
- MKT(UNI_CAUSE_REASON_USER, user),
- MKT(UNI_CAUSE_REASON_IEMISS, ie-missing),
- MKT(UNI_CAUSE_REASON_IESUFF, ie-not-suff),
- EOT()
- };
- char buf[100], *s;
- u_int i;
-
- if (uni_print_iehdr("cause", &ie->h, cx))
- return;
-
- if ((int)ie->cause < 128 && tab1[ie->cause].str)
- strcpy(buf, tab1[ie->cause].str);
- else if ((int)ie->cause < 128 && tab2 != NULL && tab2[ie->cause].str != NULL)
- strcpy(buf, tab2[ie->cause].str);
- else {
- sprintf(buf, "UNKNOWN-%u", ie->cause);
- }
-
- for (s = buf; *s != '\0'; s++)
- if (*s == ' ')
- *s = '_';
- uni_print_entry(cx, "cause", "%s", buf);
-
- uni_print_tbl("loc", ie->loc, loc_tbl, cx);
-
- if (ie->h.present & UNI_CAUSE_COND_P) {
- uni_print_tbl("pu", ie->u.cond.pu, pu_tbl, cx);
- uni_print_tbl("na", ie->u.cond.na, na_tbl, cx);
- uni_print_tbl("condition", ie->u.cond.cond, cond_tbl, cx);
- }
- if (ie->h.present & UNI_CAUSE_REJ_P) {
- uni_print_tbl("reject", ie->u.rej.reason, rej_tbl, cx);
- }
- if (ie->h.present & UNI_CAUSE_REJ_USER_P) {
- uni_print_entry(cx, "user", "%u", ie->u.rej.user);
- }
- if (ie->h.present & UNI_CAUSE_REJ_IE_P) {
- uni_print_entry(cx, "ie", "%u", ie->u.rej.ie);
- }
- if (ie->h.present & UNI_CAUSE_IE_P) {
- uni_print_entry(cx, "ie", "(");
- for (i = 0; i < ie->u.ie.len; i++) {
- if (i)
- uni_putc(',', cx);
- uni_printf(cx, "0x%02x", ie->u.ie.ie[i]);
- }
- uni_putc(')', cx);
- }
- if (ie->h.present & UNI_CAUSE_TRAFFIC_P) {
- uni_print_entry(cx, "traffic", "(");
- for (i = 0; i < ie->u.traffic.len; i++) {
- if (i)
- uni_putc(',', cx);
- uni_printf(cx, "0x%02x", ie->u.traffic.traffic[i]);
- }
- uni_putc(')', cx);
- }
- if (ie->h.present & UNI_CAUSE_VPCI_P) {
- uni_print_entry(cx, "vpci", "(%u,%u)", ie->u.vpci.vpci, ie->u.vpci.vci);
- }
- if (ie->h.present & UNI_CAUSE_MTYPE_P) {
- uni_print_entry(cx, "mtype", "%u", ie->u.mtype);
- }
- if (ie->h.present & UNI_CAUSE_TIMER_P) {
- for (i = 0, s = buf; i < 3; i++) {
- if (ie->u.timer[i] < ' ') {
- *s++ = '^';
- *s++ = ie->u.timer[i] + '@';
- } else if (ie->u.timer[i] <= '~')
- *s++ = ie->u.timer[i];
- else {
- *s++ = '\\';
- *s++ = ie->u.timer[i] / 0100 + '0';
- *s++ = (ie->u.timer[i] % 0100) / 010 + '0';
- *s++ = ie->u.timer[i] % 010 + '0';
- }
- }
- *s++ = '\0';
- uni_print_entry(cx, "timer", "\"%s\"", buf);
- }
- if (ie->h.present & UNI_CAUSE_TNS_P) {
- uni_print_eol(cx);
- uni_print_ie_internal(UNI_IE_TNS, (union uni_ieall *)&ie->u.tns, cx);
- }
- if (ie->h.present & UNI_CAUSE_NUMBER_P) {
- uni_print_eol(cx);
- uni_print_ie_internal(UNI_IE_CALLED, (union uni_ieall *)&ie->u.number, cx);
- }
- if (ie->h.present & UNI_CAUSE_ATTR_P) {
- uni_print_entry(cx, "attr", "(");
- for (i = 0; i < ie->u.attr.nattr; i++) {
- uni_printf(cx, "(%u", ie->u.attr.attr[i][0]);
- if (!(ie->u.attr.attr[i][0] & 0x80)) {
- uni_printf(cx, ",%u", ie->u.attr.attr[i][1]);
- if (!(ie->u.attr.attr[i][1] & 0x80))
- uni_printf(cx, ",%u",
- ie->u.attr.attr[i][2]);
- }
- uni_putc(')', cx);
- }
- }
-
- uni_print_ieend(cx);
-}
-
-DEF_IE_PRINT(itu, cause)
-{
- print_cause(cx, ie, itu_causes, NULL);
-}
-DEF_IE_PRINT(net, cause)
-{
- print_cause(cx, ie, net_causes, itu_causes);
-}
-
-const char *
-uni_ie_cause2str(enum uni_coding coding, u_int cause)
-{
- if (cause < 128) {
- if (coding == UNI_CODING_ITU)
- return (itu_causes[cause].str);
- if (coding == UNI_CODING_NET) {
- if (net_causes[cause].str != NULL)
- return (net_causes[cause].str);
- return (itu_causes[cause].str);
- }
- }
- return (NULL);
-}
-
-/**********************************************************************/
-
-static int
-check_cause(struct uni_ie_cause *ie, struct unicx *cx,
- const struct causetab *tab1, const struct causetab *tab2)
-{
- static const u_int mask =
- UNI_CAUSE_COND_P | UNI_CAUSE_REJ_P | UNI_CAUSE_REJ_USER_P |
- UNI_CAUSE_REJ_IE_P | UNI_CAUSE_IE_P | UNI_CAUSE_TRAFFIC_P |
- UNI_CAUSE_VPCI_P | UNI_CAUSE_MTYPE_P | UNI_CAUSE_TIMER_P |
- UNI_CAUSE_TNS_P | UNI_CAUSE_NUMBER_P | UNI_CAUSE_ATTR_P |
- UNI_CAUSE_PARAM_P;
-
- const struct causetab *ptr;
-
- if ((int)ie->cause >= 128)
- return (-1);
-
- switch (ie->loc) {
- default:
- return (-1);
-
- case UNI_CAUSE_LOC_USER:
- case UNI_CAUSE_LOC_PRIVLOC:
- case UNI_CAUSE_LOC_PUBLOC:
- case UNI_CAUSE_LOC_TRANSIT:
- case UNI_CAUSE_LOC_PUBREM:
- case UNI_CAUSE_LOC_PRIVREM:
- case UNI_CAUSE_LOC_INTERNAT:
- case UNI_CAUSE_LOC_BEYOND:
- break;
- }
-
- if (tab1[ie->cause].str != NULL)
- ptr = &tab1[ie->cause];
- else if (tab2 != NULL && tab2[ie->cause].str != NULL)
- ptr = &tab2[ie->cause];
- else
- return (cx->cause_hard ? -1 : 0);
-
- switch (ptr->diag) {
-
- case UNI_DIAG_NONE:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- break;
- }
- break;
-
- case UNI_DIAG_COND:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_COND_P:
- break;
- }
- break;
-
- case UNI_DIAG_REJ:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_REJ_P:
- case UNI_CAUSE_REJ_P | UNI_CAUSE_REJ_USER_P:
- case UNI_CAUSE_REJ_P | UNI_CAUSE_REJ_IE_P:
- break;
- }
- break;
-
- case UNI_DIAG_CRATE:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_TRAFFIC_P:
- break;
- }
- break;
-
- case UNI_DIAG_IE:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_IE_P:
- break;
- }
- break;
-
- case UNI_DIAG_CHANID:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_VPCI_P:
- break;
- }
- break;
-
- case UNI_DIAG_MTYPE:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_MTYPE_P:
- break;
- }
- break;
-
- case UNI_DIAG_TIMER:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_TIMER_P:
- break;
- }
- break;
-
- case UNI_DIAG_TNS:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_TNS_P:
- break;
- }
- break;
-
- case UNI_DIAG_NUMBER:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_NUMBER_P:
- break;
- }
- break;
-
- case UNI_DIAG_ATTR:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_ATTR_P:
- break;
- }
- break;
-
- case UNI_DIAG_PARAM:
- switch (ie->h.present & mask) {
- default:
- if (cx->cause_hard)
- return (-1);
- break;
-
- case 0:
- case UNI_CAUSE_PARAM_P:
- break;
- }
- break;
- }
-
- if (ie->h.present & UNI_CAUSE_COND_P) {
- switch (ie->u.cond.pu) {
- default:
- return (-1);
-
- case UNI_CAUSE_PU_PROVIDER:
- case UNI_CAUSE_PU_USER:
- break;
- }
- switch (ie->u.cond.na) {
- default:
- return (-1);
-
- case UNI_CAUSE_NA_NORMAL:
- case UNI_CAUSE_NA_ABNORMAL:
- break;
- }
- switch (ie->u.cond.cond) {
- default:
- return (-1);
-
- case UNI_CAUSE_COND_UNKNOWN:
- case UNI_CAUSE_COND_PERM:
- case UNI_CAUSE_COND_TRANS:
- break;
- }
- }
- if (ie->h.present & UNI_CAUSE_REJ_P) {
- switch (ie->u.rej.reason) {
- default:
- return (-1);
-
- case UNI_CAUSE_REASON_USER:
- switch (ie->h.present & mask) {
- default:
- return (-1);
-
- case UNI_CAUSE_REJ_P:
- case UNI_CAUSE_REJ_P | UNI_CAUSE_REJ_USER_P:
- break;
- }
- break;
-
- case UNI_CAUSE_REASON_IEMISS:
- case UNI_CAUSE_REASON_IESUFF:
- switch (ie->h.present & mask) {
- default:
- return (-1);
-
- case UNI_CAUSE_REJ_P:
- case UNI_CAUSE_REJ_P | UNI_CAUSE_REJ_IE_P:
- break;
- }
- break;
- }
- }
- if (ie->h.present & UNI_CAUSE_IE_P) {
- if (ie->u.ie.len == 0 || ie->u.ie.len > UNI_CAUSE_IE_N)
- return (-1);
- }
- if (ie->h.present & UNI_CAUSE_TRAFFIC_P) {
- if (ie->u.traffic.len == 0 ||
- ie->u.traffic.len > UNI_CAUSE_TRAFFIC_N)
- return (-1);
- }
-
- if (ie->h.present & UNI_CAUSE_TNS_P) {
- if (uni_check_ie(UNI_IE_TNS, (union uni_ieall *)&ie->u.tns, cx))
- return (-1);
- }
- if (ie->h.present & UNI_CAUSE_NUMBER_P) {
- if(uni_check_ie(UNI_IE_CALLED, (union uni_ieall *)&ie->u.number, cx))
- return (-1);
- }
- if (ie->h.present & UNI_CAUSE_ATTR_P) {
- if(ie->u.attr.nattr > UNI_CAUSE_ATTR_N || ie->u.attr.nattr == 0)
- return (-1);
- }
- if (ie->h.present & UNI_CAUSE_PARAM_P) {
- UNUSED(cx);
- }
-
- return (0);
-}
-
-DEF_IE_CHECK(itu, cause)
-{
- return (check_cause(ie, cx, itu_causes, NULL));
-}
-DEF_IE_CHECK(net, cause)
-{
- return (check_cause(ie, cx, net_causes, itu_causes));
-}
-/**********************************************************************/
-
-static int
-encode_cause(struct uni_msg *msg, struct uni_ie_cause *ie, struct unicx *cx)
-{
- u_int i;
-
- START_IE(cause, UNI_IE_CAUSE, 30);
-
- if (IE_ISERROR(*ie)) {
- APP_BYTE(msg, 0x00 | ie->loc);
- } else {
- APP_BYTE(msg, 0x80 | ie->loc);
- }
- APP_BYTE(msg, 0x80 | ie->cause);
-
- if (ie->h.present & UNI_CAUSE_COND_P)
- APP_BYTE(msg, 0x80 | (ie->u.cond.pu << 3) |
- (ie->u.cond.na << 2) | ie->u.cond.cond);
-
- else if (ie->h.present & UNI_CAUSE_REJ_P) {
- APP_BYTE(msg, 0x80 | (ie->u.rej.reason << 2) | ie->u.rej.cond);
- if (ie->h.present & UNI_CAUSE_REJ_USER_P)
- APP_BYTE(msg, ie->u.rej.user);
- else if (ie->h.present & UNI_CAUSE_REJ_IE_P)
- APP_BYTE(msg, ie->u.rej.ie);
-
- } else if(ie->h.present & UNI_CAUSE_IE_P)
- APP_BUF(msg, ie->u.ie.ie, ie->u.ie.len);
-
- else if (ie->h.present & UNI_CAUSE_TRAFFIC_P)
- APP_BUF(msg, ie->u.traffic.traffic, ie->u.traffic.len);
-
- else if (ie->h.present & UNI_CAUSE_VPCI_P) {
- APP_BYTE(msg, (ie->u.vpci.vpci >> 8));
- APP_BYTE(msg, (ie->u.vpci.vpci >> 0));
- APP_BYTE(msg, (ie->u.vpci.vci >> 8));
- APP_BYTE(msg, (ie->u.vpci.vci >> 0));
-
- } else if (ie->h.present & UNI_CAUSE_MTYPE_P)
- APP_BYTE(msg, ie->u.mtype);
-
- else if (ie->h.present & UNI_CAUSE_TIMER_P) {
- APP_BYTE(msg, ie->u.timer[0]);
- APP_BYTE(msg, ie->u.timer[1]);
- APP_BYTE(msg, ie->u.timer[2]);
-
- } else if (ie->h.present & UNI_CAUSE_TNS_P)
- uni_encode_ie(UNI_IE_TNS, msg,
- (union uni_ieall *)&ie->u.tns, cx);
-
- else if (ie->h.present & UNI_CAUSE_NUMBER_P)
- uni_encode_ie(UNI_IE_CALLED, msg,
- (union uni_ieall *)&ie->u.number, cx);
-
- else if (ie->h.present & UNI_CAUSE_ATTR_P) {
- for (i = 0; i < ie->u.attr.nattr; i++) {
- APP_BYTE(msg, ie->u.attr.attr[i][0]);
- if (!ie->u.attr.attr[i][0]) {
- APP_BYTE(msg, ie->u.attr.attr[i][1]);
- if (!ie->u.attr.attr[i][1])
- APP_BYTE(msg, ie->u.attr.attr[i][2]);
- }
- }
- } else if (ie->h.present & UNI_CAUSE_PARAM_P)
- APP_BYTE(msg, ie->u.param);
-
- SET_IE_LEN(msg);
-
- return (0);
-}
-
-DEF_IE_ENCODE(itu, cause)
-{
- return encode_cause(msg, ie, cx);
-}
-DEF_IE_ENCODE(net, cause)
-{
- return encode_cause(msg, ie, cx);
-}
-
-/**********************************************************************/
-
-static int
-decode_cause(struct uni_ie_cause *ie, struct uni_msg *msg, u_int ielen,
- struct unicx *cx, const struct causetab *tab1, const struct causetab *tab2)
-{
- u_char c;
- const struct causetab *ptr;
- enum uni_ietype ietype;
- u_int xielen;
-
- IE_START(;);
-
- if(ielen < 2 || ielen > 30)
- goto rej;
-
- c = *msg->b_rptr++;
- ielen--;
- if(!(c & 0x80))
- goto rej;
- ie->loc = c & 0xf;
-
- c = *msg->b_rptr++;
- ielen--;
- if(!(c & 0x80))
- goto rej;
- ie->cause = c & 0x7f;
-
- if(tab1[ie->cause].str != NULL)
- ptr = &tab1[ie->cause];
- else if(tab2 != NULL && tab2[ie->cause].str != NULL)
- ptr = &tab2[ie->cause];
- else {
- ptr = NULL;
- ielen = 0; /* ignore diags */
- }
-
- if(ielen) {
- switch(ptr->diag) {
-
- case UNI_DIAG_NONE:
- break;
-
- case UNI_DIAG_COND:
- if(ielen < 1)
- goto rej;
- c = *msg->b_rptr++;
- ielen--;
-
- ie->h.present |= UNI_CAUSE_COND_P;
- ie->u.cond.pu = (c >> 3) & 1;
- ie->u.cond.na = (c >> 2) & 1;
- ie->u.cond.cond = c & 3;
-
- if(!(c & 0x80))
- goto rej;
- break;
-
- case UNI_DIAG_REJ:
- if(ielen < 1)
- goto rej;
- c = *msg->b_rptr++;
- ielen--;
-
- ie->h.present |= UNI_CAUSE_REJ_P;
- ie->u.rej.reason = (c >> 2) & 0x1f;
- ie->u.rej.cond = c & 3;
-
- if(!(c & 0x80))
- goto rej;
-
- if(ielen > 0) {
- c = *msg->b_rptr++;
- ielen--;
-
- switch(ie->u.rej.reason) {
-
- case UNI_CAUSE_REASON_USER:
- ie->h.present |= UNI_CAUSE_REJ_USER_P;
- ie->u.rej.user = c;
- break;
-
- case UNI_CAUSE_REASON_IEMISS:
- case UNI_CAUSE_REASON_IESUFF:
- ie->h.present |= UNI_CAUSE_REJ_IE_P;
- ie->u.rej.ie = c;
- break;
- }
- }
- break;
-
- case UNI_DIAG_CRATE:
- ie->h.present |= UNI_CAUSE_TRAFFIC_P;
- while(ielen && ie->u.traffic.len < UNI_CAUSE_TRAFFIC_N) {
- ie->u.traffic.traffic[ie->u.traffic.len++] =
- *msg->b_rptr++;
- ielen--;
- }
- break;
-
- case UNI_DIAG_IE:
- ie->h.present |= UNI_CAUSE_IE_P;
- while(ielen && ie->u.ie.len < UNI_CAUSE_IE_N) {
- ie->u.ie.ie[ie->u.ie.len++] = *msg->b_rptr++;
- ielen--;
- }
- break;
-
- case UNI_DIAG_CHANID:
- if(ielen < 4)
- break;
- ie->h.present |= UNI_CAUSE_VPCI_P;
- ie->u.vpci.vpci = *msg->b_rptr++ << 8;
- ie->u.vpci.vpci |= *msg->b_rptr++;
- ie->u.vpci.vci = *msg->b_rptr++ << 8;
- ie->u.vpci.vci |= *msg->b_rptr++;
- ielen -= 4;
- break;
-
- case UNI_DIAG_MTYPE:
- ie->h.present |= UNI_CAUSE_MTYPE_P;
- ie->u.mtype = *msg->b_rptr++;
- ielen--;
- break;
-
- case UNI_DIAG_TIMER:
- if(ielen < 3)
- break;
- ie->h.present |= UNI_CAUSE_TIMER_P;
- ie->u.timer[0] = *msg->b_rptr++;
- ie->u.timer[1] = *msg->b_rptr++;
- ie->u.timer[2] = *msg->b_rptr++;
- ielen -= 3;
- break;
-
- case UNI_DIAG_TNS:
- if(ielen < 4)
- break;
- if(uni_decode_ie_hdr(&ietype, &ie->u.tns.h, msg, cx, &xielen))
- break;
- if(ietype != UNI_IE_TNS)
- break;
- if(uni_decode_ie_body(ietype,
- (union uni_ieall *)&ie->u.tns, msg, xielen, cx))
- break;
- ie->h.present |= UNI_CAUSE_TNS_P;
- break;
-
- case UNI_DIAG_NUMBER:
- if(ielen < 4)
- break;
- if(uni_decode_ie_hdr(&ietype, &ie->u.number.h, msg, cx, &xielen))
- break;
- if(ietype != UNI_IE_CALLED)
- break;
- if(uni_decode_ie_body(ietype,
- (union uni_ieall *)&ie->u.number, msg, xielen, cx))
- break;
- ie->h.present |= UNI_CAUSE_NUMBER_P;
- break;
-
- case UNI_DIAG_ATTR:
- ie->h.present |= UNI_CAUSE_ATTR_P;
- while(ielen > 0 && ie->u.attr.nattr < UNI_CAUSE_ATTR_N) {
- c = *msg->b_rptr++;
- ie->u.attr.attr[ie->u.attr.nattr][0] = c;
- ielen--;
- if(ielen > 0 && !(c & 0x80)) {
- c = *msg->b_rptr++;
- ie->u.attr.attr[ie->u.attr.nattr][1] = c;
- ielen--;
- if(ielen > 0 && !(c & 0x80)) {
- c = *msg->b_rptr++;
- ie->u.attr.attr[ie->u.attr.nattr][2] = c;
- ielen--;
- }
- }
- }
- break;
-
- case UNI_DIAG_PARAM:
- ie->h.present |= UNI_CAUSE_PARAM_P;
- ie->u.param = *msg->b_rptr++;
- ielen--;
- break;
- }
- }
-
- IE_END(CAUSE);
-}
-
-DEF_IE_DECODE(itu, cause)
-{
- return decode_cause(ie, msg, ielen, cx, itu_causes, NULL);
-}
-DEF_IE_DECODE(net, cause)
-{
- return decode_cause(ie, msg, ielen, cx, net_causes, itu_causes);
-}
-
-/*********************************************************************
- *
- * Callstate
- *
- * References for this IE are:
- *
- * Q.2931 pp. 59...60
- * UNI4.0 pp. 14
- *
- * Only ITU-T coding allowed.
- */
-DEF_IE_PRINT(itu, callstate)
-{
- static const struct uni_print_tbl tbl[] = {
- MKT(UNI_CALLSTATE_U0, U0/N0/REST0),
- MKT(UNI_CALLSTATE_U1, U1/N1),
- MKT(UNI_CALLSTATE_U3, U3/N3),
- MKT(UNI_CALLSTATE_U4, U4/N4),
- MKT(UNI_CALLSTATE_U6, U6/N6),
- MKT(UNI_CALLSTATE_U7, U7/N7),
- MKT(UNI_CALLSTATE_U8, U8/N8),
- MKT(UNI_CALLSTATE_U9, U9/N9),
- MKT(UNI_CALLSTATE_U10, U10/N10),
- MKT(UNI_CALLSTATE_U11, U11/N11),
- MKT(UNI_CALLSTATE_U12, U12/N12),
- MKT(UNI_CALLSTATE_REST1,REST1),
- MKT(UNI_CALLSTATE_REST2,REST2),
- MKT(UNI_CALLSTATE_U13, U13/N13),
- MKT(UNI_CALLSTATE_U14, U14/N14),
- EOT()
- };
-
- if(uni_print_iehdr("callstate", &ie->h, cx))
- return;
- uni_print_tbl("state", ie->state, tbl, cx);
- uni_print_ieend(cx);
-}
-
-DEF_IE_CHECK(itu, callstate)
-{
- UNUSED(cx);
-
- switch(ie->state) {
- default:
- return -1;
-
- case UNI_CALLSTATE_U0:
- case UNI_CALLSTATE_U1:
- case UNI_CALLSTATE_U3:
- case UNI_CALLSTATE_U4:
- case UNI_CALLSTATE_U6:
- case UNI_CALLSTATE_U7:
- case UNI_CALLSTATE_U8:
- case UNI_CALLSTATE_U9:
- case UNI_CALLSTATE_U10:
- case UNI_CALLSTATE_U11:
- case UNI_CALLSTATE_U12:
- case UNI_CALLSTATE_REST1:
- case UNI_CALLSTATE_REST2:
- case UNI_CALLSTATE_U13:
- case UNI_CALLSTATE_U14:
- break;
- }
-
- return 0;
-}
-
-DEF_IE_ENCODE(itu, callstate)
-{
- START_IE(callstate, UNI_IE_CALLSTATE, 1);
-
- APP_BYTE(msg, ie->state);
-
- SET_IE_LEN(msg);
- return 0;
-}
-
-DEF_IE_DECODE(itu, callstate)
-{
- IE_START(;);
-
- if(ielen != 1)
- goto rej;
-
- ie->state = *msg->b_rptr++ & 0x3f;
- ielen--;
-
- IE_END(CALLSTATE);
-}
-
-/*********************************************************************
- *
- * Facility Information.
- *
- * References for this IE are:
- *
- * Q.2932.1
- *
- * The standard allows only ROSE as protocol. We allow everything up to the
- * maximum size.
- *
- * Only ITU-T coding allowed.
- */
-DEF_IE_PRINT(itu, facility)
-{
- u_int i;
-
- if(uni_print_iehdr("facility", &ie->h, cx))
- return;
-
- if(ie->proto == UNI_FACILITY_ROSE)
- uni_print_entry(cx, "proto", "rose");
- else
- uni_print_entry(cx, "proto", "0x%02x", ie->proto);
-
- uni_print_entry(cx, "len", "%u", ie->len);
- uni_print_entry(cx, "info", "(");
- for(i = 0; i < ie->len; i++)
- uni_printf(cx, "%s0x%02x", i == 0 ? "" : " ", ie->apdu[i]);
- uni_printf(cx, ")");
-
- uni_print_ieend(cx);
-}
-
-DEF_IE_CHECK(itu, facility)
-{
- UNUSED(cx);
-
- if(ie->len > UNI_FACILITY_MAXAPDU)
- return -1;
-
- return 0;
-}
-
-DEF_IE_ENCODE(itu, facility)
-{
- START_IE(facility, UNI_IE_FACILITY, 1 + ie->len);
-
- APP_BYTE(msg, ie->proto | 0x80);
- APP_BUF(msg, ie->apdu, ie->len);
-
- SET_IE_LEN(msg);
- return 0;
-}
-
-DEF_IE_DECODE(itu, facility)
-{
- u_char c;
-
- IE_START(;);
-
- if(ielen > UNI_FACILITY_MAXAPDU + 1 || ielen < 1)
- goto rej;
-
- ie->proto = (c = *msg->b_rptr++) & 0x1f;
- ielen--;
- if((c & 0xe0) != 0x80)
- goto rej;
-
- ie->len = ielen;
- ielen = 0;
- (void)memcpy(ie->apdu, msg->b_rptr, ie->len);
- msg->b_rptr += ie->len;
-
- IE_END(FACILITY);
-}
-
-/*********************************************************************
- *
- * Notification Indicator
- *
- * References for this IE are:
- *
- * Q.2931 p. 76
- * UNI4.0 p. 17
- *
- *