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
This commit is contained in:
parent
b2654064c2
commit
af0cc0b223
@ -52,6 +52,49 @@
|
|||||||
# xargs -n1 | sort | uniq -d;
|
# xargs -n1 | sort | uniq -d;
|
||||||
# done
|
# 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
|
# 20230308: machine-id merged into hostid_save
|
||||||
OLD_FILES+=etc/rc.d/machine-id
|
OLD_FILES+=etc/rc.d/machine-id
|
||||||
|
|
||||||
|
@ -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
|
|
@ -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
|
|
@ -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)
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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); \
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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 *);
|
|
@ -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
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
))
|
|
@ -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
|
|
@ -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);
|
|
||||||
}
|
|
@ -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
|
|
@ -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);
|
|
||||||
}
|
|
@ -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_ */
|
|
@ -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
|
|
@ -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(¶m, 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(¶m, &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, ¶m, &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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -287,16 +287,6 @@
|
|||||||
..
|
..
|
||||||
netipsec
|
netipsec
|
||||||
..
|
..
|
||||||
netnatm
|
|
||||||
api
|
|
||||||
..
|
|
||||||
msg
|
|
||||||
..
|
|
||||||
saal
|
|
||||||
..
|
|
||||||
sig
|
|
||||||
..
|
|
||||||
..
|
|
||||||
netpfil
|
netpfil
|
||||||
pf
|
pf
|
||||||
..
|
..
|
||||||
|
@ -153,7 +153,6 @@ SUBDIR_DEPEND_flua= libjail
|
|||||||
|
|
||||||
# NB: keep these sorted by MK_* knobs
|
# NB: keep these sorted by MK_* knobs
|
||||||
|
|
||||||
SUBDIR.${MK_ATM}+= libngatm
|
|
||||||
SUBDIR.${MK_BEARSSL}+= libbearssl libsecureboot
|
SUBDIR.${MK_BEARSSL}+= libbearssl libsecureboot
|
||||||
SUBDIR.${MK_BLACKLIST}+=libblacklist
|
SUBDIR.${MK_BLACKLIST}+=libblacklist
|
||||||
SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp
|
SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp
|
||||||
|
@ -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>
|
|
@ -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
|
|
@ -344,13 +344,11 @@ MAN= aac.4 \
|
|||||||
${_nfe.4} \
|
${_nfe.4} \
|
||||||
${_nfsmb.4} \
|
${_nfsmb.4} \
|
||||||
ng_async.4 \
|
ng_async.4 \
|
||||||
ngatmbase.4 \
|
|
||||||
ng_atmllc.4 \
|
ng_atmllc.4 \
|
||||||
ng_bpf.4 \
|
ng_bpf.4 \
|
||||||
ng_bridge.4 \
|
ng_bridge.4 \
|
||||||
ng_btsocket.4 \
|
ng_btsocket.4 \
|
||||||
ng_car.4 \
|
ng_car.4 \
|
||||||
ng_ccatm.4 \
|
|
||||||
ng_checksum.4 \
|
ng_checksum.4 \
|
||||||
ng_cisco.4 \
|
ng_cisco.4 \
|
||||||
ng_deflate.4 \
|
ng_deflate.4 \
|
||||||
@ -389,15 +387,12 @@ MAN= aac.4 \
|
|||||||
ng_socket.4 \
|
ng_socket.4 \
|
||||||
ng_source.4 \
|
ng_source.4 \
|
||||||
ng_split.4 \
|
ng_split.4 \
|
||||||
ng_sscfu.4 \
|
|
||||||
ng_sscop.4 \
|
|
||||||
ng_tag.4 \
|
ng_tag.4 \
|
||||||
ng_tcpmss.4 \
|
ng_tcpmss.4 \
|
||||||
ng_tee.4 \
|
ng_tee.4 \
|
||||||
ng_tty.4 \
|
ng_tty.4 \
|
||||||
ng_ubt.4 \
|
ng_ubt.4 \
|
||||||
ng_UI.4 \
|
ng_UI.4 \
|
||||||
ng_uni.4 \
|
|
||||||
ng_vjc.4 \
|
ng_vjc.4 \
|
||||||
ng_vlan.4 \
|
ng_vlan.4 \
|
||||||
ng_vlan_rotate.4 \
|
ng_vlan_rotate.4 \
|
||||||
|
@ -1453,13 +1453,10 @@ common networking problems, solved using
|
|||||||
.Xr ng_rfc1490 4 ,
|
.Xr ng_rfc1490 4 ,
|
||||||
.Xr ng_socket 4 ,
|
.Xr ng_socket 4 ,
|
||||||
.Xr ng_split 4 ,
|
.Xr ng_split 4 ,
|
||||||
.Xr ng_sscfu 4 ,
|
|
||||||
.Xr ng_sscop 4 ,
|
|
||||||
.Xr ng_tee 4 ,
|
.Xr ng_tee 4 ,
|
||||||
.Xr ng_tty 4 ,
|
.Xr ng_tty 4 ,
|
||||||
.Xr ng_ubt 4 ,
|
.Xr ng_ubt 4 ,
|
||||||
.Xr ng_UI 4 ,
|
.Xr ng_UI 4 ,
|
||||||
.Xr ng_uni 4 ,
|
|
||||||
.Xr ng_vjc 4 ,
|
.Xr ng_vjc 4 ,
|
||||||
.Xr ng_vlan 4 ,
|
.Xr ng_vlan 4 ,
|
||||||
.Xr ngctl 8 ,
|
.Xr ngctl 8 ,
|
||||||
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -841,13 +841,6 @@ options NETGRAPH_UI
|
|||||||
options NETGRAPH_VJC
|
options NETGRAPH_VJC
|
||||||
options NETGRAPH_VLAN
|
options NETGRAPH_VLAN
|
||||||
|
|
||||||
# NgATM - Netgraph ATM
|
|
||||||
options NGATM_ATMBASE
|
|
||||||
options NGATM_SSCOP
|
|
||||||
options NGATM_SSCFU
|
|
||||||
options NGATM_UNI
|
|
||||||
options NGATM_CCATM
|
|
||||||
|
|
||||||
# Network stack virtualization.
|
# Network stack virtualization.
|
||||||
options VIMAGE
|
options VIMAGE
|
||||||
options VNET_DEBUG # debug for VIMAGE
|
options VNET_DEBUG # debug for VIMAGE
|
||||||
|
@ -633,50 +633,6 @@ contrib/libnv/cnvlist.c standard
|
|||||||
contrib/libnv/dnvlist.c standard
|
contrib/libnv/dnvlist.c standard
|
||||||
contrib/libnv/nvlist.c standard
|
contrib/libnv/nvlist.c standard
|
||||||
contrib/libnv/bsd_nvpair.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
|
# xz
|
||||||
dev/xz/xz_mod.c optional 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/"
|
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_wds.c optional wlan
|
||||||
net80211/ieee80211_xauth.c optional wlan wlan_xauth
|
net80211/ieee80211_xauth.c optional wlan wlan_xauth
|
||||||
net80211/ieee80211_alq.c optional wlan ieee80211_alq
|
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/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.c optional netgraph_bluetooth_ubt usb
|
||||||
netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c optional netgraph_bluetooth_ubt usb
|
netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c optional netgraph_bluetooth_ubt usb
|
||||||
|
@ -563,13 +563,6 @@ NETGRAPH_UI opt_netgraph.h
|
|||||||
NETGRAPH_VJC opt_netgraph.h
|
NETGRAPH_VJC opt_netgraph.h
|
||||||
NETGRAPH_VLAN 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 options
|
||||||
DRM_DEBUG opt_drm.h
|
DRM_DEBUG opt_drm.h
|
||||||
|
|
||||||
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
File diff suppressed because it is too large
Load Diff
@ -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);
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -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
|
|
@ -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 *);
|
|
@ -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);
|
|
||||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
@ -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
|
|
||||||
}
|
|
@ -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 ";"
|
|
||||||
}
|
|
@ -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
|
|
||||||
}
|
|
@ -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 "};"
|
|
||||||
}
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
||||||
# }
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
@ -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
|
|
@ -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
|
|
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
|||||||
/* This file was created automatically
|
|
||||||
* Source file: $Begemot: libunimsg/atm/msg/ie.def,v 1.3 2003/09/19 11:58:15 hbb Exp $
|
|
||||||
* $FreeBSD$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _NETNATM_MSG_UNI_IE_H_
|
|
||||||
#define _NETNATM_MSG_UNI_IE_H_
|
|
||||||
|
|
||||||
union uni_ieall {
|
|
||||||
struct uni_iehdr h;
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
struct uni_ie_callstate callstate;
|
|
||||||
struct uni_ie_facility facility;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_eetd eetd;
|
|
||||||
struct uni_ie_conned conned;
|
|
||||||
struct uni_ie_connedsub connedsub;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_epstate epstate;
|
|
||||||
struct uni_ie_aal aal;
|
|
||||||
struct uni_ie_traffic traffic;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
struct uni_ie_qos qos;
|
|
||||||
struct uni_ie_bhli bhli;
|
|
||||||
struct uni_ie_bearer bearer;
|
|
||||||
struct uni_ie_blli blli;
|
|
||||||
struct uni_ie_lshift lshift;
|
|
||||||
struct uni_ie_nlshift nlshift;
|
|
||||||
struct uni_ie_scompl scompl;
|
|
||||||
struct uni_ie_repeat repeat;
|
|
||||||
struct uni_ie_calling calling;
|
|
||||||
struct uni_ie_callingsub callingsub;
|
|
||||||
struct uni_ie_called called;
|
|
||||||
struct uni_ie_calledsub calledsub;
|
|
||||||
struct uni_ie_tns tns;
|
|
||||||
struct uni_ie_restart restart;
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_git git;
|
|
||||||
struct uni_ie_mintraffic mintraffic;
|
|
||||||
struct uni_ie_atraffic atraffic;
|
|
||||||
struct uni_ie_abrsetup abrsetup;
|
|
||||||
struct uni_ie_report report;
|
|
||||||
struct uni_ie_called_soft called_soft;
|
|
||||||
struct uni_ie_crankback crankback;
|
|
||||||
struct uni_ie_dtl dtl;
|
|
||||||
struct uni_ie_calling_soft calling_soft;
|
|
||||||
struct uni_ie_abradd abradd;
|
|
||||||
struct uni_ie_lij_callid lij_callid;
|
|
||||||
struct uni_ie_lij_param lij_param;
|
|
||||||
struct uni_ie_lij_seqno lij_seqno;
|
|
||||||
struct uni_ie_cscope cscope;
|
|
||||||
struct uni_ie_exqos exqos;
|
|
||||||
struct uni_ie_mdcr mdcr;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,958 +0,0 @@
|
|||||||
/* This file was created automatically
|
|
||||||
* Source file: $Begemot: libunimsg/atm/msg/ie.def,v 1.3 2003/09/19 11:58:15 hbb Exp $
|
|
||||||
* $FreeBSD$
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_cause(struct uni_ie_cause *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_cause(struct uni_ie_cause *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_cause(struct uni_msg *, struct uni_ie_cause *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_cause(struct uni_ie_cause *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_cause = {
|
|
||||||
0,
|
|
||||||
34,
|
|
||||||
(uni_print_f)uni_ie_print_itu_cause,
|
|
||||||
(uni_check_f)uni_ie_check_itu_cause,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_cause,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_cause
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_cause(struct uni_ie_cause *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_cause(struct uni_ie_cause *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_cause(struct uni_msg *, struct uni_ie_cause *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_cause(struct uni_ie_cause *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_cause = {
|
|
||||||
0,
|
|
||||||
34,
|
|
||||||
(uni_print_f)uni_ie_print_net_cause,
|
|
||||||
(uni_check_f)uni_ie_check_net_cause,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_cause,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_cause
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_callstate(struct uni_ie_callstate *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_callstate(struct uni_ie_callstate *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_callstate(struct uni_msg *, struct uni_ie_callstate *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_callstate(struct uni_ie_callstate *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_callstate = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_itu_callstate,
|
|
||||||
(uni_check_f)uni_ie_check_itu_callstate,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_callstate,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_callstate
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_facility(struct uni_ie_facility *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_facility(struct uni_ie_facility *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_facility(struct uni_msg *, struct uni_ie_facility *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_facility(struct uni_ie_facility *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_facility = {
|
|
||||||
0,
|
|
||||||
UNI_FACILITY_MAXAPDU+1+4,
|
|
||||||
(uni_print_f)uni_ie_print_itu_facility,
|
|
||||||
(uni_check_f)uni_ie_check_itu_facility,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_facility,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_facility
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_notify(struct uni_ie_notify *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_notify(struct uni_ie_notify *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_notify(struct uni_msg *, struct uni_ie_notify *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_notify(struct uni_ie_notify *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_notify = {
|
|
||||||
0,
|
|
||||||
UNI_NOTIFY_MAXLEN+4,
|
|
||||||
(uni_print_f)uni_ie_print_itu_notify,
|
|
||||||
(uni_check_f)uni_ie_check_itu_notify,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_notify,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_notify
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_eetd(struct uni_ie_eetd *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_eetd(struct uni_ie_eetd *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_eetd(struct uni_msg *, struct uni_ie_eetd *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_eetd(struct uni_ie_eetd *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_eetd = {
|
|
||||||
0,
|
|
||||||
11,
|
|
||||||
(uni_print_f)uni_ie_print_itu_eetd,
|
|
||||||
(uni_check_f)uni_ie_check_itu_eetd,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_eetd,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_eetd
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_eetd(struct uni_ie_eetd *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_eetd(struct uni_ie_eetd *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_eetd(struct uni_msg *, struct uni_ie_eetd *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_eetd(struct uni_ie_eetd *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_eetd = {
|
|
||||||
0,
|
|
||||||
13,
|
|
||||||
(uni_print_f)uni_ie_print_net_eetd,
|
|
||||||
(uni_check_f)uni_ie_check_net_eetd,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_eetd,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_eetd
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_conned(struct uni_ie_conned *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_conned(struct uni_ie_conned *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_conned(struct uni_msg *, struct uni_ie_conned *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_conned(struct uni_ie_conned *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_conned = {
|
|
||||||
0,
|
|
||||||
25,
|
|
||||||
(uni_print_f)uni_ie_print_itu_conned,
|
|
||||||
(uni_check_f)uni_ie_check_itu_conned,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_conned,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_conned
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_connedsub(struct uni_ie_connedsub *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_connedsub(struct uni_ie_connedsub *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_connedsub(struct uni_msg *, struct uni_ie_connedsub *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_connedsub(struct uni_ie_connedsub *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_connedsub = {
|
|
||||||
UNIFL_ACCESS,
|
|
||||||
25,
|
|
||||||
(uni_print_f)uni_ie_print_itu_connedsub,
|
|
||||||
(uni_check_f)uni_ie_check_itu_connedsub,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_connedsub,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_connedsub
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_epref(struct uni_ie_epref *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_epref(struct uni_ie_epref *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_epref(struct uni_msg *, struct uni_ie_epref *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_epref(struct uni_ie_epref *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_epref = {
|
|
||||||
0,
|
|
||||||
7,
|
|
||||||
(uni_print_f)uni_ie_print_itu_epref,
|
|
||||||
(uni_check_f)uni_ie_check_itu_epref,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_epref,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_epref
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_epstate(struct uni_ie_epstate *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_epstate(struct uni_ie_epstate *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_epstate(struct uni_msg *, struct uni_ie_epstate *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_epstate(struct uni_ie_epstate *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_epstate = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_itu_epstate,
|
|
||||||
(uni_check_f)uni_ie_check_itu_epstate,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_epstate,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_epstate
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_aal(struct uni_ie_aal *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_aal(struct uni_ie_aal *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_aal(struct uni_msg *, struct uni_ie_aal *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_aal(struct uni_ie_aal *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_aal = {
|
|
||||||
UNIFL_ACCESS,
|
|
||||||
21,
|
|
||||||
(uni_print_f)uni_ie_print_itu_aal,
|
|
||||||
(uni_check_f)uni_ie_check_itu_aal,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_aal,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_aal
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_traffic(struct uni_ie_traffic *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_traffic(struct uni_ie_traffic *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_traffic(struct uni_msg *, struct uni_ie_traffic *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_traffic(struct uni_ie_traffic *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_traffic = {
|
|
||||||
0,
|
|
||||||
30,
|
|
||||||
(uni_print_f)uni_ie_print_itu_traffic,
|
|
||||||
(uni_check_f)uni_ie_check_itu_traffic,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_traffic,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_traffic
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct iedecl decl_net_traffic = {
|
|
||||||
UNIFL_DEFAULT,
|
|
||||||
0,
|
|
||||||
(uni_print_f)NULL,
|
|
||||||
(uni_check_f)NULL,
|
|
||||||
(uni_encode_f)NULL,
|
|
||||||
(uni_decode_f)NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_connid(struct uni_ie_connid *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_connid(struct uni_ie_connid *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_connid(struct uni_msg *, struct uni_ie_connid *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_connid(struct uni_ie_connid *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_connid = {
|
|
||||||
0,
|
|
||||||
9,
|
|
||||||
(uni_print_f)uni_ie_print_itu_connid,
|
|
||||||
(uni_check_f)uni_ie_check_itu_connid,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_connid,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_connid
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_qos(struct uni_ie_qos *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_qos(struct uni_ie_qos *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_qos(struct uni_msg *, struct uni_ie_qos *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_qos(struct uni_ie_qos *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_qos = {
|
|
||||||
0,
|
|
||||||
6,
|
|
||||||
(uni_print_f)uni_ie_print_itu_qos,
|
|
||||||
(uni_check_f)uni_ie_check_itu_qos,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_qos,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_qos
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_qos(struct uni_ie_qos *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_qos(struct uni_ie_qos *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_qos(struct uni_msg *, struct uni_ie_qos *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_qos(struct uni_ie_qos *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_qos = {
|
|
||||||
0,
|
|
||||||
6,
|
|
||||||
(uni_print_f)uni_ie_print_net_qos,
|
|
||||||
(uni_check_f)uni_ie_check_net_qos,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_qos,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_qos
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_bhli(struct uni_ie_bhli *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_bhli(struct uni_ie_bhli *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_bhli(struct uni_msg *, struct uni_ie_bhli *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_bhli(struct uni_ie_bhli *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_bhli = {
|
|
||||||
UNIFL_ACCESS,
|
|
||||||
13,
|
|
||||||
(uni_print_f)uni_ie_print_itu_bhli,
|
|
||||||
(uni_check_f)uni_ie_check_itu_bhli,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_bhli,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_bhli
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_bearer(struct uni_ie_bearer *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_bearer(struct uni_ie_bearer *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_bearer(struct uni_msg *, struct uni_ie_bearer *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_bearer(struct uni_ie_bearer *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_bearer = {
|
|
||||||
0,
|
|
||||||
7,
|
|
||||||
(uni_print_f)uni_ie_print_itu_bearer,
|
|
||||||
(uni_check_f)uni_ie_check_itu_bearer,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_bearer,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_bearer
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_blli(struct uni_ie_blli *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_blli(struct uni_ie_blli *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_blli(struct uni_msg *, struct uni_ie_blli *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_blli(struct uni_ie_blli *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_blli = {
|
|
||||||
UNIFL_ACCESS,
|
|
||||||
17,
|
|
||||||
(uni_print_f)uni_ie_print_itu_blli,
|
|
||||||
(uni_check_f)uni_ie_check_itu_blli,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_blli,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_blli
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_lshift(struct uni_ie_lshift *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_lshift(struct uni_ie_lshift *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_lshift(struct uni_msg *, struct uni_ie_lshift *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_lshift(struct uni_ie_lshift *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_lshift = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_itu_lshift,
|
|
||||||
(uni_check_f)uni_ie_check_itu_lshift,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_lshift,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_lshift
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_nlshift(struct uni_ie_nlshift *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_nlshift(struct uni_ie_nlshift *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_nlshift(struct uni_msg *, struct uni_ie_nlshift *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_nlshift(struct uni_ie_nlshift *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_nlshift = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_itu_nlshift,
|
|
||||||
(uni_check_f)uni_ie_check_itu_nlshift,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_nlshift,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_nlshift
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_scompl(struct uni_ie_scompl *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_scompl(struct uni_ie_scompl *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_scompl(struct uni_msg *, struct uni_ie_scompl *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_scompl(struct uni_ie_scompl *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_scompl = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_itu_scompl,
|
|
||||||
(uni_check_f)uni_ie_check_itu_scompl,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_scompl,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_scompl
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_repeat(struct uni_ie_repeat *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_repeat(struct uni_ie_repeat *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_repeat(struct uni_msg *, struct uni_ie_repeat *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_repeat(struct uni_ie_repeat *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_repeat = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_itu_repeat,
|
|
||||||
(uni_check_f)uni_ie_check_itu_repeat,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_repeat,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_repeat
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_calling(struct uni_ie_calling *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_calling(struct uni_ie_calling *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_calling(struct uni_msg *, struct uni_ie_calling *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_calling(struct uni_ie_calling *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_calling = {
|
|
||||||
0,
|
|
||||||
26,
|
|
||||||
(uni_print_f)uni_ie_print_itu_calling,
|
|
||||||
(uni_check_f)uni_ie_check_itu_calling,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_calling,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_calling
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_callingsub(struct uni_ie_callingsub *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_callingsub(struct uni_ie_callingsub *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_callingsub(struct uni_msg *, struct uni_ie_callingsub *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_callingsub(struct uni_ie_callingsub *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_callingsub = {
|
|
||||||
UNIFL_ACCESS,
|
|
||||||
25,
|
|
||||||
(uni_print_f)uni_ie_print_itu_callingsub,
|
|
||||||
(uni_check_f)uni_ie_check_itu_callingsub,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_callingsub,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_callingsub
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_called(struct uni_ie_called *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_called(struct uni_ie_called *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_called(struct uni_msg *, struct uni_ie_called *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_called(struct uni_ie_called *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_called = {
|
|
||||||
0,
|
|
||||||
25,
|
|
||||||
(uni_print_f)uni_ie_print_itu_called,
|
|
||||||
(uni_check_f)uni_ie_check_itu_called,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_called,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_called
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_calledsub(struct uni_ie_calledsub *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_calledsub(struct uni_ie_calledsub *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_calledsub(struct uni_msg *, struct uni_ie_calledsub *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_calledsub(struct uni_ie_calledsub *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_calledsub = {
|
|
||||||
UNIFL_ACCESS,
|
|
||||||
25,
|
|
||||||
(uni_print_f)uni_ie_print_itu_calledsub,
|
|
||||||
(uni_check_f)uni_ie_check_itu_calledsub,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_calledsub,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_calledsub
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_tns(struct uni_ie_tns *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_tns(struct uni_ie_tns *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_tns(struct uni_msg *, struct uni_ie_tns *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_tns(struct uni_ie_tns *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_tns = {
|
|
||||||
0,
|
|
||||||
9,
|
|
||||||
(uni_print_f)uni_ie_print_itu_tns,
|
|
||||||
(uni_check_f)uni_ie_check_itu_tns,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_tns,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_tns
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct iedecl decl_net_tns = {
|
|
||||||
UNIFL_DEFAULT,
|
|
||||||
0,
|
|
||||||
(uni_print_f)NULL,
|
|
||||||
(uni_check_f)NULL,
|
|
||||||
(uni_encode_f)NULL,
|
|
||||||
(uni_decode_f)NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_restart(struct uni_ie_restart *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_restart(struct uni_ie_restart *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_restart(struct uni_msg *, struct uni_ie_restart *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_restart(struct uni_ie_restart *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_restart = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_itu_restart,
|
|
||||||
(uni_check_f)uni_ie_check_itu_restart,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_restart,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_restart
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_uu(struct uni_ie_uu *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_uu(struct uni_ie_uu *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_uu(struct uni_msg *, struct uni_ie_uu *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_uu(struct uni_ie_uu *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_uu = {
|
|
||||||
UNIFL_ACCESS,
|
|
||||||
UNI_UU_MAXLEN+4,
|
|
||||||
(uni_print_f)uni_ie_print_itu_uu,
|
|
||||||
(uni_check_f)uni_ie_check_itu_uu,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_uu,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_uu
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_git(struct uni_ie_git *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_git(struct uni_ie_git *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_git(struct uni_msg *, struct uni_ie_git *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_git(struct uni_ie_git *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_git = {
|
|
||||||
0,
|
|
||||||
33,
|
|
||||||
(uni_print_f)uni_ie_print_net_git,
|
|
||||||
(uni_check_f)uni_ie_check_net_git,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_git,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_git
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_mintraffic(struct uni_ie_mintraffic *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_mintraffic(struct uni_ie_mintraffic *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_mintraffic(struct uni_msg *, struct uni_ie_mintraffic *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_mintraffic(struct uni_ie_mintraffic *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_mintraffic = {
|
|
||||||
0,
|
|
||||||
20,
|
|
||||||
(uni_print_f)uni_ie_print_itu_mintraffic,
|
|
||||||
(uni_check_f)uni_ie_check_itu_mintraffic,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_mintraffic,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_mintraffic
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct iedecl decl_net_mintraffic = {
|
|
||||||
UNIFL_DEFAULT,
|
|
||||||
0,
|
|
||||||
(uni_print_f)NULL,
|
|
||||||
(uni_check_f)NULL,
|
|
||||||
(uni_encode_f)NULL,
|
|
||||||
(uni_decode_f)NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_atraffic(struct uni_ie_atraffic *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_atraffic(struct uni_ie_atraffic *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_atraffic(struct uni_msg *, struct uni_ie_atraffic *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_atraffic(struct uni_ie_atraffic *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_atraffic = {
|
|
||||||
0,
|
|
||||||
30,
|
|
||||||
(uni_print_f)uni_ie_print_itu_atraffic,
|
|
||||||
(uni_check_f)uni_ie_check_itu_atraffic,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_atraffic,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_atraffic
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct iedecl decl_net_atraffic = {
|
|
||||||
UNIFL_DEFAULT,
|
|
||||||
0,
|
|
||||||
(uni_print_f)NULL,
|
|
||||||
(uni_check_f)NULL,
|
|
||||||
(uni_encode_f)NULL,
|
|
||||||
(uni_decode_f)NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_abrsetup(struct uni_ie_abrsetup *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_abrsetup(struct uni_ie_abrsetup *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_abrsetup(struct uni_msg *, struct uni_ie_abrsetup *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_abrsetup(struct uni_ie_abrsetup *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_abrsetup = {
|
|
||||||
0,
|
|
||||||
36,
|
|
||||||
(uni_print_f)uni_ie_print_net_abrsetup,
|
|
||||||
(uni_check_f)uni_ie_check_net_abrsetup,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_abrsetup,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_abrsetup
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_report(struct uni_ie_report *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_report(struct uni_ie_report *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_report(struct uni_msg *, struct uni_ie_report *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_report(struct uni_ie_report *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_report = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_itu_report,
|
|
||||||
(uni_check_f)uni_ie_check_itu_report,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_report,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_report
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_called_soft(struct uni_ie_called_soft *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_called_soft(struct uni_ie_called_soft *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_called_soft(struct uni_msg *, struct uni_ie_called_soft *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_called_soft(struct uni_ie_called_soft *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_called_soft = {
|
|
||||||
0,
|
|
||||||
11,
|
|
||||||
(uni_print_f)uni_ie_print_net_called_soft,
|
|
||||||
(uni_check_f)uni_ie_check_net_called_soft,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_called_soft,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_called_soft
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_crankback(struct uni_ie_crankback *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_crankback(struct uni_ie_crankback *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_crankback(struct uni_msg *, struct uni_ie_crankback *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_crankback(struct uni_ie_crankback *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_crankback = {
|
|
||||||
0,
|
|
||||||
72,
|
|
||||||
(uni_print_f)uni_ie_print_net_crankback,
|
|
||||||
(uni_check_f)uni_ie_check_net_crankback,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_crankback,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_crankback
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_dtl(struct uni_ie_dtl *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_dtl(struct uni_ie_dtl *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_dtl(struct uni_msg *, struct uni_ie_dtl *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_dtl(struct uni_ie_dtl *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_dtl = {
|
|
||||||
0,
|
|
||||||
UNI_DTL_LOGNP_SIZE*UNI_DTL_MAXNUM+6,
|
|
||||||
(uni_print_f)uni_ie_print_net_dtl,
|
|
||||||
(uni_check_f)uni_ie_check_net_dtl,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_dtl,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_dtl
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_calling_soft(struct uni_ie_calling_soft *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_calling_soft(struct uni_ie_calling_soft *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_calling_soft(struct uni_msg *, struct uni_ie_calling_soft *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_calling_soft(struct uni_ie_calling_soft *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_calling_soft = {
|
|
||||||
0,
|
|
||||||
10,
|
|
||||||
(uni_print_f)uni_ie_print_net_calling_soft,
|
|
||||||
(uni_check_f)uni_ie_check_net_calling_soft,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_calling_soft,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_calling_soft
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_abradd(struct uni_ie_abradd *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_abradd(struct uni_ie_abradd *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_abradd(struct uni_msg *, struct uni_ie_abradd *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_abradd(struct uni_ie_abradd *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_abradd = {
|
|
||||||
0,
|
|
||||||
14,
|
|
||||||
(uni_print_f)uni_ie_print_net_abradd,
|
|
||||||
(uni_check_f)uni_ie_check_net_abradd,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_abradd,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_abradd
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_lij_callid(struct uni_ie_lij_callid *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_lij_callid(struct uni_ie_lij_callid *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_lij_callid(struct uni_msg *, struct uni_ie_lij_callid *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_lij_callid(struct uni_ie_lij_callid *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_lij_callid = {
|
|
||||||
0,
|
|
||||||
9,
|
|
||||||
(uni_print_f)uni_ie_print_net_lij_callid,
|
|
||||||
(uni_check_f)uni_ie_check_net_lij_callid,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_lij_callid,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_lij_callid
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_lij_param(struct uni_ie_lij_param *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_lij_param(struct uni_ie_lij_param *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_lij_param(struct uni_msg *, struct uni_ie_lij_param *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_lij_param(struct uni_ie_lij_param *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_lij_param = {
|
|
||||||
0,
|
|
||||||
5,
|
|
||||||
(uni_print_f)uni_ie_print_net_lij_param,
|
|
||||||
(uni_check_f)uni_ie_check_net_lij_param,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_lij_param,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_lij_param
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_lij_seqno(struct uni_ie_lij_seqno *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_lij_seqno(struct uni_ie_lij_seqno *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_lij_seqno(struct uni_msg *, struct uni_ie_lij_seqno *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_lij_seqno(struct uni_ie_lij_seqno *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_lij_seqno = {
|
|
||||||
0,
|
|
||||||
8,
|
|
||||||
(uni_print_f)uni_ie_print_net_lij_seqno,
|
|
||||||
(uni_check_f)uni_ie_check_net_lij_seqno,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_lij_seqno,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_lij_seqno
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_cscope(struct uni_ie_cscope *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_cscope(struct uni_ie_cscope *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_cscope(struct uni_msg *, struct uni_ie_cscope *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_cscope(struct uni_ie_cscope *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_cscope = {
|
|
||||||
0,
|
|
||||||
6,
|
|
||||||
(uni_print_f)uni_ie_print_net_cscope,
|
|
||||||
(uni_check_f)uni_ie_check_net_cscope,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_cscope,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_cscope
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_exqos(struct uni_ie_exqos *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_exqos(struct uni_ie_exqos *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_exqos(struct uni_msg *, struct uni_ie_exqos *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_exqos(struct uni_ie_exqos *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_exqos = {
|
|
||||||
0,
|
|
||||||
25,
|
|
||||||
(uni_print_f)uni_ie_print_net_exqos,
|
|
||||||
(uni_check_f)uni_ie_check_net_exqos,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_exqos,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_exqos
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_net_mdcr(struct uni_ie_mdcr *, struct unicx *);
|
|
||||||
static int uni_ie_check_net_mdcr(struct uni_ie_mdcr *, struct unicx *);
|
|
||||||
static int uni_ie_encode_net_mdcr(struct uni_msg *, struct uni_ie_mdcr *, struct unicx *);
|
|
||||||
static int uni_ie_decode_net_mdcr(struct uni_ie_mdcr *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_net_mdcr = {
|
|
||||||
0,
|
|
||||||
13,
|
|
||||||
(uni_print_f)uni_ie_print_net_mdcr,
|
|
||||||
(uni_check_f)uni_ie_check_net_mdcr,
|
|
||||||
(uni_encode_f)uni_ie_encode_net_mdcr,
|
|
||||||
(uni_decode_f)uni_ie_decode_net_mdcr
|
|
||||||
};
|
|
||||||
|
|
||||||
static void uni_ie_print_itu_unrec(struct uni_ie_unrec *, struct unicx *);
|
|
||||||
static int uni_ie_check_itu_unrec(struct uni_ie_unrec *, struct unicx *);
|
|
||||||
static int uni_ie_encode_itu_unrec(struct uni_msg *, struct uni_ie_unrec *, struct unicx *);
|
|
||||||
static int uni_ie_decode_itu_unrec(struct uni_ie_unrec *, struct uni_msg *, u_int, struct unicx *);
|
|
||||||
|
|
||||||
static struct iedecl decl_itu_unrec = {
|
|
||||||
0,
|
|
||||||
128,
|
|
||||||
(uni_print_f)uni_ie_print_itu_unrec,
|
|
||||||
(uni_check_f)uni_ie_check_itu_unrec,
|
|
||||||
(uni_encode_f)uni_ie_encode_itu_unrec,
|
|
||||||
(uni_decode_f)uni_ie_decode_itu_unrec
|
|
||||||
};
|
|
||||||
|
|
||||||
const struct iedecl *uni_ietable[256][4] = {
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x00 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x01 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x02 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x03 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x04 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x05 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x06 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x07 */
|
|
||||||
{ &decl_itu_cause, NULL, NULL, &decl_net_cause, }, /* 0x08 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x09 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x0a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x0b */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x0c */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x0d */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x0e */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x0f */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x10 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x11 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x12 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x13 */
|
|
||||||
{ &decl_itu_callstate, NULL, NULL, NULL, }, /* 0x14 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x15 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x16 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x17 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x18 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x19 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x1a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x1b */
|
|
||||||
{ &decl_itu_facility, NULL, NULL, NULL, }, /* 0x1c */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x1d */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x1e */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x1f */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x20 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x21 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x22 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x23 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x24 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x25 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x26 */
|
|
||||||
{ &decl_itu_notify, NULL, NULL, NULL, }, /* 0x27 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x28 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x29 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x2a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x2b */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x2c */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x2d */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x2e */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x2f */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x30 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x31 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x32 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x33 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x34 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x35 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x36 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x37 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x38 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x39 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x3a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x3b */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x3c */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x3d */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x3e */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x3f */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x40 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x41 */
|
|
||||||
{ &decl_itu_eetd, NULL, NULL, &decl_net_eetd, }, /* 0x42 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x43 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x44 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x45 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x46 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x47 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x48 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x49 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x4a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x4b */
|
|
||||||
{ &decl_itu_conned, NULL, NULL, NULL, }, /* 0x4c */
|
|
||||||
{ &decl_itu_connedsub, NULL, NULL, NULL, }, /* 0x4d */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x4e */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x4f */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x50 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x51 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x52 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x53 */
|
|
||||||
{ &decl_itu_epref, NULL, NULL, NULL, }, /* 0x54 */
|
|
||||||
{ &decl_itu_epstate, NULL, NULL, NULL, }, /* 0x55 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x56 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x57 */
|
|
||||||
{ &decl_itu_aal, NULL, NULL, NULL, }, /* 0x58 */
|
|
||||||
{ &decl_itu_traffic, NULL, NULL, &decl_net_traffic, }, /* 0x59 */
|
|
||||||
{ &decl_itu_connid, NULL, NULL, NULL, }, /* 0x5a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x5b */
|
|
||||||
{ &decl_itu_qos, NULL, NULL, &decl_net_qos, }, /* 0x5c */
|
|
||||||
{ &decl_itu_bhli, NULL, NULL, NULL, }, /* 0x5d */
|
|
||||||
{ &decl_itu_bearer, NULL, NULL, NULL, }, /* 0x5e */
|
|
||||||
{ &decl_itu_blli, NULL, NULL, NULL, }, /* 0x5f */
|
|
||||||
{ &decl_itu_lshift, NULL, NULL, NULL, }, /* 0x60 */
|
|
||||||
{ &decl_itu_nlshift, NULL, NULL, NULL, }, /* 0x61 */
|
|
||||||
{ &decl_itu_scompl, NULL, NULL, NULL, }, /* 0x62 */
|
|
||||||
{ &decl_itu_repeat, NULL, NULL, NULL, }, /* 0x63 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x64 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x65 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x66 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x67 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x68 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x69 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x6a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x6b */
|
|
||||||
{ &decl_itu_calling, NULL, NULL, NULL, }, /* 0x6c */
|
|
||||||
{ &decl_itu_callingsub, NULL, NULL, NULL, }, /* 0x6d */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x6e */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x6f */
|
|
||||||
{ &decl_itu_called, NULL, NULL, NULL, }, /* 0x70 */
|
|
||||||
{ &decl_itu_calledsub, NULL, NULL, NULL, }, /* 0x71 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x72 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x73 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x74 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x75 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x76 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x77 */
|
|
||||||
{ &decl_itu_tns, NULL, NULL, &decl_net_tns, }, /* 0x78 */
|
|
||||||
{ &decl_itu_restart, NULL, NULL, NULL, }, /* 0x79 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x7a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x7b */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x7c */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x7d */
|
|
||||||
{ &decl_itu_uu, NULL, NULL, NULL, }, /* 0x7e */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_git, }, /* 0x7f */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x80 */
|
|
||||||
{ &decl_itu_mintraffic, NULL, NULL, &decl_net_mintraffic, }, /* 0x81 */
|
|
||||||
{ &decl_itu_atraffic, NULL, NULL, &decl_net_atraffic, }, /* 0x82 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x83 */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_abrsetup, }, /* 0x84 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x85 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x86 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x87 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x88 */
|
|
||||||
{ &decl_itu_report, NULL, NULL, NULL, }, /* 0x89 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x8a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x8b */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x8c */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x8d */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x8e */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x8f */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x90 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x91 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x92 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x93 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x94 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x95 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x96 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x97 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x98 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x99 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x9a */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x9b */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x9c */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x9d */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x9e */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0x9f */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa0 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa1 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa2 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa3 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa4 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa5 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa6 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa7 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa8 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xa9 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xaa */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xab */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xac */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xad */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xae */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xaf */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb0 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb1 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb2 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb3 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb4 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb5 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb6 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb7 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb8 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xb9 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xba */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xbb */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xbc */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xbd */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xbe */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xbf */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc0 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc1 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc2 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc3 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc4 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc5 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc6 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc7 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc8 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xc9 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xca */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xcb */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xcc */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xcd */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xce */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xcf */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd0 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd1 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd2 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd3 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd4 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd5 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd6 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd7 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd8 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xd9 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xda */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xdb */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xdc */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xdd */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xde */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xdf */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_called_soft, }, /* 0xe0 */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_crankback, }, /* 0xe1 */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_dtl, }, /* 0xe2 */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_calling_soft, }, /* 0xe3 */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_abradd, }, /* 0xe4 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xe5 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xe6 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xe7 */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_lij_callid, }, /* 0xe8 */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_lij_param, }, /* 0xe9 */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_lij_seqno, }, /* 0xea */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_cscope, }, /* 0xeb */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_exqos, }, /* 0xec */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xed */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xee */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xef */
|
|
||||||
{ NULL, NULL, NULL, &decl_net_mdcr, }, /* 0xf0 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf1 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf2 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf3 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf4 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf5 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf6 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf7 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf8 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xf9 */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xfa */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xfb */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xfc */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xfd */
|
|
||||||
{ &decl_itu_unrec, NULL, NULL, NULL, }, /* 0xfe */
|
|
||||||
{ NULL, NULL, NULL, NULL, }, /* 0xff */
|
|
||||||
};
|
|
File diff suppressed because it is too large
Load Diff
@ -1,342 +0,0 @@
|
|||||||
/* This file was created automatically
|
|
||||||
* Source file: $Begemot: libunimsg/atm/msg/msg.def,v 1.3 2003/09/19 11:58:15 hbb Exp $
|
|
||||||
* $FreeBSD$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _NETNATM_MSG_UNI_MSG_H_
|
|
||||||
#define _NETNATM_MSG_UNI_MSG_H_
|
|
||||||
|
|
||||||
struct uni_alerting {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_report report;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_call_proc {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_connect {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_aal aal;
|
|
||||||
struct uni_ie_blli blli;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_conned conned;
|
|
||||||
struct uni_ie_connedsub connedsub;
|
|
||||||
struct uni_ie_eetd eetd;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_traffic traffic;
|
|
||||||
struct uni_ie_exqos exqos;
|
|
||||||
struct uni_ie_facility facility;
|
|
||||||
struct uni_ie_abrsetup abrsetup;
|
|
||||||
struct uni_ie_abradd abradd;
|
|
||||||
struct uni_ie_called_soft called_soft;
|
|
||||||
struct uni_ie_report report;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_connect_ack {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_release {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_cause cause[2];
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_facility facility;
|
|
||||||
struct uni_ie_crankback crankback;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_release_compl {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_cause cause[2];
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_crankback crankback;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_setup {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_aal aal;
|
|
||||||
struct uni_ie_traffic traffic;
|
|
||||||
struct uni_ie_bearer bearer;
|
|
||||||
struct uni_ie_bhli bhli;
|
|
||||||
struct uni_ie_repeat blli_repeat;
|
|
||||||
struct uni_ie_blli blli[UNI_NUM_IE_BLLI];
|
|
||||||
struct uni_ie_called called;
|
|
||||||
struct uni_ie_calledsub calledsub[UNI_NUM_IE_CALLEDSUB];
|
|
||||||
struct uni_ie_calling calling;
|
|
||||||
struct uni_ie_callingsub callingsub[UNI_NUM_IE_CALLINGSUB];
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
struct uni_ie_qos qos;
|
|
||||||
struct uni_ie_eetd eetd;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_scompl scompl;
|
|
||||||
struct uni_ie_tns tns[UNI_NUM_IE_TNS];
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_atraffic atraffic;
|
|
||||||
struct uni_ie_mintraffic mintraffic;
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_lij_callid lij_callid;
|
|
||||||
struct uni_ie_lij_param lij_param;
|
|
||||||
struct uni_ie_lij_seqno lij_seqno;
|
|
||||||
struct uni_ie_exqos exqos;
|
|
||||||
struct uni_ie_abrsetup abrsetup;
|
|
||||||
struct uni_ie_abradd abradd;
|
|
||||||
struct uni_ie_cscope cscope;
|
|
||||||
struct uni_ie_calling_soft calling_soft;
|
|
||||||
struct uni_ie_called_soft called_soft;
|
|
||||||
struct uni_ie_repeat dtl_repeat;
|
|
||||||
struct uni_ie_dtl dtl[UNI_NUM_IE_DTL];
|
|
||||||
struct uni_ie_report report;
|
|
||||||
struct uni_ie_mdcr mdcr;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_status {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_callstate callstate;
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_epstate epstate;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_status_enq {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_notify {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_restart {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
struct uni_ie_restart restart;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_restart_ack {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
struct uni_ie_restart restart;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_add_party {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_aal aal;
|
|
||||||
struct uni_ie_bhli bhli;
|
|
||||||
struct uni_ie_blli blli;
|
|
||||||
struct uni_ie_called called;
|
|
||||||
struct uni_ie_calledsub calledsub[UNI_NUM_IE_CALLEDSUB];
|
|
||||||
struct uni_ie_calling calling;
|
|
||||||
struct uni_ie_callingsub callingsub[UNI_NUM_IE_CALLINGSUB];
|
|
||||||
struct uni_ie_scompl scompl;
|
|
||||||
struct uni_ie_tns tns[UNI_NUM_IE_TNS];
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_eetd eetd;
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_lij_seqno lij_seqno;
|
|
||||||
struct uni_ie_calling_soft calling_soft;
|
|
||||||
struct uni_ie_called_soft called_soft;
|
|
||||||
struct uni_ie_repeat dtl_repeat;
|
|
||||||
struct uni_ie_dtl dtl[UNI_NUM_IE_DTL];
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_add_party_ack {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_aal aal;
|
|
||||||
struct uni_ie_blli blli;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_eetd eetd;
|
|
||||||
struct uni_ie_conned conned;
|
|
||||||
struct uni_ie_connedsub connedsub;
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_called_soft called_soft;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_party_alerting {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_add_party_rej {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_crankback crankback;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_drop_party {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_drop_party_ack {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
struct uni_ie_uu uu;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_leaf_setup_req {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_tns tns[UNI_NUM_IE_TNS];
|
|
||||||
struct uni_ie_calling calling;
|
|
||||||
struct uni_ie_callingsub callingsub[UNI_NUM_IE_CALLINGSUB];
|
|
||||||
struct uni_ie_called called;
|
|
||||||
struct uni_ie_calledsub calledsub[UNI_NUM_IE_CALLEDSUB];
|
|
||||||
struct uni_ie_lij_callid lij_callid;
|
|
||||||
struct uni_ie_lij_seqno lij_seqno;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_leaf_setup_fail {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
struct uni_ie_called called;
|
|
||||||
struct uni_ie_calledsub calledsub;
|
|
||||||
struct uni_ie_lij_seqno lij_seqno;
|
|
||||||
struct uni_ie_tns tns[UNI_NUM_IE_TNS];
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_cobisetup {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_facility facility;
|
|
||||||
struct uni_ie_called called;
|
|
||||||
struct uni_ie_calledsub calledsub;
|
|
||||||
struct uni_ie_calling calling;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_facility {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_facility facility;
|
|
||||||
struct uni_ie_called called;
|
|
||||||
struct uni_ie_calledsub calledsub;
|
|
||||||
struct uni_ie_calling calling;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_modify_req {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_traffic traffic;
|
|
||||||
struct uni_ie_atraffic atraffic;
|
|
||||||
struct uni_ie_mintraffic mintraffic;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_modify_ack {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_report report;
|
|
||||||
struct uni_ie_traffic traffic;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_modify_rej {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_conn_avail {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_notify notify;
|
|
||||||
struct uni_ie_git git[UNI_NUM_IE_GIT];
|
|
||||||
struct uni_ie_report report;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uni_unknown {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_unrec unrec;
|
|
||||||
};
|
|
||||||
|
|
||||||
union uni_msgall {
|
|
||||||
struct uni_msghdr hdr;
|
|
||||||
struct uni_alerting alerting;
|
|
||||||
struct uni_call_proc call_proc;
|
|
||||||
struct uni_connect connect;
|
|
||||||
struct uni_connect_ack connect_ack; /* !pnni */
|
|
||||||
struct uni_release release;
|
|
||||||
struct uni_release_compl release_compl;
|
|
||||||
struct uni_setup setup;
|
|
||||||
struct uni_status status;
|
|
||||||
struct uni_status_enq status_enq;
|
|
||||||
struct uni_notify notify;
|
|
||||||
struct uni_restart restart;
|
|
||||||
struct uni_restart_ack restart_ack;
|
|
||||||
struct uni_add_party add_party;
|
|
||||||
struct uni_add_party_ack add_party_ack;
|
|
||||||
struct uni_party_alerting party_alerting;
|
|
||||||
struct uni_add_party_rej add_party_rej;
|
|
||||||
struct uni_drop_party drop_party;
|
|
||||||
struct uni_drop_party_ack drop_party_ack;
|
|
||||||
struct uni_leaf_setup_req leaf_setup_req; /* !pnni */
|
|
||||||
struct uni_leaf_setup_fail leaf_setup_fail; /* !pnni */
|
|
||||||
struct uni_cobisetup cobisetup; /* !pnni&&q2932 */
|
|
||||||
struct uni_facility facility; /* !pnni&&q2932 */
|
|
||||||
struct uni_modify_req modify_req; /* !pnni */
|
|
||||||
struct uni_modify_ack modify_ack; /* !pnni */
|
|
||||||
struct uni_modify_rej modify_rej; /* !pnni */
|
|
||||||
struct uni_conn_avail conn_avail; /* !pnni */
|
|
||||||
struct uni_unknown unknown;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,168 +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/unimsglib.h,v 1.6 2004/07/08 08:22:07 brandt Exp $
|
|
||||||
*/
|
|
||||||
#ifndef _NETNATM_MSG_UNIMSGLIB_H_
|
|
||||||
#define _NETNATM_MSG_UNIMSGLIB_H_
|
|
||||||
|
|
||||||
#include <netnatm/msg/uni_config.h>
|
|
||||||
|
|
||||||
struct uni_msg;
|
|
||||||
|
|
||||||
enum uni_ierr_type {
|
|
||||||
UNI_IERR_UNK, /* unknown IE */
|
|
||||||
UNI_IERR_LEN, /* length error */
|
|
||||||
UNI_IERR_BAD, /* content error */
|
|
||||||
UNI_IERR_ACC, /* access element content error */
|
|
||||||
UNI_IERR_MIS, /* mandatory IE missing (not used here) */
|
|
||||||
};
|
|
||||||
|
|
||||||
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 */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Context buffer. Needed to reduce number of arguments to routines.
|
|
||||||
*/
|
|
||||||
struct unicx {
|
|
||||||
/*
|
|
||||||
* globals for error handling
|
|
||||||
*/
|
|
||||||
u_int errcnt; /* number of bad IEs */
|
|
||||||
struct uni_ierr err[UNI_MAX_ERRIE]; /* the errors */
|
|
||||||
|
|
||||||
int q2932; /* Enable GFP */
|
|
||||||
int pnni; /* Enable PNNI */
|
|
||||||
|
|
||||||
int git_hard; /* do hard check on GIT IE */
|
|
||||||
int bearer_hard; /* do hard check on BEARER IE */
|
|
||||||
int cause_hard; /* do hard check on cause */
|
|
||||||
|
|
||||||
int multiline; /* printing mode */
|
|
||||||
u_int tabsiz; /* tabulation size */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Internal context of library -- don't touch
|
|
||||||
*/
|
|
||||||
struct uni_ie_repeat repeat; /* repeat IE during decoding */
|
|
||||||
enum uni_ietype ielast; /* last IE seen for repeat handling */
|
|
||||||
|
|
||||||
const char *prefix[20];
|
|
||||||
u_int nprefix;
|
|
||||||
int doindent;
|
|
||||||
char *buf;
|
|
||||||
size_t bufsiz;
|
|
||||||
u_int indent; /* indentation */
|
|
||||||
int dont_init;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Functions for all messages
|
|
||||||
*/
|
|
||||||
void uni_print_cref(char *, size_t, const struct uni_cref *, struct unicx *);
|
|
||||||
void uni_print_msghdr(char *, size_t, const struct uni_msghdr *, struct unicx *);
|
|
||||||
void uni_print(char *, size_t, const struct uni_all *, struct unicx *);
|
|
||||||
void uni_print_msg(char *, size_t, u_int _mtype, const union uni_msgall *,
|
|
||||||
struct unicx *);
|
|
||||||
int uni_encode(struct uni_msg *, struct uni_all *, struct unicx *);
|
|
||||||
int uni_decode(struct uni_msg *, struct uni_all *, struct unicx *);
|
|
||||||
|
|
||||||
int uni_decode_head(struct uni_msg *, struct uni_all *, struct unicx *);
|
|
||||||
int uni_decode_body(struct uni_msg *, struct uni_all *, struct unicx *);
|
|
||||||
|
|
||||||
int uni_encode_msg_hdr(struct uni_msg *, struct uni_msghdr *, enum uni_msgtype,
|
|
||||||
struct unicx *, int *);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Functions for all information elements
|
|
||||||
*/
|
|
||||||
void uni_print_ie(char *, size_t, enum uni_ietype, const union uni_ieall *,
|
|
||||||
struct unicx *);
|
|
||||||
int uni_check_ie(enum uni_ietype, union uni_ieall *, struct unicx *);
|
|
||||||
int uni_encode_ie(enum uni_ietype, struct uni_msg *, union uni_ieall *,
|
|
||||||
struct unicx *);
|
|
||||||
int uni_decode_ie_hdr(enum uni_ietype *, struct uni_iehdr *, struct uni_msg *,
|
|
||||||
struct unicx *, u_int *);
|
|
||||||
int uni_encode_ie_hdr(struct uni_msg *, enum uni_ietype, struct uni_iehdr *,
|
|
||||||
u_int, struct unicx *);
|
|
||||||
int uni_decode_ie_body(enum uni_ietype, union uni_ieall *, struct uni_msg *,
|
|
||||||
u_int, struct unicx *);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Context handling
|
|
||||||
*/
|
|
||||||
void uni_initcx(struct unicx *);
|
|
||||||
void uni_print_cx(char *, size_t, struct unicx *);
|
|
||||||
|
|
||||||
#define UNI_SAVE_IERR(CX, IETYPE, ACT, ERRCODE) \
|
|
||||||
(((CX)->errcnt < UNI_MAX_ERRIE) ? \
|
|
||||||
((CX)->err[(CX)->errcnt].ie = (IETYPE), \
|
|
||||||
(CX)->err[(CX)->errcnt].act = (ACT), \
|
|
||||||
(CX)->err[(CX)->errcnt].err = (ERRCODE), \
|
|
||||||
(CX)->err[(CX)->errcnt].man = 0, \
|
|
||||||
(CX)->errcnt++, \
|
|
||||||
1) : 0)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Traffic classification
|
|
||||||
*/
|
|
||||||
enum uni_traffic_class {
|
|
||||||
UNI_TRAFFIC_CBR1,
|
|
||||||
UNI_TRAFFIC_CBR2,
|
|
||||||
UNI_TRAFFIC_CBR3,
|
|
||||||
UNI_TRAFFIC_rtVBR1,
|
|
||||||
UNI_TRAFFIC_rtVBR2,
|
|
||||||
UNI_TRAFFIC_rtVBR3,
|
|
||||||
UNI_TRAFFIC_rtVBR4,
|
|
||||||
UNI_TRAFFIC_rtVBR5,
|
|
||||||
UNI_TRAFFIC_rtVBR6,
|
|
||||||
UNI_TRAFFIC_nrtVBR1,
|
|
||||||
UNI_TRAFFIC_nrtVBR2,
|
|
||||||
UNI_TRAFFIC_nrtVBR3,
|
|
||||||
UNI_TRAFFIC_nrtVBR4,
|
|
||||||
UNI_TRAFFIC_nrtVBR5,
|
|
||||||
UNI_TRAFFIC_nrtVBR6,
|
|
||||||
UNI_TRAFFIC_ABR,
|
|
||||||
UNI_TRAFFIC_UBR1,
|
|
||||||
UNI_TRAFFIC_UBR2,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* classify traffic */
|
|
||||||
int uni_classify_traffic(const struct uni_ie_bearer *,
|
|
||||||
const struct uni_ie_traffic *,
|
|
||||||
enum uni_traffic_class *, enum uni_traffic_class *,
|
|
||||||
char *, size_t);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,72 +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/uniprint.h,v 1.4 2004/07/08 08:22:08 brandt Exp $
|
|
||||||
*
|
|
||||||
* Print utility functions. These are only needed if you want to hook to
|
|
||||||
* the format of the uni printing routines.
|
|
||||||
*/
|
|
||||||
#ifndef _NETNATM_MSG_UNIPRINT_H_
|
|
||||||
#define _NETNATM_MSG_UNIPRINT_H_
|
|
||||||
|
|
||||||
#include <netnatm/msg/uni_config.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This structure is used to define value->string mappings.
|
|
||||||
* It must be terminated by a { NULL, 0 } entry.
|
|
||||||
*/
|
|
||||||
struct uni_print_tbl {
|
|
||||||
const char *name;
|
|
||||||
u_int val;
|
|
||||||
};
|
|
||||||
void uni_print_tbl(const char *_entry, u_int _val,
|
|
||||||
const struct uni_print_tbl *_tbl, struct unicx *_cx);
|
|
||||||
|
|
||||||
/* initialize printing. This must be called at the start from each external
|
|
||||||
* callable printing function. */
|
|
||||||
void uni_print_init(char *_buf, size_t _bufsiz, struct unicx *_cx);
|
|
||||||
|
|
||||||
/* End the current (semantical) line. This takes care of indendation and
|
|
||||||
* actually print the newline in the appropriate modes. */
|
|
||||||
void uni_print_eol(struct unicx *_cx);
|
|
||||||
|
|
||||||
/* Push or pop a prefix. This takes care of indendation. */
|
|
||||||
void uni_print_push_prefix(const char *_prefix, struct unicx *_cx);
|
|
||||||
void uni_print_pop_prefix(struct unicx *_cx);
|
|
||||||
|
|
||||||
/* Print a flag taking care of the right prefixing */
|
|
||||||
void uni_print_flag(const char *_flag, struct unicx *_cx);
|
|
||||||
|
|
||||||
/* Print an entry taking care of the right prefixing */
|
|
||||||
void uni_print_entry(struct unicx *_cx, const char *_entry,
|
|
||||||
const char *_fmt, ...) __printflike(3, 4);
|
|
||||||
|
|
||||||
/* Generic printf */
|
|
||||||
void uni_printf(struct unicx *_cx, const char *_fmt, ...) __printflike(2, 3);
|
|
||||||
|
|
||||||
#endif
|
|
File diff suppressed because it is too large
Load Diff
@ -1,577 +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/saal/saal_sscfu.c,v 1.4 2004/07/08 08:22:10 brandt Exp $
|
|
||||||
*
|
|
||||||
* SSCF on the UNI
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <netnatm/saal/sscfu.h>
|
|
||||||
#include <netnatm/saal/sscfupriv.h>
|
|
||||||
|
|
||||||
#define MKSTR(S) #S
|
|
||||||
|
|
||||||
static const char *const sscf_sigs[] = {
|
|
||||||
MKSTR(SAAL_ESTABLISH_request),
|
|
||||||
MKSTR(SAAL_ESTABLISH_indication),
|
|
||||||
MKSTR(SAAL_ESTABLISH_confirm),
|
|
||||||
MKSTR(SAAL_RELEASE_request),
|
|
||||||
MKSTR(SAAL_RELEASE_confirm),
|
|
||||||
MKSTR(SAAL_RELEASE_indication),
|
|
||||||
MKSTR(SAAL_DATA_request),
|
|
||||||
MKSTR(SAAL_DATA_indication),
|
|
||||||
MKSTR(SAAL_UDATA_request),
|
|
||||||
MKSTR(SAAL_UDATA_indication),
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *const sscf_states[] = {
|
|
||||||
MKSTR(SSCF_RELEASED),
|
|
||||||
MKSTR(SSCF_AWAITING_ESTABLISH),
|
|
||||||
MKSTR(SSCF_AWAITING_RELEASE),
|
|
||||||
MKSTR(SSCF_ESTABLISHED),
|
|
||||||
MKSTR(SSCF_RESYNC),
|
|
||||||
};
|
|
||||||
|
|
||||||
#define AA_SIG(S,G,M) \
|
|
||||||
((S)->funcs->send_upper((S), (S)->aarg, (G), (M)))
|
|
||||||
|
|
||||||
#define SSCOP_AASIG(S,G,M,P) \
|
|
||||||
((S)->funcs->send_lower((S), (S)->aarg, (G), (M), (P)))
|
|
||||||
|
|
||||||
MEMINIT();
|
|
||||||
|
|
||||||
static void sscfu_unqueue(struct sscfu *sscf);
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
/*
|
|
||||||
* INSTANCE AND CLASS MANAGEMENT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize SSCF.
|
|
||||||
*/
|
|
||||||
struct sscfu *
|
|
||||||
sscfu_create(void *a, const struct sscfu_funcs *funcs)
|
|
||||||
{
|
|
||||||
struct sscfu *sscf;
|
|
||||||
|
|
||||||
MEMZALLOC(sscf, struct sscfu *, sizeof(struct sscfu));
|
|
||||||
if (sscf == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
sscf->funcs = funcs;
|
|
||||||
sscf->aarg = a;
|
|
||||||
sscf->state = SSCFU_RELEASED;
|
|
||||||
sscf->inhand = 0;
|
|
||||||
SIGQ_INIT(&sscf->sigs);
|
|
||||||
sscf->debug = 0;
|
|
||||||
|
|
||||||
return (sscf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset the instance. Call only if you know, what you're doing.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
sscfu_reset(struct sscfu *sscf)
|
|
||||||
{
|
|
||||||
sscf->state = SSCFU_RELEASED;
|
|
||||||
sscf->inhand = 0;
|
|
||||||
SIGQ_CLEAR(&sscf->sigs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Destroy SSCF
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
sscfu_destroy(struct sscfu *sscf)
|
|
||||||
{
|
|
||||||
SIGQ_CLEAR(&sscf->sigs);
|
|
||||||
MEMFREE(sscf);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum sscfu_state
|
|
||||||
sscfu_getstate(const struct sscfu *sscf)
|
|
||||||
{
|
|
||||||
return (sscf->state);
|
|
||||||
}
|
|
||||||
|
|
||||||
u_int
|
|
||||||
sscfu_getdefparam(struct sscop_param *p)
|
|
||||||
{
|
|
||||||
memset(p, 0, sizeof(*p));
|
|
||||||
|
|
||||||
p->timer_cc = 1000;
|
|
||||||
p->timer_poll = 750;
|
|
||||||
p->timer_keep_alive = 2000;
|
|
||||||
p->timer_no_response = 7000;
|
|
||||||
p->timer_idle = 15000;
|
|
||||||
p->maxk = 4096;
|
|
||||||
p->maxj = 4096;
|
|
||||||
p->maxcc = 4;
|
|
||||||
p->maxpd = 25;
|
|
||||||
|
|
||||||
return (SSCOP_SET_TCC | SSCOP_SET_TPOLL | SSCOP_SET_TKA |
|
|
||||||
SSCOP_SET_TNR | SSCOP_SET_TIDLE | SSCOP_SET_MAXK |
|
|
||||||
SSCOP_SET_MAXJ | SSCOP_SET_MAXCC | SSCOP_SET_MAXPD);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
sscfu_signame(enum saal_sig sig)
|
|
||||||
{
|
|
||||||
static char str[40];
|
|
||||||
|
|
||||||
if (sig >= sizeof(sscf_sigs)/sizeof(sscf_sigs[0])) {
|
|
||||||
sprintf(str, "BAD SAAL_SIGNAL %u", sig);
|
|
||||||
return (str);
|
|
||||||
} else {
|
|
||||||
return (sscf_sigs[sig]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
sscfu_statename(enum sscfu_state s)
|
|
||||||
{
|
|
||||||
static char str[40];
|
|
||||||
|
|
||||||
if (s >= sizeof(sscf_states)/sizeof(sscf_states[0])) {
|
|
||||||
sprintf(str, "BAD SSCFU state %u", s);
|
|
||||||
return (str);
|
|
||||||
} else {
|
|
||||||
return (sscf_states[s]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
/*
|
|
||||||
* EXTERNAL INPUT SIGNAL MAPPING
|
|
||||||
*/
|
|
||||||
static __inline void
|
|
||||||
set_state(struct sscfu *sscf, enum sscfu_state state)
|
|
||||||
{
|
|
||||||
VERBOSE(sscf, SSCFU_DBG_STATE, (sscf, sscf->aarg,
|
|
||||||
"change state from %s to %s",
|
|
||||||
sscf_states[sscf->state], sscf_states[state]));
|
|
||||||
sscf->state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* signal from SSCOP to SSCF
|
|
||||||
* Message must be freed by the user specified handler, if
|
|
||||||
* it is passed.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
sscfu_input(struct sscfu *sscf, enum sscop_aasig sig,
|
|
||||||
struct SSCFU_MBUF_T *m, u_int arg __unused)
|
|
||||||
{
|
|
||||||
sscf->inhand = 1;
|
|
||||||
|
|
||||||
VERBOSE(sscf, SSCFU_DBG_LSIG, (sscf, sscf->aarg,
|
|
||||||
"SSCF got signal %d. in state %s", sig, sscf_states[sscf->state]));
|
|
||||||
|
|
||||||
switch (sig) {
|
|
||||||
|
|
||||||
case SSCOP_RELEASE_indication:
|
|
||||||
/* arg is: UU, SRC */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
set_state(sscf, SSCFU_RELEASED);
|
|
||||||
AA_SIG(sscf, SAAL_RELEASE_indication, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
set_state(sscf, SSCFU_RELEASED);
|
|
||||||
AA_SIG(sscf, SAAL_RELEASE_indication, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
set_state(sscf, SSCFU_RELEASED);
|
|
||||||
AA_SIG(sscf, SAAL_RELEASE_indication, m);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCOP_ESTABLISH_indication:
|
|
||||||
/* arg is: UU */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
set_state(sscf, SSCFU_ESTABLISHED);
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_ESTABLISH_response, NULL, 1);
|
|
||||||
AA_SIG(sscf, SAAL_ESTABLISH_indication, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCOP_ESTABLISH_confirm:
|
|
||||||
/* arg is: UU */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
set_state(sscf, SSCFU_ESTABLISHED);
|
|
||||||
AA_SIG(sscf, SAAL_ESTABLISH_confirm, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCOP_RELEASE_confirm:
|
|
||||||
/* arg is: */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
set_state(sscf, SSCFU_RELEASED);
|
|
||||||
AA_SIG(sscf, SAAL_RELEASE_confirm, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
goto badsig;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCOP_DATA_indication:
|
|
||||||
/* arg is: MU */
|
|
||||||
sscf->funcs->window(sscf, sscf->aarg, 1);
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
AA_SIG(sscf, SAAL_DATA_indication, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCOP_RECOVER_indication:
|
|
||||||
/* arg is: */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_RECOVER_response, NULL, 0);
|
|
||||||
AA_SIG(sscf, SAAL_ESTABLISH_indication, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
goto badsig;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCOP_RESYNC_indication:
|
|
||||||
/* arg is: UU */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_RESYNC_response, NULL, 0);
|
|
||||||
AA_SIG(sscf, SAAL_ESTABLISH_indication, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCOP_RESYNC_confirm:
|
|
||||||
/* arg is: */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
set_state(sscf, SSCFU_ESTABLISHED);
|
|
||||||
AA_SIG(sscf, SAAL_ESTABLISH_confirm, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCOP_UDATA_indication:
|
|
||||||
/* arg is: MD */
|
|
||||||
AA_SIG(sscf, SAAL_UDATA_indication, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case SSCOP_RETRIEVE_indication:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCOP_RETRIEVE_COMPL_indication:
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCOP_ESTABLISH_request:
|
|
||||||
case SSCOP_RELEASE_request:
|
|
||||||
case SSCOP_ESTABLISH_response:
|
|
||||||
case SSCOP_DATA_request:
|
|
||||||
case SSCOP_RECOVER_response:
|
|
||||||
case SSCOP_RESYNC_request:
|
|
||||||
case SSCOP_RESYNC_response:
|
|
||||||
case SSCOP_UDATA_request:
|
|
||||||
case SSCOP_RETRIEVE_request:
|
|
||||||
ASSERT(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sscfu_unqueue(sscf);
|
|
||||||
return;
|
|
||||||
|
|
||||||
badsig:
|
|
||||||
VERBOSE(sscf, SSCFU_DBG_ERR, (sscf, sscf->aarg,
|
|
||||||
"bad signal %d. in state %s", sig, sscf_states[sscf->state]));
|
|
||||||
sscfu_unqueue(sscf);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Handle signals from the user
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
sscfu_dosig(struct sscfu *sscf, enum saal_sig sig, struct SSCFU_MBUF_T *m)
|
|
||||||
{
|
|
||||||
VERBOSE(sscf, SSCFU_DBG_EXEC, (sscf, sscf->aarg,
|
|
||||||
"executing signal %s(%s)",
|
|
||||||
sscf_sigs[sig], sscf_states[sscf->state]));
|
|
||||||
|
|
||||||
switch (sig) {
|
|
||||||
|
|
||||||
case SAAL_ESTABLISH_request:
|
|
||||||
/* arg is opt UU */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
set_state(sscf, SSCFU_AWAITING_ESTABLISH);
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_ESTABLISH_request, m, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
set_state(sscf, SSCFU_AWAITING_ESTABLISH);
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_ESTABLISH_request, m, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
set_state(sscf, SSCFU_RESYNC);
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_RESYNC_request, m, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_RELEASE_request:
|
|
||||||
/* arg is opt UU */
|
|
||||||
switch(sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
AA_SIG(sscf, SAAL_RELEASE_confirm, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
set_state(sscf, SSCFU_AWAITING_RELEASE);
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_RELEASE_request, m, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
if (m)
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
set_state(sscf, SSCFU_AWAITING_RELEASE);
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_RELEASE_request, m, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
set_state(sscf, SSCFU_AWAITING_RELEASE);
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_RELEASE_request, m, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_DATA_request:
|
|
||||||
/* arg is DATA */
|
|
||||||
switch (sscf->state) {
|
|
||||||
|
|
||||||
case SSCFU_RELEASED:
|
|
||||||
case SSCFU_AWAITING_ESTABLISH:
|
|
||||||
case SSCFU_AWAITING_RELEASE:
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
|
|
||||||
case SSCFU_ESTABLISHED:
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_DATA_request, m, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSCFU_RESYNC:
|
|
||||||
MBUF_FREE(m);
|
|
||||||
goto badsig;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_UDATA_request:
|
|
||||||
/* arg is UDATA */
|
|
||||||
SSCOP_AASIG(sscf, SSCOP_UDATA_request, m, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_ESTABLISH_indication:
|
|
||||||
case SAAL_ESTABLISH_confirm:
|
|
||||||
case SAAL_RELEASE_confirm:
|
|
||||||
case SAAL_RELEASE_indication:
|
|
||||||
case SAAL_DATA_indication:
|
|
||||||
case SAAL_UDATA_indication:
|
|
||||||
ASSERT(0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
|
|
||||||
badsig:
|
|
||||||
VERBOSE(sscf, SSCFU_DBG_ERR, (sscf, sscf->aarg,
|
|
||||||
"bad signal %s in state %s", sscf_sigs[sig],
|
|
||||||
sscf_states[sscf->state]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Handle user signal.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
sscfu_saalsig(struct sscfu *sscf, enum saal_sig sig, struct SSCFU_MBUF_T *m)
|
|
||||||
{
|
|
||||||
struct sscfu_sig *s;
|
|
||||||
|
|
||||||
if (sscf->inhand) {
|
|
||||||
VERBOSE(sscf, SSCFU_DBG_EXEC, (sscf, sscf->aarg,
|
|
||||||
"queuing user signal %s(%s)",
|
|
||||||
sscf_sigs[sig], sscf_states[sscf->state]));
|
|
||||||
SIG_ALLOC(s);
|
|
||||||
if (s == NULL)
|
|
||||||
return (ENOMEM);
|
|
||||||
s->sig = sig;
|
|
||||||
s->m = m;
|
|
||||||
SIGQ_APPEND(&sscf->sigs, s);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sscf->inhand = 1;
|
|
||||||
sscfu_dosig(sscf, sig, m);
|
|
||||||
sscfu_unqueue(sscf);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unqueue all qeueued signals. Must be called with inhand==1.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
sscfu_unqueue(struct sscfu *sscf)
|
|
||||||
{
|
|
||||||
struct sscfu_sig *s;
|
|
||||||
|
|
||||||
while ((s = SIGQ_GET(&sscf->sigs)) != NULL) {
|
|
||||||
sscfu_dosig(sscf, s->sig, s->m);
|
|
||||||
SIG_FREE(s);
|
|
||||||
}
|
|
||||||
sscf->inhand = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
sscfu_setdebug(struct sscfu *sscf, u_int n)
|
|
||||||
{
|
|
||||||
sscf->debug = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
u_int
|
|
||||||
sscfu_getdebug(const struct sscfu *sscf)
|
|
||||||
{
|
|
||||||
return (sscf->debug);
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,103 +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/saal/sscfu.h,v 1.4 2004/07/08 08:22:15 brandt Exp $
|
|
||||||
*
|
|
||||||
* Public include file for UNI SSCF
|
|
||||||
*/
|
|
||||||
#ifndef _NETNATM_SAAL_SSCFU_H_
|
|
||||||
#define _NETNATM_SAAL_SSCFU_H_
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <netnatm/saal/sscopdef.h>
|
|
||||||
#include <netnatm/saal/sscfudef.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define how a buffer looks like.
|
|
||||||
*/
|
|
||||||
#ifdef _KERNEL
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#define SSCFU_MBUF_T mbuf
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define SSCFU_MBUF_T uni_msg
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct SSCFU_MBUF_T;
|
|
||||||
struct sscfu;
|
|
||||||
|
|
||||||
/* functions to be supplied by the SSCOP user */
|
|
||||||
struct sscfu_funcs {
|
|
||||||
/* upper (SAAL) interface output */
|
|
||||||
void (*send_upper)(struct sscfu *, void *, enum saal_sig,
|
|
||||||
struct SSCFU_MBUF_T *);
|
|
||||||
|
|
||||||
/* lower (SSCOP) interface output */
|
|
||||||
void (*send_lower)(struct sscfu *, void *, enum sscop_aasig,
|
|
||||||
struct SSCFU_MBUF_T *, u_int);
|
|
||||||
|
|
||||||
/* function to move the SSCOP window */
|
|
||||||
void (*window)(struct sscfu *, void *, u_int);
|
|
||||||
|
|
||||||
/* debugging function */
|
|
||||||
void (*verbose)(struct sscfu *, void *, const char *, ...)
|
|
||||||
__printflike(3, 4);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Function defined by the SSCF-UNI code */
|
|
||||||
|
|
||||||
/* allocate and initialize a new SSCF instance */
|
|
||||||
struct sscfu *sscfu_create(void *, const struct sscfu_funcs *);
|
|
||||||
|
|
||||||
/* destroy an SSCF instance and free all resources */
|
|
||||||
void sscfu_destroy(struct sscfu *);
|
|
||||||
|
|
||||||
/* reset the SSCF to the released state */
|
|
||||||
void sscfu_reset(struct sscfu *);
|
|
||||||
|
|
||||||
/* lower input interface (SSCOP signals) */
|
|
||||||
void sscfu_input(struct sscfu *, enum sscop_aasig, struct SSCFU_MBUF_T *, u_int);
|
|
||||||
|
|
||||||
/* upper input interface (SAAL) */
|
|
||||||
int sscfu_saalsig(struct sscfu *, enum saal_sig, struct SSCFU_MBUF_T *);
|
|
||||||
|
|
||||||
/* retrieve the current state */
|
|
||||||
enum sscfu_state sscfu_getstate(const struct sscfu *);
|
|
||||||
|
|
||||||
/* char'ify signals and states */
|
|
||||||
const char *sscfu_signame(enum saal_sig);
|
|
||||||
const char *sscfu_statename(enum sscfu_state);
|
|
||||||
|
|
||||||
/* retrieve the default set of parameters for SSCOP */
|
|
||||||
u_int sscfu_getdefparam(struct sscop_param *);
|
|
||||||
|
|
||||||
/* get/set debugging flags */
|
|
||||||
void sscfu_setdebug(struct sscfu *, u_int);
|
|
||||||
u_int sscfu_getdebug(const struct sscfu *);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,73 +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/saal/sscfudef.h,v 1.4 2004/07/08 08:22:16 brandt Exp $
|
|
||||||
*
|
|
||||||
* Definitions of UNI SSCF constants.
|
|
||||||
*/
|
|
||||||
#ifndef _NETNATM_SAAL_SSCFUDEF_H_
|
|
||||||
#define _NETNATM_SAAL_SSCFUDEF_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Signals at the upper boundary of the SSCF.
|
|
||||||
*/
|
|
||||||
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) */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* States of the SSCF
|
|
||||||
*/
|
|
||||||
enum sscfu_state {
|
|
||||||
SSCFU_RELEASED, /* 1/1 */
|
|
||||||
SSCFU_AWAITING_ESTABLISH, /* 2/2 */
|
|
||||||
SSCFU_AWAITING_RELEASE, /* 4/10 */
|
|
||||||
SSCFU_ESTABLISHED, /* 3/4 */
|
|
||||||
SSCFU_RESYNC, /* 2/5 */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Debugging flags
|
|
||||||
*/
|
|
||||||
enum {
|
|
||||||
SSCFU_DBG_LSIG = 0x01,
|
|
||||||
SSCFU_DBG_ERR = 0x02,
|
|
||||||
SSCFU_DBG_STATE = 0x04,
|
|
||||||
SSCFU_DBG_EXEC = 0x08,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,66 +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/saal/sscfupriv.h,v 1.3 2003/09/19 12:02:03 hbb Exp $
|
|
||||||
*
|
|
||||||
* Private SSCF-UNI definitions.
|
|
||||||
*/
|
|
||||||
#ifdef _KERNEL
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#include <netgraph/atm/sscfu/ng_sscfu_cust.h>
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#include "sscfucust.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Structure for signal queueing.
|
|
||||||
*/
|
|
||||||
struct sscfu_sig {
|
|
||||||
sscfu_sigq_link_t link; /* link to next signal */
|
|
||||||
enum saal_sig sig; /* the signal */
|
|
||||||
struct SSCFU_MBUF_T *m; /* associated message */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sscfu {
|
|
||||||
enum sscfu_state state; /* SSCF state */
|
|
||||||
const struct sscfu_funcs *funcs; /* func vector */
|
|
||||||
void *aarg; /* user arg */
|
|
||||||
int inhand; /* need to queue signals */
|
|
||||||
sscfu_sigq_head_t sigs; /* signal queue */
|
|
||||||
u_int debug; /* debugging flags */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Debugging
|
|
||||||
*/
|
|
||||||
#ifdef SSCFU_DEBUG
|
|
||||||
#define VERBOSE(S,M,F) if ((S)->debug & (M)) (S)->funcs->verbose F
|
|
||||||
#else
|
|
||||||
#define VERBOSE(S,M,F)
|
|
||||||
#endif
|
|
@ -1,126 +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/saal/sscop.h,v 1.4 2004/07/08 08:22:16 brandt Exp $
|
|
||||||
*
|
|
||||||
* External interface to sscop.
|
|
||||||
*/
|
|
||||||
#ifndef _NETNATM_SAAL_SSCOP_H_
|
|
||||||
#define _NETNATM_SAAL_SSCOP_H_
|
|
||||||
|
|
||||||
#include <netnatm/saal/sscopdef.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define how a buffer looks like.
|
|
||||||
*/
|
|
||||||
#ifdef _KERNEL
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#define SSCOP_MBUF_T mbuf
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define SSCOP_MBUF_T uni_msg
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct SSCOP_MBUF_T;
|
|
||||||
struct sscop;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Vector for user functions
|
|
||||||
*/
|
|
||||||
struct sscop_funcs {
|
|
||||||
/* management signal from SSCOP */
|
|
||||||
void (*send_manage)(struct sscop *, void *, enum sscop_maasig,
|
|
||||||
struct SSCOP_MBUF_T *, u_int, u_int);
|
|
||||||
|
|
||||||
/* AAL signal from SSCOP */
|
|
||||||
void (*send_upper)(struct sscop *, void *, enum sscop_aasig,
|
|
||||||
struct SSCOP_MBUF_T *, u_int);
|
|
||||||
|
|
||||||
/* send a PDU to the wire */
|
|
||||||
void (*send_lower)(struct sscop *, void *,
|
|
||||||
struct SSCOP_MBUF_T *);
|
|
||||||
|
|
||||||
/* print a message */
|
|
||||||
void (*verbose)(struct sscop *, void *, const char *, ...)
|
|
||||||
__printflike(3,4);
|
|
||||||
|
|
||||||
#ifndef _KERNEL
|
|
||||||
/* start a timer */
|
|
||||||
void *(*start_timer)(struct sscop *, void *, u_int,
|
|
||||||
void (*)(void *));
|
|
||||||
|
|
||||||
/* stop a timer */
|
|
||||||
void (*stop_timer)(struct sscop *, void *, void *);
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Function defined by the SSCOP code */
|
|
||||||
|
|
||||||
/* create a new SSCOP instance and initialize to default values */
|
|
||||||
struct sscop *sscop_create(void *, const struct sscop_funcs *);
|
|
||||||
|
|
||||||
/* destroy an SSCOP instance */
|
|
||||||
void sscop_destroy(struct sscop *);
|
|
||||||
|
|
||||||
/* get the current parameters of an SSCOP */
|
|
||||||
void sscop_getparam(const struct sscop *, struct sscop_param *);
|
|
||||||
|
|
||||||
/* set new parameters in an SSCOP */
|
|
||||||
int sscop_setparam(struct sscop *, struct sscop_param *, u_int *);
|
|
||||||
|
|
||||||
/* deliver an signal to the SSCOP */
|
|
||||||
int sscop_aasig(struct sscop *, enum sscop_aasig, struct SSCOP_MBUF_T *, u_int);
|
|
||||||
|
|
||||||
/* deliver an management signal to the SSCOP */
|
|
||||||
int sscop_maasig(struct sscop *, enum sscop_maasig, struct SSCOP_MBUF_T *);
|
|
||||||
|
|
||||||
/* SSCOP input function */
|
|
||||||
void sscop_input(struct sscop *, struct SSCOP_MBUF_T *);
|
|
||||||
|
|
||||||
/* Move the window by a given number of messages. Return the new window */
|
|
||||||
u_int sscop_window(struct sscop *, u_int);
|
|
||||||
|
|
||||||
/* declare the lower layer busy or not busy */
|
|
||||||
u_int sscop_setbusy(struct sscop *, int);
|
|
||||||
|
|
||||||
/* retrieve the state */
|
|
||||||
enum sscop_state sscop_getstate(const struct sscop *);
|
|
||||||
|
|
||||||
/* map signals to strings */
|
|
||||||
const char *sscop_msigname(enum sscop_maasig);
|
|
||||||
const char *sscop_signame(enum sscop_aasig);
|
|
||||||
const char *sscop_statename(enum sscop_state);
|
|
||||||
|
|
||||||
/* set/get debugging state */
|
|
||||||
void sscop_setdebug(struct sscop *, u_int);
|
|
||||||
u_int sscop_getdebug(const struct sscop *);
|
|
||||||
|
|
||||||
/* reset the instance */
|
|
||||||
void sscop_reset(struct sscop *);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,159 +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/saal/sscopdef.h,v 1.4 2004/07/08 08:22:17 brandt Exp $
|
|
||||||
*
|
|
||||||
* Definitions of SSCOP constants and parameter blocks. This is seen by
|
|
||||||
* the outside world.
|
|
||||||
*/
|
|
||||||
#ifndef _NETNATM_SAAL_SSCOPDEF_H_
|
|
||||||
#define _NETNATM_SAAL_SSCOPDEF_H_
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef _KERNEL
|
|
||||||
#include <sys/stdint.h>
|
|
||||||
#else
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* AA-interface signals
|
|
||||||
*/
|
|
||||||
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,/* -> */
|
|
||||||
};
|
|
||||||
|
|
||||||
enum sscop_maasig {
|
|
||||||
SSCOP_MDATA_request, /* <- MU */
|
|
||||||
SSCOP_MDATA_indication, /* -> MU */
|
|
||||||
SSCOP_MERROR_indication, /* -> CODE, CNT */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Values for retrieval. Numbers in SSCOP are 24bit, so
|
|
||||||
* we can use the large values
|
|
||||||
*/
|
|
||||||
enum {
|
|
||||||
SSCOP_MAXSEQNO = 0xffffff,
|
|
||||||
|
|
||||||
SSCOP_RETRIEVE_UNKNOWN = SSCOP_MAXSEQNO + 1,
|
|
||||||
SSCOP_RETRIEVE_TOTAL = SSCOP_MAXSEQNO + 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SSCOP states
|
|
||||||
*/
|
|
||||||
enum sscop_state {
|
|
||||||
SSCOP_IDLE, /* initial state */
|
|
||||||
SSCOP_OUT_PEND, /* outgoing connection pending */
|
|
||||||
SSCOP_IN_PEND, /* incoming connection pending */
|
|
||||||
SSCOP_OUT_DIS_PEND, /* outgoing disconnect pending */
|
|
||||||
SSCOP_OUT_RESYNC_PEND, /* outgoing resynchronisation pending */
|
|
||||||
SSCOP_IN_RESYNC_PEND, /* incoming resynchronisation pending */
|
|
||||||
SSCOP_OUT_REC_PEND, /* outgoing recovery pending */
|
|
||||||
SSCOP_REC_PEND, /* recovery response pending */
|
|
||||||
SSCOP_IN_REC_PEND, /* incoming recovery pending */
|
|
||||||
SSCOP_READY, /* data transfer ready */
|
|
||||||
};
|
|
||||||
#define SSCOP_NSTATES 10
|
|
||||||
|
|
||||||
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 */
|
|
||||||
};
|
|
||||||
enum {
|
|
||||||
SSCOP_ROBUST = 0x0001, /* atmf/97-0216 robustness */
|
|
||||||
SSCOP_POLLREX = 0x0002, /* send POLL after retransmit */
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
SSCOP_SET_TCC = 0x0001,
|
|
||||||
SSCOP_SET_TPOLL = 0x0002,
|
|
||||||
SSCOP_SET_TKA = 0x0004,
|
|
||||||
SSCOP_SET_TNR = 0x0008,
|
|
||||||
SSCOP_SET_TIDLE = 0x0010,
|
|
||||||
SSCOP_SET_MAXK = 0x0020,
|
|
||||||
SSCOP_SET_MAXJ = 0x0040,
|
|
||||||
SSCOP_SET_MAXCC = 0x0080,
|
|
||||||
SSCOP_SET_MAXPD = 0x0100,
|
|
||||||
SSCOP_SET_MAXSTAT = 0x0200,
|
|
||||||
SSCOP_SET_MR = 0x0400,
|
|
||||||
SSCOP_SET_ROBUST = 0x0800,
|
|
||||||
SSCOP_SET_POLLREX = 0x1000,
|
|
||||||
|
|
||||||
SSCOP_SET_ALLMASK = 0x1fff,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
SSCOP_DBG_USIG = 0x0001,
|
|
||||||
SSCOP_DBG_TIMER = 0x0002,
|
|
||||||
SSCOP_DBG_BUG = 0x0004,
|
|
||||||
SSCOP_DBG_INSIG = 0x0008,
|
|
||||||
SSCOP_DBG_STATE = 0x0010,
|
|
||||||
SSCOP_DBG_PDU = 0x0020,
|
|
||||||
SSCOP_DBG_ERR = 0x0040,
|
|
||||||
SSCOP_DBG_EXEC = 0x0080,
|
|
||||||
SSCOP_DBG_FLOW = 0x0100,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,318 +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/saal/sscoppriv.h,v 1.4 2004/07/08 08:22:17 brandt Exp $
|
|
||||||
*
|
|
||||||
* Private SSCOP definitions.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef _KERNEL
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#include <netgraph/atm/sscop/ng_sscop_cust.h>
|
|
||||||
#endif
|
|
||||||
#else /* !_KERNEL */
|
|
||||||
#include "sscopcust.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Argh. BSDi */
|
|
||||||
#ifndef _BYTE_ORDER
|
|
||||||
#ifndef BYTE_ORDER
|
|
||||||
#error "_BYTE_ORDER not defined"
|
|
||||||
#endif
|
|
||||||
#define _BYTE_ORDER BYTE_ORDER
|
|
||||||
#define _LITTLE_ENDIAN LITTLE_ENDIAN
|
|
||||||
#define _BIG_ENDIAN BIG_ENDIAN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PDU trailer
|
|
||||||
*/
|
|
||||||
union pdu {
|
|
||||||
u_int sscop_null;
|
|
||||||
struct {
|
|
||||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
|
||||||
u_int pl : 2; /* pad length */
|
|
||||||
u_int : 1; /* reserved field */
|
|
||||||
u_int s : 1; /* source */
|
|
||||||
u_int type : 4; /* PDU type */
|
|
||||||
u_int ns : 24; /* sequence number */
|
|
||||||
#else
|
|
||||||
u_int ns : 24; /* sequence number */
|
|
||||||
u_int type : 4; /* PDU type */
|
|
||||||
u_int s : 1; /* source */
|
|
||||||
u_int : 1; /* reserved field */
|
|
||||||
u_int pl : 2; /* pad length */
|
|
||||||
#endif
|
|
||||||
} ss;
|
|
||||||
};
|
|
||||||
#define sscop_pl ss.pl
|
|
||||||
#define sscop_s ss.s
|
|
||||||
#define sscop_type ss.type
|
|
||||||
#define sscop_ns ss.ns
|
|
||||||
|
|
||||||
/*
|
|
||||||
* seqno list entry format
|
|
||||||
*/
|
|
||||||
union seqno {
|
|
||||||
u_int sscop_null;
|
|
||||||
struct {
|
|
||||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
|
||||||
u_int : 8; /* pad */
|
|
||||||
u_int n : 24; /* seqno */
|
|
||||||
#else
|
|
||||||
u_int n : 24; /* seqno */
|
|
||||||
u_int : 8; /* pad */
|
|
||||||
#endif
|
|
||||||
} ss;
|
|
||||||
};
|
|
||||||
#define sscop_n ss.n
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Begin pdu
|
|
||||||
*/
|
|
||||||
union bgn {
|
|
||||||
u_int sscop_null;
|
|
||||||
struct {
|
|
||||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
|
||||||
u_int : 24; /* reserved */
|
|
||||||
u_int bgns : 8; /* VT_MR */
|
|
||||||
#else
|
|
||||||
u_int bgns : 8; /* VT_MR */
|
|
||||||
u_int : 24; /* reserved */
|
|
||||||
#endif
|
|
||||||
} ss;
|
|
||||||
};
|
|
||||||
#define sscop_bgns ss.bgns
|
|
||||||
|
|
||||||
/*
|
|
||||||
* pdu types
|
|
||||||
*/
|
|
||||||
enum pdu_type {
|
|
||||||
PDU_BGN = 0x1, /* request initialization */
|
|
||||||
PDU_BGAK = 0x2, /* request acknowledgement */
|
|
||||||
PDU_END = 0x3, /* disconnect command */
|
|
||||||
PDU_ENDAK = 0x4, /* disconnect acknowledgement */
|
|
||||||
PDU_RS = 0x5, /* resynchronisation command */
|
|
||||||
PDU_RSAK = 0x6, /* resynchronisation acknowledgement */
|
|
||||||
PDU_BGREJ = 0x7, /* connection reject */
|
|
||||||
PDU_SD = 0x8, /* sequenced connection-mode data */
|
|
||||||
PDU_ER = 0x9, /* recovery command */
|
|
||||||
PDU_POLL = 0xa, /* xmit state info with req. for recv state */
|
|
||||||
PDU_STAT = 0xb, /* solicited receiver state info */
|
|
||||||
PDU_USTAT = 0xc, /* unsolicited receiver state info */
|
|
||||||
PDU_UD = 0xd, /* unumbered user data */
|
|
||||||
PDU_MD = 0xe, /* unumbered management data */
|
|
||||||
PDU_ERAK = 0xf, /* recovery acknowledgement */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These are all signals, that are used by SSCOP. Don't change the order or
|
|
||||||
* number without also changing the associated tables.
|
|
||||||
*/
|
|
||||||
enum sscop_sigtype {
|
|
||||||
/* received PDU's */
|
|
||||||
SIG_BGN, /* request initialization */
|
|
||||||
SIG_BGAK, /* request acknowledgement */
|
|
||||||
SIG_END, /* disconnect command */
|
|
||||||
SIG_ENDAK, /* disconnect acknowledgement */
|
|
||||||
SIG_RS, /* resynchronisation command */
|
|
||||||
SIG_RSAK, /* resynchronisation acknowledgement */
|
|
||||||
SIG_BGREJ, /* connection reject */
|
|
||||||
SIG_SD, /* sequenced connection-mode data */
|
|
||||||
SIG_ER, /* recovery command */
|
|
||||||
SIG_POLL, /* xmitter state info with req for recv state */
|
|
||||||
SIG_STAT, /* solicited receiver state info */
|
|
||||||
SIG_USTAT, /* unsolicited receiver state info */
|
|
||||||
SIG_UD, /* unumbered user data */
|
|
||||||
SIG_MD, /* unumbered management data */
|
|
||||||
SIG_ERAK, /* recovery acknoledgement */
|
|
||||||
|
|
||||||
/* timer expiry */
|
|
||||||
SIG_T_CC, /* CC timer */
|
|
||||||
SIG_T_POLL, /* POLL timer */
|
|
||||||
SIG_T_KA, /* KEEP ALIVE timer */
|
|
||||||
SIG_T_NR, /* NO RESPONSE timer */
|
|
||||||
SIG_T_IDLE, /* IDLE timer */
|
|
||||||
|
|
||||||
/* user originated signals */
|
|
||||||
SIG_PDU_Q, /* PDU enqueued pseudosignal */
|
|
||||||
SIG_USER_DATA, /* user data request */
|
|
||||||
SIG_ESTAB_REQ, /* establish connection request */
|
|
||||||
SIG_ESTAB_RESP, /* establish connection response */
|
|
||||||
SIG_RELEASE_REQ, /* release connection request */
|
|
||||||
SIG_RECOVER, /* automatic recover response */
|
|
||||||
SIG_SYNC_REQ, /* resynchronisation request */
|
|
||||||
SIG_SYNC_RESP, /* resynchronisation response */
|
|
||||||
SIG_UDATA, /* UDATA request */
|
|
||||||
SIG_MDATA, /* MDATA request */
|
|
||||||
SIG_UPDU_Q, /* UDATA PDU enqueued pseudosignal */
|
|
||||||
SIG_MPDU_Q, /* MDATA PDU enqueued pseudosignal */
|
|
||||||
SIG_RETRIEVE, /* RETRIEVE */
|
|
||||||
|
|
||||||
/* number of signals */
|
|
||||||
SIG_NUM
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a message as contained in a sscop message queue. It holds a pointer
|
|
||||||
* to the real message.
|
|
||||||
*/
|
|
||||||
struct sscop_msg {
|
|
||||||
sscop_msgq_link_t link;
|
|
||||||
u_int seqno; /* seq no */
|
|
||||||
u_int poll_seqno; /* poll seqno (for messages in xmit buffer) */
|
|
||||||
u_int rexmit; /* in retransmission queue? */
|
|
||||||
struct SSCOP_MBUF_T *m; /* the message */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This structure is used to hold signals in the signal queue
|
|
||||||
*/
|
|
||||||
struct sscop_sig {
|
|
||||||
sscop_sigq_link_t link; /* next signal */
|
|
||||||
enum sscop_sigtype sig; /* THE signal */
|
|
||||||
struct sscop_msg *msg; /* signal argument (message) */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This structure holds the entire sscop state
|
|
||||||
*/
|
|
||||||
struct sscop {
|
|
||||||
enum sscop_state state; /* current state */
|
|
||||||
const struct sscop_funcs *funcs;
|
|
||||||
|
|
||||||
/* send state */
|
|
||||||
u_int vt_s; /* seqno for next pdu first time transmitted */
|
|
||||||
u_int vt_ps; /* current poll seqno */
|
|
||||||
u_int vt_a; /* next expected in-sequence sd pdu */
|
|
||||||
u_int vt_pa; /* poll seqno of next stat pdu */
|
|
||||||
u_int vt_ms; /* maximum allowed send sd seqno */
|
|
||||||
u_int vt_pd; /* poll data state */
|
|
||||||
u_int vt_cc; /* connection control state */
|
|
||||||
u_int vt_sq; /* transmitter connection sequence */
|
|
||||||
|
|
||||||
/* receive state */
|
|
||||||
u_int vr_r; /* receive state */
|
|
||||||
u_int vr_h; /* highes expected state */
|
|
||||||
u_int vr_mr; /* maximum acceptable */
|
|
||||||
u_int vr_sq; /* receiver connection state */
|
|
||||||
|
|
||||||
/* timers */
|
|
||||||
sscop_timer_t t_cc; /* timer_CC */
|
|
||||||
sscop_timer_t t_nr; /* timer_NO_RESPONSE */
|
|
||||||
sscop_timer_t t_ka; /* timer KEEP_ALIVE */
|
|
||||||
sscop_timer_t t_poll; /* timer_POLL */
|
|
||||||
sscop_timer_t t_idle; /* idle timer */
|
|
||||||
|
|
||||||
/* maximum values */
|
|
||||||
u_int maxj; /* maximum uu-info */
|
|
||||||
u_int maxk; /* maximum info */
|
|
||||||
u_int maxcc; /* maximum number of bgn, end, er and rs */
|
|
||||||
u_int maxpd; /* maximum value of vt_pd */
|
|
||||||
u_int maxstat; /* maximum length of list */
|
|
||||||
u_int timercc; /* connection control timer */
|
|
||||||
u_int timerka; /* keep alive timer */
|
|
||||||
u_int timernr; /* no response timer */
|
|
||||||
u_int timerpoll; /* polling */
|
|
||||||
u_int timeridle; /* idle timer */
|
|
||||||
u_int robustness; /* atmf/97-0216 robustness enhancement */
|
|
||||||
u_int poll_after_rex; /* optional POLL after re-transmission */
|
|
||||||
u_int mr; /* initial window */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* buffers and queues.
|
|
||||||
* All expect the xq hold SD PDUs.
|
|
||||||
*/
|
|
||||||
sscop_msgq_head_t xq; /* xmit queue (input from user before xmit) */
|
|
||||||
sscop_msgq_head_t uxq; /* UD xmit queue */
|
|
||||||
sscop_msgq_head_t mxq; /* MD xmit queue */
|
|
||||||
sscop_msgq_head_t xbuf; /* transmission buffer (SD PDUs transmitted) */
|
|
||||||
int rxq; /* number of PDUs in retransmission queue */
|
|
||||||
sscop_msgq_head_t rbuf; /* receive buffer (SD PDUs) */
|
|
||||||
int last_end_src; /* source field from last xmitted end pdu */
|
|
||||||
int clear_buffers; /* flag */
|
|
||||||
int credit; /* send window not closed */
|
|
||||||
u_int ll_busy; /* lower layer busy */
|
|
||||||
u_int rs_mr; /* N(MR) in last RS PDU */
|
|
||||||
u_int rs_sq; /* N(SQ) in last RS PDU */
|
|
||||||
struct SSCOP_MBUF_T *uu_bgn; /* last UU data */
|
|
||||||
struct SSCOP_MBUF_T *uu_bgak; /* ... */
|
|
||||||
struct SSCOP_MBUF_T *uu_bgrej; /* ... */
|
|
||||||
struct SSCOP_MBUF_T *uu_end; /* ... */
|
|
||||||
struct SSCOP_MBUF_T *uu_rs; /* ... */
|
|
||||||
|
|
||||||
/* signal queues */
|
|
||||||
sscop_sigq_head_t sigs; /* saved signals */
|
|
||||||
sscop_sigq_head_t saved_sigs; /* saved signals */
|
|
||||||
int in_sig; /* in signal handler */
|
|
||||||
|
|
||||||
/* debugging */
|
|
||||||
u_int debug;
|
|
||||||
|
|
||||||
/* AA interface */
|
|
||||||
void *aarg;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Default values for SSCOP
|
|
||||||
*/
|
|
||||||
enum {
|
|
||||||
MAXK = 4096,
|
|
||||||
MAXMAXK = 65528,
|
|
||||||
MAXJ = 4096,
|
|
||||||
MAXMAXJ = 65524,
|
|
||||||
MAXCC = 4,
|
|
||||||
MAXSTAT = 67,
|
|
||||||
MAXPD = 25,
|
|
||||||
MAXMR = 128, /* ??? */
|
|
||||||
TIMERCC = 1000,
|
|
||||||
TIMERKA = 2000,
|
|
||||||
TIMERNR = 7000,
|
|
||||||
TIMERPOLL = 750,
|
|
||||||
TIMERIDLE = 15000,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sequence number arithmetic
|
|
||||||
*/
|
|
||||||
#define SEQNO_DIFF(A,B) (((A) < (B)) ? ((A) + (1<<24) - (B)) : ((A) - (B)))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Debugging
|
|
||||||
*/
|
|
||||||
#ifdef SSCOP_DEBUG
|
|
||||||
#define VERBOSE(S,M,F) if ((S)->debug & (M)) (S)->funcs->verbose F
|
|
||||||
#define VERBERR(S,M,F) if ((S)->debug & (M)) (S)->funcs->verbose F
|
|
||||||
#define ISVERBOSE(S,M) ((S)->debug & (M))
|
|
||||||
#else
|
|
||||||
#define VERBOSE(S,M,F)
|
|
||||||
#define VERBERR(S,M,F)
|
|
||||||
#define ISVERBOSE(S,M) (0)
|
|
||||||
#endif
|
|
@ -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/sig/genmsgcpyc.awk,v 1.4 2004/07/08 08:22:18 brandt Exp $
|
|
||||||
#
|
|
||||||
# Generate copy functions for messages
|
|
||||||
#
|
|
||||||
function begin() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function first_entry() {
|
|
||||||
print "/* This file was created automatically"
|
|
||||||
print " * Source file: " id
|
|
||||||
print " * $FreeBSD$"
|
|
||||||
print " */"
|
|
||||||
print ""
|
|
||||||
print "#include <netnatm/msg/unistruct.h>"
|
|
||||||
print "#include <netnatm/sig/unimsgcpy.h>"
|
|
||||||
}
|
|
||||||
|
|
||||||
function end() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function start_message() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function end_message() {
|
|
||||||
print ""
|
|
||||||
print "void"
|
|
||||||
print "copy_msg_" msg "(struct uni_" msg " *src, struct uni_" msg " *dst)"
|
|
||||||
print "{"
|
|
||||||
for(i = 0; i < cnt; i++) {
|
|
||||||
if(ienum[i] != "-") {
|
|
||||||
print "\tu_int s, d;"
|
|
||||||
print ""
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(i = 0; i < cnt; i++) {
|
|
||||||
ie = iename[i]
|
|
||||||
if(ierep[i]) {
|
|
||||||
print "\tif(IE_ISGOOD(src->" ie "_repeat))"
|
|
||||||
print "\t\tdst->" ie "_repeat = src->" ie "_repeat;"
|
|
||||||
}
|
|
||||||
if(ienum[i] != "-") {
|
|
||||||
print "\tfor(s = d = 0; s < "ienum[i]"; s++)"
|
|
||||||
print "\t\tif(IE_ISGOOD(src->"ie"[s]))"
|
|
||||||
print "\t\t\tdst->"ie"[d++] = src->"ie"[s];"
|
|
||||||
} else {
|
|
||||||
print "\tif(IE_ISGOOD(src->"ie"))"
|
|
||||||
print "\t\tdst->"ie" = src->"ie";"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "}"
|
|
||||||
}
|
|
@ -1,55 +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/sig/genmsgcpyh.awk,v 1.4 2004/07/08 08:22:19 brandt Exp $
|
|
||||||
#
|
|
||||||
# Generate copy functions for messages
|
|
||||||
#
|
|
||||||
function begin() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function first_entry() {
|
|
||||||
print "/* This file was created automatically"
|
|
||||||
print " * Source file: " id
|
|
||||||
print " * $FreeBSD$"
|
|
||||||
print " */"
|
|
||||||
print ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function end() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function start_message() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function end_message() {
|
|
||||||
print ""
|
|
||||||
print "void"
|
|
||||||
print "copy_msg_" msg "(struct uni_" msg " *src, struct uni_" msg " *dst);"
|
|
||||||
print ""
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,622 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2002-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>
|
|
||||||
* Kendy Kutzner <kutzner@fokus.fraunhofer.de>
|
|
||||||
*
|
|
||||||
* $Begemot: libunimsg/netnatm/sig/sig_print.c,v 1.6 2004/08/05 07:11:02 brandt Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef _KERNEL
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/systm.h>
|
|
||||||
#include <sys/libkern.h>
|
|
||||||
#include <machine/stdarg.h>
|
|
||||||
#else
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <netnatm/saal/sscfu.h>
|
|
||||||
#include <netnatm/msg/uni_hdr.h>
|
|
||||||
#include <netnatm/msg/unistruct.h>
|
|
||||||
#include <netnatm/msg/unimsglib.h>
|
|
||||||
#include <netnatm/msg/uniprint.h>
|
|
||||||
#include <netnatm/sig/uni.h>
|
|
||||||
#include <netnatm/sig/unisig.h>
|
|
||||||
#include <netnatm/sig/unidef.h>
|
|
||||||
|
|
||||||
const char *
|
|
||||||
uni_strerr(u_int err)
|
|
||||||
{
|
|
||||||
static const char *const errstr[] = {
|
|
||||||
#define DEF(NAME, VAL, STR) [UNIAPI_##NAME] = STR,
|
|
||||||
UNIAPI_DEF_ERRORS(DEF)
|
|
||||||
#undef DEF
|
|
||||||
};
|
|
||||||
static char buf[100];
|
|
||||||
|
|
||||||
if (err >= sizeof(errstr)/sizeof(errstr[0]) || errstr[err] == NULL) {
|
|
||||||
sprintf(buf, "Unknown error %u", err);
|
|
||||||
return (buf);
|
|
||||||
}
|
|
||||||
return (errstr[err]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define D(M) [M] = #M
|
|
||||||
static const char *const msgs[] = {
|
|
||||||
D(UNIAPI_ERROR),
|
|
||||||
D(UNIAPI_CALL_CREATED),
|
|
||||||
D(UNIAPI_CALL_DESTROYED),
|
|
||||||
D(UNIAPI_PARTY_CREATED),
|
|
||||||
D(UNIAPI_PARTY_DESTROYED),
|
|
||||||
D(UNIAPI_LINK_ESTABLISH_request),
|
|
||||||
D(UNIAPI_LINK_ESTABLISH_confirm),
|
|
||||||
D(UNIAPI_LINK_RELEASE_request),
|
|
||||||
D(UNIAPI_LINK_RELEASE_confirm),
|
|
||||||
D(UNIAPI_RESET_request),
|
|
||||||
D(UNIAPI_RESET_confirm),
|
|
||||||
D(UNIAPI_RESET_indication),
|
|
||||||
D(UNIAPI_RESET_ERROR_indication),
|
|
||||||
D(UNIAPI_RESET_response),
|
|
||||||
D(UNIAPI_RESET_ERROR_response),
|
|
||||||
D(UNIAPI_RESET_STATUS_indication),
|
|
||||||
D(UNIAPI_SETUP_request),
|
|
||||||
D(UNIAPI_SETUP_indication),
|
|
||||||
D(UNIAPI_SETUP_response),
|
|
||||||
D(UNIAPI_SETUP_confirm),
|
|
||||||
D(UNIAPI_SETUP_COMPLETE_indication),
|
|
||||||
D(UNIAPI_SETUP_COMPLETE_request),
|
|
||||||
D(UNIAPI_ALERTING_request),
|
|
||||||
D(UNIAPI_ALERTING_indication),
|
|
||||||
D(UNIAPI_PROCEEDING_request),
|
|
||||||
D(UNIAPI_PROCEEDING_indication),
|
|
||||||
D(UNIAPI_RELEASE_request),
|
|
||||||
D(UNIAPI_RELEASE_indication),
|
|
||||||
D(UNIAPI_RELEASE_response),
|
|
||||||
D(UNIAPI_RELEASE_confirm),
|
|
||||||
D(UNIAPI_NOTIFY_request),
|
|
||||||
D(UNIAPI_NOTIFY_indication),
|
|
||||||
D(UNIAPI_STATUS_indication),
|
|
||||||
D(UNIAPI_STATUS_ENQUIRY_request),
|
|
||||||
D(UNIAPI_ADD_PARTY_request),
|
|
||||||
D(UNIAPI_ADD_PARTY_indication),
|
|
||||||
D(UNIAPI_PARTY_ALERTING_request),
|
|
||||||
D(UNIAPI_PARTY_ALERTING_indication),
|
|
||||||
D(UNIAPI_ADD_PARTY_ACK_request),
|
|
||||||
D(UNIAPI_ADD_PARTY_ACK_indication),
|
|
||||||
D(UNIAPI_ADD_PARTY_REJ_request),
|
|
||||||
D(UNIAPI_ADD_PARTY_REJ_indication),
|
|
||||||
D(UNIAPI_DROP_PARTY_request),
|
|
||||||
D(UNIAPI_DROP_PARTY_indication),
|
|
||||||
D(UNIAPI_DROP_PARTY_ACK_request),
|
|
||||||
D(UNIAPI_DROP_PARTY_ACK_indication),
|
|
||||||
D(UNIAPI_ABORT_CALL_request),
|
|
||||||
};
|
|
||||||
#undef D
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_print_api(char *buf, size_t bufsiz, u_int type, u_int cookie,
|
|
||||||
const void *msg, struct unicx *cx)
|
|
||||||
{
|
|
||||||
int old_dont_init = cx->dont_init;
|
|
||||||
|
|
||||||
uni_print_init(buf, bufsiz, cx);
|
|
||||||
cx->dont_init = 1;
|
|
||||||
|
|
||||||
if (type >= sizeof(msgs) / sizeof(msgs[0]) || msgs[type] == NULL) {
|
|
||||||
uni_print_flag("UNIAPI_UNKNOWN", cx);
|
|
||||||
uni_print_entry(cx, "sig", "%u", type);
|
|
||||||
uni_print_entry(cx, "cookie", "%u", cookie);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
uni_print_flag(msgs[type], cx);
|
|
||||||
uni_print_entry(cx, "cookie", "%u", cookie);
|
|
||||||
cx->indent++;
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
|
|
||||||
case UNIAPI_ERROR:
|
|
||||||
{
|
|
||||||
const struct uniapi_error *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_entry(cx, "reason", "%s", uni_strerr(api->reason));
|
|
||||||
uni_print_entry(cx, "state", "U%u", api->state);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_CALL_CREATED:
|
|
||||||
{
|
|
||||||
const struct uniapi_call_created *api = msg;
|
|
||||||
|
|
||||||
uni_print_cref(NULL, 0, &api->cref, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_CALL_DESTROYED:
|
|
||||||
{
|
|
||||||
const struct uniapi_call_destroyed *api = msg;
|
|
||||||
|
|
||||||
uni_print_cref(NULL, 0, &api->cref, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_PARTY_CREATED:
|
|
||||||
{
|
|
||||||
const struct uniapi_party_created *api = msg;
|
|
||||||
|
|
||||||
uni_print_cref(NULL, 0, &api->cref, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_EPREF,
|
|
||||||
(const union uni_ieall *)&api->epref, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_PARTY_DESTROYED:
|
|
||||||
{
|
|
||||||
const struct uniapi_party_destroyed *api = msg;
|
|
||||||
|
|
||||||
uni_print_cref(NULL, 0, &api->cref, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_EPREF,
|
|
||||||
(const union uni_ieall *)&api->epref, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_LINK_ESTABLISH_request:
|
|
||||||
case UNIAPI_LINK_ESTABLISH_confirm:
|
|
||||||
case UNIAPI_LINK_RELEASE_request:
|
|
||||||
case UNIAPI_LINK_RELEASE_confirm:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UNIAPI_RESET_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_reset_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_RESTART,
|
|
||||||
(const union uni_ieall *)&api->restart, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CONNID,
|
|
||||||
(const union uni_ieall *)&api->restart, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RESET_confirm:
|
|
||||||
{
|
|
||||||
const struct uniapi_reset_confirm *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_RESTART,
|
|
||||||
(const union uni_ieall *)&api->restart, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CONNID,
|
|
||||||
(const union uni_ieall *)&api->restart, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RESET_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_reset_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_RESTART,
|
|
||||||
(const union uni_ieall *)&api->restart, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CONNID,
|
|
||||||
(const union uni_ieall *)&api->restart, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RESET_ERROR_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_reset_error_indication *api = msg;
|
|
||||||
static const struct uni_print_tbl reason[] = {
|
|
||||||
#define DEF(NAME, VALUE, STR) { STR, VALUE },
|
|
||||||
UNIAPI_DEF_RESET_ERRORS(DEF)
|
|
||||||
#undef DEF
|
|
||||||
{ NULL, 0 }
|
|
||||||
};
|
|
||||||
static const struct uni_print_tbl source[] = {
|
|
||||||
{ "start", 0 },
|
|
||||||
{ "respond", 1 },
|
|
||||||
{ NULL, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_tbl("source", api->source, source, cx);
|
|
||||||
uni_print_tbl("reason", api->reason, reason, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RESET_response:
|
|
||||||
{
|
|
||||||
const struct uniapi_reset_response *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_RESTART,
|
|
||||||
(const union uni_ieall *)&api->restart, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CONNID,
|
|
||||||
(const union uni_ieall *)&api->restart, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RESET_ERROR_response:
|
|
||||||
{
|
|
||||||
const struct uniapi_reset_error_response *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CAUSE,
|
|
||||||
(const union uni_ieall *)&api->cause, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RESET_STATUS_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_reset_status_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_cref(NULL, 0, &api->cref, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CALLSTATE,
|
|
||||||
(const union uni_ieall *)&api->callstate, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CAUSE,
|
|
||||||
(const union uni_ieall *)&api->cause, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_SETUP_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_setup_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_SETUP,
|
|
||||||
(const union uni_msgall *)&api->setup, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_SETUP_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_setup_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_SETUP,
|
|
||||||
(const union uni_msgall *)&api->setup, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_SETUP_response:
|
|
||||||
{
|
|
||||||
const struct uniapi_setup_response *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_CONNECT,
|
|
||||||
(const union uni_msgall *)&api->connect, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_SETUP_confirm:
|
|
||||||
{
|
|
||||||
const struct uniapi_setup_confirm *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_CONNECT,
|
|
||||||
(const union uni_msgall *)&api->connect, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_SETUP_COMPLETE_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_setup_complete_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_CONNECT_ACK,
|
|
||||||
(const union uni_msgall *)&api->connect_ack, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_SETUP_COMPLETE_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_setup_complete_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_CONNECT_ACK,
|
|
||||||
(const union uni_msgall *)&api->connect_ack, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ALERTING_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_alerting_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_ALERTING,
|
|
||||||
(const union uni_msgall *)&api->alerting, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ALERTING_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_alerting_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_ALERTING,
|
|
||||||
(const union uni_msgall *)&api->alerting, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_PROCEEDING_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_proceeding_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_CALL_PROC,
|
|
||||||
(const union uni_msgall *)&api->call_proc, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_PROCEEDING_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_proceeding_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_CALL_PROC,
|
|
||||||
(const union uni_msgall *)&api->call_proc, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RELEASE_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_release_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_RELEASE,
|
|
||||||
(const union uni_msgall *)&api->release, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RELEASE_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_release_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_RELEASE,
|
|
||||||
(const union uni_msgall *)&api->release, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_RELEASE_response:
|
|
||||||
{
|
|
||||||
const struct uniapi_release_response *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_RELEASE_COMPL,
|
|
||||||
(const union uni_msgall *)&api->release_compl, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case UNIAPI_RELEASE_confirm:
|
|
||||||
{
|
|
||||||
const struct uniapi_release_confirm *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_RELEASE,
|
|
||||||
(const union uni_msgall *)&api->release, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_NOTIFY_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_notify_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_NOTIFY,
|
|
||||||
(const union uni_msgall *)&api->notify, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_NOTIFY_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_notify_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_NOTIFY,
|
|
||||||
(const union uni_msgall *)&api->notify, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_STATUS_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_status_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_cref(NULL, 0, &api->cref, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_entry(cx, "my_state", "U%u", api->my_state);
|
|
||||||
uni_print_entry(cx, "my_cause", "%s",
|
|
||||||
uni_ie_cause2str(UNI_CODING_ITU, api->my_cause));
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CALLSTATE,
|
|
||||||
(const union uni_ieall *)&api->his_state, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CAUSE,
|
|
||||||
(const union uni_ieall *)&api->his_cause, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_EPREF,
|
|
||||||
(const union uni_ieall *)&api->epref, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_STATUS_ENQUIRY_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_status_enquiry_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_cref(NULL, 0, &api->cref, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_EPREF,
|
|
||||||
(const union uni_ieall *)&api->epref, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ADD_PARTY_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_add_party_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_ADD_PARTY,
|
|
||||||
(const union uni_msgall *)&api->add, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ADD_PARTY_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_add_party_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_ADD_PARTY,
|
|
||||||
(const union uni_msgall *)&api->add, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_PARTY_ALERTING_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_party_alerting_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_PARTY_ALERTING,
|
|
||||||
(const union uni_msgall *)&api->alert, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_PARTY_ALERTING_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_party_alerting_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_PARTY_ALERTING,
|
|
||||||
(const union uni_msgall *)&api->alert, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ADD_PARTY_ACK_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_add_party_ack_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_ADD_PARTY_ACK,
|
|
||||||
(const union uni_msgall *)&api->ack, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ADD_PARTY_ACK_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_add_party_ack_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_ADD_PARTY_ACK,
|
|
||||||
(const union uni_msgall *)&api->ack, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ADD_PARTY_REJ_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_add_party_rej_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_ADD_PARTY_REJ,
|
|
||||||
(const union uni_msgall *)&api->rej, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ADD_PARTY_REJ_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_add_party_rej_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_ADD_PARTY_REJ,
|
|
||||||
(const union uni_msgall *)&api->rej, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_DROP_PARTY_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_drop_party_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_DROP_PARTY,
|
|
||||||
(const union uni_msgall *)&api->drop, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_DROP_PARTY_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_drop_party_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_DROP_PARTY,
|
|
||||||
(const union uni_msgall *)&api->drop, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_DROP_PARTY_ACK_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_drop_party_ack_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_DROP_PARTY_ACK,
|
|
||||||
(const union uni_msgall *)&api->ack, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_DROP_PARTY_ACK_indication:
|
|
||||||
{
|
|
||||||
const struct uniapi_drop_party_ack_indication *api = msg;
|
|
||||||
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_msg(NULL, 0, UNI_DROP_PARTY,
|
|
||||||
(const union uni_msgall *)&api->drop, cx);
|
|
||||||
uni_print_eol(cx);
|
|
||||||
uni_print_ie(NULL, 0, UNI_IE_CRANKBACK,
|
|
||||||
(const union uni_ieall *)&api->crankback, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case UNIAPI_ABORT_CALL_request:
|
|
||||||
{
|
|
||||||
const struct uniapi_abort_call_request *api = msg;
|
|
||||||
|
|
||||||
uni_print_cref(NULL, 0, &api->cref, cx);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
cx->dont_init = old_dont_init;
|
|
||||||
}
|
|
@ -1,827 +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/sig/sig_reset.c,v 1.11 2004/08/05 07:11:03 brandt Exp $
|
|
||||||
*
|
|
||||||
* Reset-start and reset-respond
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <netnatm/unimsg.h>
|
|
||||||
#include <netnatm/saal/sscfudef.h>
|
|
||||||
#include <netnatm/msg/unistruct.h>
|
|
||||||
#include <netnatm/msg/unimsglib.h>
|
|
||||||
#include <netnatm/sig/uni.h>
|
|
||||||
|
|
||||||
#include <netnatm/sig/unipriv.h>
|
|
||||||
#include <netnatm/sig/unimkmsg.h>
|
|
||||||
|
|
||||||
static void response_restart(struct uni *, struct uni_msg *, struct uni_all *);
|
|
||||||
static void response_status(struct uni *, struct uni_msg *, struct uni_all *);
|
|
||||||
|
|
||||||
static void response_t317(struct uni *);
|
|
||||||
|
|
||||||
static void response_error(struct uni *, struct uniapi_reset_error_response *,
|
|
||||||
uint32_t cookie);
|
|
||||||
static void response_response(struct uni *, struct uniapi_reset_response *,
|
|
||||||
uint32_t);
|
|
||||||
|
|
||||||
static void start_request(struct uni *, struct uniapi_reset_request *,
|
|
||||||
uint32_t);
|
|
||||||
|
|
||||||
static void start_t316(struct uni *);
|
|
||||||
|
|
||||||
static void start_restart_ack(struct uni *, struct uni_msg *, struct uni_all *);
|
|
||||||
static void start_status(struct uni *, struct uni_msg *, struct uni_all *);
|
|
||||||
|
|
||||||
static int restart_forward(struct uni *, const struct uni_all *);
|
|
||||||
|
|
||||||
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] = "SIG"#NAME,
|
|
||||||
static const char *const start_sigs[] = {
|
|
||||||
DEF_START_SIGS
|
|
||||||
};
|
|
||||||
#undef DEF_PRIV_SIG
|
|
||||||
|
|
||||||
#define DEF_PRIV_SIG(NAME, FROM) [SIG##NAME] = "SIG"#NAME,
|
|
||||||
static const char *const respond_sigs[] = {
|
|
||||||
DEF_RESPOND_SIGS
|
|
||||||
};
|
|
||||||
#undef DEF_PRIV_SIG
|
|
||||||
|
|
||||||
TIMER_FUNC_UNI(t317, t317_func)
|
|
||||||
TIMER_FUNC_UNI(t316, t316_func)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset-Start process.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_sig_start(struct uni *uni, u_int sig, uint32_t cookie,
|
|
||||||
struct uni_msg *m, struct uni_all *u)
|
|
||||||
{
|
|
||||||
if (sig >= SIGS_END) {
|
|
||||||
VERBOSE(uni, UNI_FAC_ERR, 1, "Signal %d outside of range to "
|
|
||||||
"Reset-Start", sig);
|
|
||||||
if (m)
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
if (u)
|
|
||||||
UNI_FREE(u);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1,
|
|
||||||
"Signal %s in state %u of Reset-Start; cookie %u",
|
|
||||||
start_sigs[sig], uni->glob_start, cookie);
|
|
||||||
|
|
||||||
switch (sig) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* User requests
|
|
||||||
*/
|
|
||||||
case SIGS_RESET_request:
|
|
||||||
start_request(uni,
|
|
||||||
uni_msg_rptr(m, struct uniapi_reset_request *), cookie);
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Timers
|
|
||||||
*/
|
|
||||||
case SIGS_T316:
|
|
||||||
start_t316(uni);
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SAAL
|
|
||||||
*/
|
|
||||||
case SIGS_RESTART_ACK:
|
|
||||||
start_restart_ack(uni, m, u);
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
UNI_FREE(u);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIGS_STATUS:
|
|
||||||
start_status(uni, m, u);
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
UNI_FREE(u);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIGS_END:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset-request from USER.
|
|
||||||
*
|
|
||||||
* Q.2931:Reset-Start 1/2
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
start_request(struct uni *uni, struct uniapi_reset_request *req, uint32_t cookie)
|
|
||||||
{
|
|
||||||
struct uni_all *resp;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
if (uni->glob_start != UNI_CALLSTATE_REST0) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_BAD_CALLSTATE, cookie, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((resp = UNI_ALLOC()) == NULL) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_NOMEM, cookie, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MK_MSG_ORIG(resp, UNI_RESTART, 0, 0);
|
|
||||||
resp->u.restart.restart = req->restart;
|
|
||||||
resp->u.restart.connid = req->connid;
|
|
||||||
|
|
||||||
if (restart_forward(uni, resp))
|
|
||||||
return;
|
|
||||||
|
|
||||||
uni->connid_start = req->connid;
|
|
||||||
uni->restart_start = req->restart;
|
|
||||||
|
|
||||||
if ((err = uni_send_output(resp, uni)) != 0)
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_ENCODING, cookie, 0);
|
|
||||||
UNI_FREE(resp);
|
|
||||||
if (err)
|
|
||||||
return;
|
|
||||||
|
|
||||||
uni->cnt316 = 0;
|
|
||||||
TIMER_START_UNI(uni, t316, uni->timer316);
|
|
||||||
uni->glob_start = UNI_CALLSTATE_REST1;
|
|
||||||
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start state := 1");
|
|
||||||
|
|
||||||
|
|
||||||
uniapi_uni_error(uni, UNIAPI_OK, cookie, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* T316 timeout function
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
t316_func(struct uni *uni)
|
|
||||||
{
|
|
||||||
uni_enq_start(uni, SIGS_T316, 0, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Q.2931:Reset-Start 1/2
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
start_t316(struct uni *uni)
|
|
||||||
{
|
|
||||||
if (uni->glob_start != UNI_CALLSTATE_REST1) {
|
|
||||||
VERBOSE0(uni, UNI_FAC_ERR, "T316 in state %d",
|
|
||||||
uni->glob_start);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (++uni->cnt316 == uni->init316) {
|
|
||||||
struct uni_msg *app;
|
|
||||||
struct uniapi_reset_error_indication *resp;
|
|
||||||
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start error");
|
|
||||||
|
|
||||||
resp = ALLOC_API(struct uniapi_reset_error_indication, app);
|
|
||||||
if (resp != NULL) {
|
|
||||||
resp->source = 0;
|
|
||||||
resp->reason = UNIAPI_RESET_ERROR_NO_RESPONSE,
|
|
||||||
|
|
||||||
uni->funcs->uni_output(uni, uni->arg,
|
|
||||||
UNIAPI_RESET_ERROR_indication, 0, app);
|
|
||||||
}
|
|
||||||
|
|
||||||
uni->glob_start = UNI_CALLSTATE_REST0;
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start state := 0");
|
|
||||||
} else {
|
|
||||||
struct uni_all *resp;
|
|
||||||
|
|
||||||
if ((resp = UNI_ALLOC()) == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
MK_MSG_ORIG(resp, UNI_RESTART, 0, 0);
|
|
||||||
resp->u.restart.restart = uni->restart_start;
|
|
||||||
resp->u.restart.connid = uni->connid_start;
|
|
||||||
|
|
||||||
(void)uni_send_output(resp, uni);
|
|
||||||
|
|
||||||
UNI_FREE(resp);
|
|
||||||
|
|
||||||
TIMER_START_UNI(uni, t316, uni->timer316);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Got RESTART_ACK.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
start_restart_ack(struct uni *uni, struct uni_msg *m, struct uni_all *u)
|
|
||||||
{
|
|
||||||
enum uni_callstate new_state;
|
|
||||||
struct uniapi_reset_confirm *conf;
|
|
||||||
struct uni_msg *app;
|
|
||||||
|
|
||||||
if (uni->glob_start == UNI_CALLSTATE_REST0) {
|
|
||||||
uni_respond_status_mtype(uni, &u->u.hdr.cref, uni->glob_start,
|
|
||||||
UNI_CAUSE_MSG_INCOMP, UNI_RESTART_ACK);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uni->glob_start != UNI_CALLSTATE_REST1) {
|
|
||||||
ASSERT(0, ("bad global call state in Reset-Start"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If body decoding fails, this is because IEs are wrong.
|
|
||||||
*/
|
|
||||||
(void)uni_decode_body(m, u, &uni->cx);
|
|
||||||
MANDATE_IE(uni, u->u.restart_ack.restart, UNI_IE_RESTART);
|
|
||||||
|
|
||||||
if (IE_ISGOOD(u->u.restart_ack.restart)) {
|
|
||||||
/*
|
|
||||||
* Q.2931: 5.5.2.2
|
|
||||||
*/
|
|
||||||
if (u->u.restart_ack.restart.rclass == UNI_RESTART_ALL &&
|
|
||||||
IE_ISGOOD(u->u.restart_ack.connid)) {
|
|
||||||
(void)UNI_SAVE_IERR(&uni->cx, UNI_IE_CONNID,
|
|
||||||
u->u.restart_ack.connid.h.act,
|
|
||||||
UNI_IERR_UNK);
|
|
||||||
} else if ((u->u.restart_ack.restart.rclass == UNI_RESTART_PATH ||
|
|
||||||
u->u.restart_ack.restart.rclass == UNI_RESTART_CHANNEL)) {
|
|
||||||
MANDATE_IE(uni, u->u.restart_ack.connid, UNI_IE_CONNID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Compare the information elements now, because
|
|
||||||
* we may need the new callstate for the status message
|
|
||||||
* below.
|
|
||||||
*/
|
|
||||||
new_state = UNI_CALLSTATE_REST1;
|
|
||||||
|
|
||||||
if (IE_ISGOOD(u->u.restart_ack.restart) &&
|
|
||||||
IE_ISGOOD(uni->restart_start) &&
|
|
||||||
u->u.restart_ack.restart.rclass == uni->restart_start.rclass &&
|
|
||||||
!IE_ISGOOD(u->u.restart_ack.connid) == !IE_ISGOOD(uni->connid_start) &&
|
|
||||||
(!IE_ISGOOD(uni->connid_start) ||
|
|
||||||
(u->u.restart_ack.connid.vpci == uni->connid_start.vpci &&
|
|
||||||
u->u.restart_ack.connid.vci == uni->connid_start.vci)))
|
|
||||||
new_state = UNI_CALLSTATE_REST0;
|
|
||||||
|
|
||||||
switch (uni_verify(uni, u->u.hdr.act)) {
|
|
||||||
case VFY_RAIM:
|
|
||||||
case VFY_RAI:
|
|
||||||
uni_respond_status_verify(uni, &u->u.hdr.cref,
|
|
||||||
UNI_CALLSTATE_REST1, NULL, 0);
|
|
||||||
case VFY_I:
|
|
||||||
return;
|
|
||||||
|
|
||||||
case VFY_CLR:
|
|
||||||
uni->glob_start = UNI_CALLSTATE_REST0;
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1,
|
|
||||||
"Reset-Start state := 0");
|
|
||||||
return;
|
|
||||||
|
|
||||||
case VFY_RAP:
|
|
||||||
case VFY_RAPU:
|
|
||||||
uni_respond_status_verify(uni, &u->u.hdr.cref,
|
|
||||||
new_state, NULL, 0);
|
|
||||||
case VFY_OK:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_state == UNI_CALLSTATE_REST1)
|
|
||||||
/*
|
|
||||||
* Q.2931: 5.5.1.2/2
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Build restart.confirm signal for application
|
|
||||||
*/
|
|
||||||
if (!IE_ISGOOD(u->u.restart_ack.connid))
|
|
||||||
u->u.restart.connid.h.present = 0;
|
|
||||||
|
|
||||||
|
|
||||||
if ((conf = ALLOC_API(struct uniapi_reset_confirm, app)) == NULL)
|
|
||||||
return;
|
|
||||||
conf->restart = u->u.restart.restart;
|
|
||||||
conf->connid = u->u.restart.connid;
|
|
||||||
|
|
||||||
TIMER_STOP_UNI(uni, t316);
|
|
||||||
|
|
||||||
uni->funcs->uni_output(uni, uni->arg, UNIAPI_RESET_confirm, 0, app);
|
|
||||||
|
|
||||||
uni->glob_start = UNI_CALLSTATE_REST0;
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start state := 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset-Start got a STATUS message.
|
|
||||||
*
|
|
||||||
* Q.2931: Reset-Start 2/2
|
|
||||||
*
|
|
||||||
* In Q.2931 only CALLSTATE_REST1 is allowed, this seems silly and to contradict
|
|
||||||
* 5.6.12. So allow it in any state.
|
|
||||||
*
|
|
||||||
* The following states are considered compatible:
|
|
||||||
*
|
|
||||||
* Sender Receiver(we)
|
|
||||||
* ------ --------
|
|
||||||
* Rest0 Rest0 this is the normal state OK!
|
|
||||||
* Rest2 Rest0 this may be the result of no answer from the API
|
|
||||||
* on the remote end and the us finally timing out. ERROR!
|
|
||||||
* Rest2 Rest1 this is normal. OK!
|
|
||||||
* Rest0 Rest1 RESTART_ACK was probably lost. OK!
|
|
||||||
*
|
|
||||||
* All others are wrong.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
start_status(struct uni *uni, struct uni_msg *m, struct uni_all *u)
|
|
||||||
{
|
|
||||||
(void)uni_decode_body(m, u, &uni->cx);
|
|
||||||
MANDATE_IE(uni, u->u.status.callstate, UNI_IE_CALLSTATE);
|
|
||||||
MANDATE_IE(uni, u->u.status.cause, UNI_IE_CAUSE);
|
|
||||||
switch (uni_verify(uni, u->u.hdr.act)) {
|
|
||||||
case VFY_CLR:
|
|
||||||
uni->glob_start = UNI_CALLSTATE_REST0;
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start state := 0");
|
|
||||||
return;
|
|
||||||
|
|
||||||
case VFY_RAIM:
|
|
||||||
case VFY_RAI:
|
|
||||||
case VFY_RAP:
|
|
||||||
case VFY_RAPU:
|
|
||||||
uni_respond_status_verify(uni, &u->u.hdr.cref, uni->glob_start,
|
|
||||||
NULL, 0);
|
|
||||||
case VFY_I:
|
|
||||||
case VFY_OK:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!IE_ISGOOD(u->u.status.callstate)) {
|
|
||||||
/*
|
|
||||||
* As a result of the strange handling above, we must
|
|
||||||
* process a STATUS with an invalid or missing callstate!
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((u->u.status.callstate.state == UNI_CALLSTATE_REST0 &&
|
|
||||||
uni->glob_start == UNI_CALLSTATE_REST0) ||
|
|
||||||
(u->u.status.callstate.state == UNI_CALLSTATE_REST0 &&
|
|
||||||
uni->glob_start == UNI_CALLSTATE_REST1) ||
|
|
||||||
(u->u.status.callstate.state == UNI_CALLSTATE_REST2 &&
|
|
||||||
uni->glob_start == UNI_CALLSTATE_REST1)) {
|
|
||||||
/*
|
|
||||||
* Implementation dependend procedure:
|
|
||||||
* Inform the API
|
|
||||||
*/
|
|
||||||
struct uniapi_reset_status_indication *resp;
|
|
||||||
struct uni_msg *app;
|
|
||||||
|
|
||||||
resp = ALLOC_API(struct uniapi_reset_status_indication, app);
|
|
||||||
if (resp == NULL)
|
|
||||||
return;
|
|
||||||
resp->cref = u->u.hdr.cref;
|
|
||||||
resp->callstate = u->u.status.callstate;
|
|
||||||
if (IE_ISGOOD(u->u.status.cause))
|
|
||||||
resp->cause = u->u.status.cause;
|
|
||||||
|
|
||||||
uni->funcs->uni_output(uni, uni->arg,
|
|
||||||
UNIAPI_RESET_STATUS_indication, 0, app);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
struct uniapi_reset_error_indication *resp;
|
|
||||||
struct uni_msg *app;
|
|
||||||
|
|
||||||
resp = ALLOC_API(struct uniapi_reset_error_indication, app);
|
|
||||||
if (resp != NULL) {
|
|
||||||
resp->source = 0;
|
|
||||||
resp->reason = UNIAPI_RESET_ERROR_PEER_INCOMP_STATE,
|
|
||||||
|
|
||||||
uni->funcs->uni_output(uni, uni->arg,
|
|
||||||
UNIAPI_RESET_ERROR_indication, 0, app);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
/*
|
|
||||||
* Reset-Respond process.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_sig_respond(struct uni *uni, u_int sig, uint32_t cookie,
|
|
||||||
struct uni_msg *m, struct uni_all *u)
|
|
||||||
{
|
|
||||||
if (sig >= SIGR_END) {
|
|
||||||
VERBOSE(uni, UNI_FAC_ERR, 1, "Signal %d outside of range to "
|
|
||||||
"Reset-Respond", sig);
|
|
||||||
if (m)
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
if (u)
|
|
||||||
UNI_FREE(u);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1,
|
|
||||||
"Signal %s in state %u of Reset-Respond; cookie %u",
|
|
||||||
respond_sigs[sig], uni->glob_respond, cookie);
|
|
||||||
|
|
||||||
switch (sig) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SAAL
|
|
||||||
*/
|
|
||||||
case SIGR_RESTART:
|
|
||||||
response_restart(uni, m, u);
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
UNI_FREE(u);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIGR_STATUS:
|
|
||||||
response_status(uni, m, u);
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
UNI_FREE(u);
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* User
|
|
||||||
*/
|
|
||||||
case SIGR_RESET_ERROR_response:
|
|
||||||
response_error(uni,
|
|
||||||
uni_msg_rptr(m, struct uniapi_reset_error_response *),
|
|
||||||
cookie);
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIGR_RESET_response:
|
|
||||||
response_response(uni,
|
|
||||||
uni_msg_rptr(m, struct uniapi_reset_response *), cookie);
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Timers
|
|
||||||
*/
|
|
||||||
case SIGR_T317:
|
|
||||||
response_t317(uni);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case SIGR_END:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send a RELEASE_COMPLETE to all affected calls as per
|
|
||||||
* F.2.3(3)
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
restart_forward(struct uni *uni, const struct uni_all *u)
|
|
||||||
{
|
|
||||||
struct call *c;
|
|
||||||
struct uni_all *resp;
|
|
||||||
|
|
||||||
if ((resp = UNI_ALLOC()) == NULL)
|
|
||||||
return (-1);
|
|
||||||
|
|
||||||
TAILQ_FOREACH(c, &uni->calls, link) {
|
|
||||||
if (u->u.restart.restart.rclass == UNI_RESTART_ALL ||
|
|
||||||
(IE_ISPRESENT(c->connid) &&
|
|
||||||
u->u.restart.connid.vpci == c->connid.vpci &&
|
|
||||||
(u->u.restart.restart.rclass == UNI_RESTART_PATH ||
|
|
||||||
u->u.restart.connid.vci == c->connid.vci))) {
|
|
||||||
MK_MSG_ORIG(resp, UNI_RELEASE_COMPL, c->cref, c->mine);
|
|
||||||
uni_release_compl(c, resp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UNI_FREE(resp);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Respond process got a restart message.
|
|
||||||
* Doesn't free the messages.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
response_restart(struct uni *uni, struct uni_msg *m, struct uni_all *u)
|
|
||||||
{
|
|
||||||
struct uni_msg *app;
|
|
||||||
struct uniapi_reset_indication *ind;
|
|
||||||
|
|
||||||
if (uni->glob_respond == UNI_CALLSTATE_REST0) {
|
|
||||||
/*
|
|
||||||
* If body decoding fails, this is because IEs are wrong.
|
|
||||||
*/
|
|
||||||
(void)uni_decode_body(m, u, &uni->cx);
|
|
||||||
MANDATE_IE(uni, u->u.restart.restart, UNI_IE_RESTART);
|
|
||||||
if (IE_ISGOOD(u->u.restart.restart)) {
|
|
||||||
/*
|
|
||||||
* Q.2931: 5.5.2.2
|
|
||||||
*/
|
|
||||||
if (u->u.restart.restart.rclass == UNI_RESTART_ALL &&
|
|
||||||
IE_ISGOOD(u->u.restart.connid)) {
|
|
||||||
(void)UNI_SAVE_IERR(&uni->cx, UNI_IE_CONNID,
|
|
||||||
u->u.restart.connid.h.act,
|
|
||||||
UNI_IERR_UNK);
|
|
||||||
} else if ((u->u.restart.restart.rclass == UNI_RESTART_PATH ||
|
|
||||||
u->u.restart.restart.rclass == UNI_RESTART_CHANNEL)) {
|
|
||||||
MANDATE_IE(uni, u->u.restart.connid, UNI_IE_CONNID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (uni_verify(uni, u->u.hdr.act)) {
|
|
||||||
case VFY_RAIM:
|
|
||||||
case VFY_RAI:
|
|
||||||
uni_respond_status_verify(uni, &u->u.hdr.cref,
|
|
||||||
UNI_CALLSTATE_REST0, NULL, 0);
|
|
||||||
case VFY_CLR:
|
|
||||||
case VFY_I:
|
|
||||||
return;
|
|
||||||
|
|
||||||
case VFY_RAP:
|
|
||||||
case VFY_RAPU:
|
|
||||||
uni_respond_status_verify(uni, &u->u.hdr.cref,
|
|
||||||
UNI_CALLSTATE_REST2, NULL, 0);
|
|
||||||
case VFY_OK:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!IE_ISGOOD(u->u.restart.connid))
|
|
||||||
u->u.restart.connid.h.present = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send a RELEASE_COMPLETE to all affected calls as per
|
|
||||||
* F.2.3(3)
|
|
||||||
*/
|
|
||||||
if (restart_forward(uni, u))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Build restart signal for application
|
|
||||||
*/
|
|
||||||
if ((ind = ALLOC_API(struct uniapi_reset_indication, app)) == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ind->restart = u->u.restart.restart;
|
|
||||||
ind->connid = u->u.restart.connid;
|
|
||||||
|
|
||||||
uni_enq_coord(uni, SIGO_RESET_indication, 0, app);
|
|
||||||
|
|
||||||
TIMER_START_UNI(uni, t317, uni->timer317);
|
|
||||||
uni->glob_respond = UNI_CALLSTATE_REST2;
|
|
||||||
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Respond state := 2");
|
|
||||||
|
|
||||||
|
|
||||||
} else if (uni->glob_respond == UNI_CALLSTATE_REST2) {
|
|
||||||
/*
|
|
||||||
* No need to decode the message. It is unexpected in this
|
|
||||||
* state so return a status.
|
|
||||||
*/
|
|
||||||
uni_respond_status_mtype(uni, &u->u.hdr.cref, uni->glob_respond,
|
|
||||||
UNI_CAUSE_MSG_INCOMP, UNI_RESTART);
|
|
||||||
|
|
||||||
|
|
||||||
} else
|
|
||||||
ASSERT(0, ("bad global call state in responder"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
response_t317(struct uni *uni)
|
|
||||||
{
|
|
||||||
struct uniapi_reset_error_indication *resp;
|
|
||||||
struct uni_msg *app;
|
|
||||||
|
|
||||||
if (uni->glob_respond != UNI_CALLSTATE_REST2) {
|
|
||||||
VERBOSE0(uni, UNI_FAC_ERR, "T317 in state %d",
|
|
||||||
uni->glob_respond);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Respond error");
|
|
||||||
|
|
||||||
if ((resp = ALLOC_API(struct uniapi_reset_error_indication, app)) != NULL) {
|
|
||||||
resp->source = 1;
|
|
||||||
resp->reason = UNIAPI_RESET_ERROR_NO_CONFIRM;
|
|
||||||
|
|
||||||
uni->funcs->uni_output(uni, uni->arg,
|
|
||||||
UNIAPI_RESET_ERROR_indication, 0, app);
|
|
||||||
}
|
|
||||||
|
|
||||||
uni->glob_respond = UNI_CALLSTATE_REST0;
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Respond state := 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Error response from USER
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
response_error(struct uni *uni, struct uniapi_reset_error_response *c,
|
|
||||||
uint32_t cookie)
|
|
||||||
{
|
|
||||||
struct uni_all *resp;
|
|
||||||
|
|
||||||
if (uni->glob_respond != UNI_CALLSTATE_REST2) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_BAD_CALLSTATE, cookie, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((resp = UNI_ALLOC()) == NULL) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_NOMEM, cookie, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MK_MSG_ORIG(resp, UNI_STATUS, 0, 1);
|
|
||||||
MK_IE_CALLSTATE(resp->u.status.callstate, UNI_CALLSTATE_REST2);
|
|
||||||
|
|
||||||
if (IE_ISGOOD(c->cause))
|
|
||||||
resp->u.status.cause = c->cause;
|
|
||||||
else {
|
|
||||||
MK_IE_CAUSE(resp->u.status.cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_CHANNEL_NEX);
|
|
||||||
if (IE_ISGOOD(uni->connid_respond))
|
|
||||||
ADD_CAUSE_CHANNID(resp->u.status.cause,
|
|
||||||
uni->connid_respond.vpci,
|
|
||||||
uni->connid_respond.vci);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uni_send_output(resp, uni) != 0) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_ENCODING, cookie, 0);
|
|
||||||
UNI_FREE(resp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uniapi_uni_error(uni, UNIAPI_OK, cookie, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset-response from user.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
response_response(struct uni *uni, struct uniapi_reset_response *arg,
|
|
||||||
uint32_t cookie)
|
|
||||||
{
|
|
||||||
struct uni_all *resp;
|
|
||||||
|
|
||||||
if (uni->glob_respond != UNI_CALLSTATE_REST2) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_BAD_CALLSTATE, cookie, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IE_ISGOOD(arg->restart)) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_MISSING_IE, cookie, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((resp = UNI_ALLOC()) == NULL) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_NOMEM, cookie, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TIMER_STOP_UNI(uni, t317);
|
|
||||||
|
|
||||||
MK_MSG_ORIG(resp, UNI_RESTART_ACK, 0, 1);
|
|
||||||
resp->u.restart.restart = arg->restart;
|
|
||||||
if (IE_ISGOOD(arg->connid))
|
|
||||||
resp->u.restart.connid = arg->connid;
|
|
||||||
|
|
||||||
if (uni_send_output(resp, uni) != 0) {
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_ENCODING, cookie, 0);
|
|
||||||
UNI_FREE(resp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UNI_FREE(resp);
|
|
||||||
|
|
||||||
uni->glob_respond = UNI_CALLSTATE_REST0;
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Respond state := 0");
|
|
||||||
|
|
||||||
uniapi_uni_error(uni, UNIAPI_OK, cookie, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset-Response got a STATUS message.
|
|
||||||
*
|
|
||||||
* Q.2931: Reset-Response 2/2
|
|
||||||
*
|
|
||||||
* In Q.2931 only CALLSTATE_REST2 is allowed, this seems silly and to contradict
|
|
||||||
* 5.6.12. So allow it in any state.
|
|
||||||
*
|
|
||||||
* The following states are considered compatible:
|
|
||||||
*
|
|
||||||
* Sender Receiver
|
|
||||||
* ------ --------
|
|
||||||
* Rest0 Rest0 this is the normal state OK!
|
|
||||||
* Rest0 Rest2 this may be the result of no answer from the API
|
|
||||||
* and the Sender finally timing out. ERROR!
|
|
||||||
* Rest1 Rest2 this is normal. OK!
|
|
||||||
* Rest1 Rest0 RESTART_ACK was probably lost. OK!
|
|
||||||
*
|
|
||||||
* All others are wrong.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
response_status(struct uni *uni, struct uni_msg *m, struct uni_all *u)
|
|
||||||
{
|
|
||||||
(void)uni_decode_body(m, u, &uni->cx);
|
|
||||||
MANDATE_IE(uni, u->u.status.callstate, UNI_IE_CALLSTATE);
|
|
||||||
MANDATE_IE(uni, u->u.status.cause, UNI_IE_CAUSE);
|
|
||||||
switch (uni_verify(uni, u->u.hdr.act)) {
|
|
||||||
case VFY_CLR:
|
|
||||||
if (uni->proto == UNIPROTO_UNI40U) {
|
|
||||||
uni->glob_respond = UNI_CALLSTATE_REST0;
|
|
||||||
VERBOSE(uni, UNI_FAC_RESTART, 1,
|
|
||||||
"Reset-Respond state := 0");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VFY_RAIM:
|
|
||||||
case VFY_RAI:
|
|
||||||
case VFY_RAP:
|
|
||||||
case VFY_RAPU:
|
|
||||||
uni_respond_status_verify(uni, &u->u.hdr.cref,
|
|
||||||
uni->glob_respond, NULL, 0);
|
|
||||||
case VFY_I:
|
|
||||||
case VFY_OK:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!IE_ISGOOD(u->u.status.callstate)) {
|
|
||||||
/*
|
|
||||||
* As a result of the strange handling above, we must
|
|
||||||
* process a STATUS with an invalid or missing callstate!
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((u->u.status.callstate.state == UNI_CALLSTATE_REST0 &&
|
|
||||||
uni->glob_respond == UNI_CALLSTATE_REST0) ||
|
|
||||||
(u->u.status.callstate.state == UNI_CALLSTATE_REST1 &&
|
|
||||||
uni->glob_respond == UNI_CALLSTATE_REST0) ||
|
|
||||||
(u->u.status.callstate.state == UNI_CALLSTATE_REST1 &&
|
|
||||||
uni->glob_respond == UNI_CALLSTATE_REST2)) {
|
|
||||||
/*
|
|
||||||
* Implementation dependend procedure:
|
|
||||||
* Inform the API
|
|
||||||
*/
|
|
||||||
struct uniapi_reset_status_indication *resp;
|
|
||||||
struct uni_msg *app;
|
|
||||||
|
|
||||||
resp = ALLOC_API(struct uniapi_reset_status_indication, app);
|
|
||||||
if (resp == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
resp->cref = u->u.hdr.cref;
|
|
||||||
resp->callstate = u->u.status.callstate;
|
|
||||||
if (IE_ISGOOD(u->u.status.cause))
|
|
||||||
resp->cause = u->u.status.cause;
|
|
||||||
|
|
||||||
uni->funcs->uni_output(uni, uni->arg,
|
|
||||||
UNIAPI_RESET_STATUS_indication, 0, app);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
struct uniapi_reset_error_indication *resp;
|
|
||||||
struct uni_msg *app;
|
|
||||||
|
|
||||||
resp = ALLOC_API(struct uniapi_reset_error_indication, app);
|
|
||||||
if (resp != NULL) {
|
|
||||||
resp->source = 1;
|
|
||||||
resp->reason = UNIAPI_RESET_ERROR_PEER_INCOMP_STATE,
|
|
||||||
|
|
||||||
uni->funcs->uni_output(uni, uni->arg,
|
|
||||||
UNIAPI_RESET_ERROR_indication, 0, app);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* T317 timeout function
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
t317_func(struct uni *uni)
|
|
||||||
{
|
|
||||||
uni_enq_resp(uni, SIGR_T317, 0, NULL, NULL);
|
|
||||||
}
|
|
@ -1,749 +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/sig/sig_uni.c,v 1.11 2004/08/05 07:11:03 brandt Exp $
|
|
||||||
*
|
|
||||||
* Instance handling
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <netnatm/unimsg.h>
|
|
||||||
#include <netnatm/saal/sscopdef.h>
|
|
||||||
#include <netnatm/saal/sscfudef.h>
|
|
||||||
#include <netnatm/msg/unistruct.h>
|
|
||||||
#include <netnatm/msg/unimsglib.h>
|
|
||||||
#include <netnatm/sig/uni.h>
|
|
||||||
#include <netnatm/sig/unisig.h>
|
|
||||||
|
|
||||||
#include <netnatm/sig/unipriv.h>
|
|
||||||
|
|
||||||
#ifdef UNICORE
|
|
||||||
UNICORE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define STR(S) [S] = #S
|
|
||||||
static const char *custat_names[] = {
|
|
||||||
STR(CU_STAT0),
|
|
||||||
STR(CU_STAT1),
|
|
||||||
STR(CU_STAT2),
|
|
||||||
STR(CU_STAT3),
|
|
||||||
};
|
|
||||||
static const char *globstat_names[] = {
|
|
||||||
STR(UNI_CALLSTATE_REST0),
|
|
||||||
STR(UNI_CALLSTATE_REST1),
|
|
||||||
STR(UNI_CALLSTATE_REST2),
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *sig_names[] = {
|
|
||||||
STR(UNIAPI_ERROR),
|
|
||||||
STR(UNIAPI_CALL_CREATED),
|
|
||||||
STR(UNIAPI_CALL_DESTROYED),
|
|
||||||
STR(UNIAPI_PARTY_CREATED),
|
|
||||||
STR(UNIAPI_PARTY_DESTROYED),
|
|
||||||
STR(UNIAPI_LINK_ESTABLISH_request),
|
|
||||||
STR(UNIAPI_LINK_ESTABLISH_confirm),
|
|
||||||
STR(UNIAPI_LINK_RELEASE_request),
|
|
||||||
STR(UNIAPI_LINK_RELEASE_confirm),
|
|
||||||
STR(UNIAPI_RESET_request),
|
|
||||||
STR(UNIAPI_RESET_confirm),
|
|
||||||
STR(UNIAPI_RESET_indication),
|
|
||||||
STR(UNIAPI_RESET_ERROR_indication),
|
|
||||||
STR(UNIAPI_RESET_response),
|
|
||||||
STR(UNIAPI_RESET_ERROR_response),
|
|
||||||
STR(UNIAPI_RESET_STATUS_indication),
|
|
||||||
STR(UNIAPI_SETUP_request),
|
|
||||||
STR(UNIAPI_SETUP_indication),
|
|
||||||
STR(UNIAPI_SETUP_response),
|
|
||||||
STR(UNIAPI_SETUP_confirm),
|
|
||||||
STR(UNIAPI_SETUP_COMPLETE_indication),
|
|
||||||
STR(UNIAPI_SETUP_COMPLETE_request),
|
|
||||||
STR(UNIAPI_ALERTING_request),
|
|
||||||
STR(UNIAPI_ALERTING_indication),
|
|
||||||
STR(UNIAPI_PROCEEDING_request),
|
|
||||||
STR(UNIAPI_PROCEEDING_indication),
|
|
||||||
STR(UNIAPI_RELEASE_request),
|
|
||||||
STR(UNIAPI_RELEASE_indication),
|
|
||||||
STR(UNIAPI_RELEASE_response),
|
|
||||||
STR(UNIAPI_RELEASE_confirm),
|
|
||||||
STR(UNIAPI_NOTIFY_request),
|
|
||||||
STR(UNIAPI_NOTIFY_indication),
|
|
||||||
STR(UNIAPI_STATUS_indication),
|
|
||||||
STR(UNIAPI_STATUS_ENQUIRY_request),
|
|
||||||
STR(UNIAPI_ADD_PARTY_request),
|
|
||||||
STR(UNIAPI_ADD_PARTY_indication),
|
|
||||||
STR(UNIAPI_PARTY_ALERTING_request),
|
|
||||||
STR(UNIAPI_PARTY_ALERTING_indication),
|
|
||||||
STR(UNIAPI_ADD_PARTY_ACK_request),
|
|
||||||
STR(UNIAPI_ADD_PARTY_ACK_indication),
|
|
||||||
STR(UNIAPI_ADD_PARTY_REJ_request),
|
|
||||||
STR(UNIAPI_ADD_PARTY_REJ_indication),
|
|
||||||
STR(UNIAPI_DROP_PARTY_request),
|
|
||||||
STR(UNIAPI_DROP_PARTY_indication),
|
|
||||||
STR(UNIAPI_DROP_PARTY_ACK_request),
|
|
||||||
STR(UNIAPI_DROP_PARTY_ACK_indication),
|
|
||||||
STR(UNIAPI_ABORT_CALL_request),
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *verb_names[] = {
|
|
||||||
# define UNI_DEBUG_DEFINE(D) [UNI_FAC_##D] = #D,
|
|
||||||
UNI_DEBUG_FACILITIES
|
|
||||||
# undef UNI_DEBUG_DEFINE
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *
|
|
||||||
uni_facname(enum uni_verb fac)
|
|
||||||
{
|
|
||||||
static char buf[40];
|
|
||||||
|
|
||||||
if (fac >= UNI_MAXFACILITY) {
|
|
||||||
sprintf(buf, "FAC%u", fac);
|
|
||||||
return (buf);
|
|
||||||
}
|
|
||||||
return (verb_names[fac]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
uni_signame(enum uni_sig sig)
|
|
||||||
{
|
|
||||||
static char buf[40];
|
|
||||||
|
|
||||||
if (sig >= UNIAPI_MAXSIG) {
|
|
||||||
sprintf(buf, "UNIAPI_SIG%u", sig);
|
|
||||||
return (buf);
|
|
||||||
}
|
|
||||||
return (sig_names[sig]);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct unicx *
|
|
||||||
uni_context(struct uni *uni)
|
|
||||||
{
|
|
||||||
return (&uni->cx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
uni_init(struct uni *uni)
|
|
||||||
{
|
|
||||||
uni->working = 0;
|
|
||||||
uni->cref_alloc = 12;
|
|
||||||
uni->custat = CU_STAT0;
|
|
||||||
uni->glob_start = UNI_CALLSTATE_REST0;
|
|
||||||
uni->glob_respond = UNI_CALLSTATE_REST0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
uni_stop(struct uni *uni)
|
|
||||||
{
|
|
||||||
struct call *c;
|
|
||||||
|
|
||||||
while ((c = TAILQ_FIRST(&uni->calls)) != NULL) {
|
|
||||||
TAILQ_REMOVE(&uni->calls, c, link);
|
|
||||||
uni_destroy_call(c, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
SIGQ_CLEAR(&uni->workq);
|
|
||||||
SIGQ_CLEAR(&uni->delq);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* INSTANCE HANDLING
|
|
||||||
*/
|
|
||||||
struct uni *
|
|
||||||
uni_create(void *arg, const struct uni_funcs *funcs)
|
|
||||||
{
|
|
||||||
struct uni *uni;
|
|
||||||
|
|
||||||
if ((uni = INS_ALLOC()) == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
uni_init(uni);
|
|
||||||
|
|
||||||
uni->funcs = funcs;
|
|
||||||
uni->arg = arg;
|
|
||||||
uni->proto = UNIPROTO_UNI40U;
|
|
||||||
uni->sb_tb = 0;
|
|
||||||
TAILQ_INIT(&uni->workq);
|
|
||||||
TAILQ_INIT(&uni->delq);
|
|
||||||
TIMER_INIT_UNI(uni, t309);
|
|
||||||
uni->timer309 = UNI_T309_DEFAULT;
|
|
||||||
TAILQ_INIT(&uni->calls);
|
|
||||||
uni_initcx(&uni->cx);
|
|
||||||
TIMER_INIT_UNI(uni, t317);
|
|
||||||
TIMER_INIT_UNI(uni, t316);
|
|
||||||
|
|
||||||
uni->timer301 = UNI_T301_DEFAULT;
|
|
||||||
uni->init303 = UNI_T303_CNT_DEFAULT;
|
|
||||||
uni->timer303 = UNI_T303_DEFAULT;
|
|
||||||
uni->init308 = UNI_T308_CNT_DEFAULT;
|
|
||||||
uni->timer308 = UNI_T308_DEFAULT;
|
|
||||||
uni->timer310 = UNI_T310U_DEFAULT;
|
|
||||||
uni->timer313 = UNI_T313_DEFAULT;
|
|
||||||
uni->init316 = UNI_T316_CNT_DEFAULT;
|
|
||||||
uni->timer316 = UNI_T316_DEFAULT;
|
|
||||||
uni->timer317 = UNI_T317_DEFAULT;
|
|
||||||
uni->timer322 = UNI_T322_DEFAULT;
|
|
||||||
uni->init322 = UNI_T322_CNT_DEFAULT;
|
|
||||||
uni->timer397 = UNI_T397_DEFAULT;
|
|
||||||
uni->timer398 = UNI_T398_DEFAULT;
|
|
||||||
uni->timer399 = UNI_T399U_DEFAULT;
|
|
||||||
|
|
||||||
return (uni);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_destroy(struct uni *uni)
|
|
||||||
{
|
|
||||||
uni_stop(uni);
|
|
||||||
|
|
||||||
TIMER_DESTROY_UNI(uni, t309);
|
|
||||||
TIMER_DESTROY_UNI(uni, t316);
|
|
||||||
TIMER_DESTROY_UNI(uni, t317);
|
|
||||||
|
|
||||||
INS_FREE(uni);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_reset(struct uni *uni)
|
|
||||||
{
|
|
||||||
uni_stop(uni);
|
|
||||||
uni_init(uni);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DISPATCH SSCOP SIGNAL
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_saal_input(struct uni *uni, enum saal_sig sig, struct uni_msg *m)
|
|
||||||
{
|
|
||||||
switch (sig) {
|
|
||||||
|
|
||||||
case SAAL_ESTABLISH_indication:
|
|
||||||
if (m != NULL)
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
uni_enq_coord(uni, SIGO_SAAL_ESTABLISH_indication, 0, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_ESTABLISH_confirm:
|
|
||||||
if (m != NULL)
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
uni_enq_coord(uni, SIGO_SAAL_ESTABLISH_confirm, 0, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_RELEASE_confirm:
|
|
||||||
if (m != NULL)
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
uni_enq_coord(uni, SIGO_SAAL_RELEASE_confirm, 0, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_RELEASE_indication:
|
|
||||||
if (m != NULL)
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
uni_enq_coord(uni, SIGO_SAAL_RELEASE_indication, 0, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_DATA_indication:
|
|
||||||
uni_enq_coord(uni, SIGO_SAAL_DATA_indication, 0, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SAAL_UDATA_indication:
|
|
||||||
uni_enq_coord(uni, SIGO_SAAL_UDATA_indication, 0, m);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
VERBOSE(uni, UNI_FAC_ERR, 1, "bogus saal signal %u", sig);
|
|
||||||
if (m != NULL)
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct {
|
|
||||||
const char *name;
|
|
||||||
enum uni_sig sig;
|
|
||||||
size_t arglen;
|
|
||||||
u_int coord_sig;
|
|
||||||
u_int proto;
|
|
||||||
#define UNIU 0x01
|
|
||||||
#define UNIN 0x02
|
|
||||||
#define PNNI 0x04
|
|
||||||
} maptab[] = {
|
|
||||||
{ "LINK-ESTABLISH.request", UNIAPI_LINK_ESTABLISH_request,
|
|
||||||
0,
|
|
||||||
SIGO_LINK_ESTABLISH_request, UNIU | UNIN },
|
|
||||||
{ "LINK-RELEASE.request", UNIAPI_LINK_RELEASE_request,
|
|
||||||
0,
|
|
||||||
SIGO_LINK_RELEASE_request, UNIU | UNIN },
|
|
||||||
|
|
||||||
{ "RESET.request", UNIAPI_RESET_request,
|
|
||||||
sizeof(struct uniapi_reset_request),
|
|
||||||
SIGO_RESET_request, UNIU | UNIN },
|
|
||||||
{ "RESET-ERROR.response", UNIAPI_RESET_ERROR_response,
|
|
||||||
sizeof(struct uniapi_reset_error_response),
|
|
||||||
SIGO_RESET_ERROR_response, UNIU | UNIN },
|
|
||||||
{ "RESET.response", UNIAPI_RESET_response,
|
|
||||||
sizeof(struct uniapi_reset_response),
|
|
||||||
SIGO_RESET_response, UNIU | UNIN },
|
|
||||||
|
|
||||||
{ "SETUP.request", UNIAPI_SETUP_request,
|
|
||||||
sizeof(struct uniapi_setup_request),
|
|
||||||
SIGO_SETUP_request, UNIU | UNIN },
|
|
||||||
{ "SETUP.response", UNIAPI_SETUP_response,
|
|
||||||
sizeof(struct uniapi_setup_response),
|
|
||||||
SIGO_SETUP_response, UNIU | UNIN },
|
|
||||||
{ "SETUP-COMPLETE.request", UNIAPI_SETUP_COMPLETE_request,
|
|
||||||
sizeof(struct uniapi_setup_complete_request),
|
|
||||||
SIGO_SETUP_COMPLETE_request, UNIN },
|
|
||||||
{ "PROCEEDING.request", UNIAPI_PROCEEDING_request,
|
|
||||||
sizeof(struct uniapi_proceeding_request),
|
|
||||||
SIGO_PROCEEDING_request, UNIU | UNIN },
|
|
||||||
{ "ALERTING.request", UNIAPI_ALERTING_request,
|
|
||||||
sizeof(struct uniapi_alerting_request),
|
|
||||||
SIGO_ALERTING_request, UNIU | UNIN },
|
|
||||||
{ "RELEASE.request", UNIAPI_RELEASE_request,
|
|
||||||
sizeof(struct uniapi_release_request),
|
|
||||||
SIGO_RELEASE_request, UNIU | UNIN },
|
|
||||||
{ "RELEASE.response", UNIAPI_RELEASE_response,
|
|
||||||
sizeof(struct uniapi_release_response),
|
|
||||||
SIGO_RELEASE_response, UNIU | UNIN },
|
|
||||||
{ "NOTIFY.request", UNIAPI_NOTIFY_request,
|
|
||||||
sizeof(struct uniapi_notify_request),
|
|
||||||
SIGO_NOTIFY_request, UNIU | UNIN },
|
|
||||||
{ "STATUS-ENQUIRY.request", UNIAPI_STATUS_ENQUIRY_request,
|
|
||||||
sizeof(struct uniapi_status_enquiry_request),
|
|
||||||
SIGO_STATUS_ENQUIRY_request, UNIU | UNIN },
|
|
||||||
|
|
||||||
{ "ADD-PARTY.request", UNIAPI_ADD_PARTY_request,
|
|
||||||
sizeof(struct uniapi_add_party_request),
|
|
||||||
SIGO_ADD_PARTY_request, UNIU | UNIN },
|
|
||||||
{ "ADD-PARTY-ACK.request", UNIAPI_ADD_PARTY_ACK_request,
|
|
||||||
sizeof(struct uniapi_add_party_ack_request),
|
|
||||||
SIGO_ADD_PARTY_ACK_request, UNIU | UNIN },
|
|
||||||
{ "ADD-PARTY-REJ.request", UNIAPI_ADD_PARTY_REJ_request,
|
|
||||||
sizeof(struct uniapi_add_party_rej_request),
|
|
||||||
SIGO_ADD_PARTY_REJ_request, UNIU | UNIN },
|
|
||||||
{ "PARTY-ALERTING.request", UNIAPI_PARTY_ALERTING_request,
|
|
||||||
sizeof(struct uniapi_party_alerting_request),
|
|
||||||
SIGO_PARTY_ALERTING_request, UNIU | UNIN },
|
|
||||||
{ "DROP-PARTY.request", UNIAPI_DROP_PARTY_request,
|
|
||||||
sizeof(struct uniapi_drop_party_request),
|
|
||||||
SIGO_DROP_PARTY_request, UNIU | UNIN },
|
|
||||||
{ "DROP-PARTY-ACK.request", UNIAPI_DROP_PARTY_ACK_request,
|
|
||||||
sizeof(struct uniapi_drop_party_ack_request),
|
|
||||||
SIGO_DROP_PARTY_ACK_request, UNIU | UNIN },
|
|
||||||
|
|
||||||
{ "ABORT-CALL.request", UNIAPI_ABORT_CALL_request,
|
|
||||||
sizeof(struct uniapi_abort_call_request),
|
|
||||||
SIGO_ABORT_CALL_request, UNIU | UNIN },
|
|
||||||
|
|
||||||
{ NULL, 0, 0, 0, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_uni_input(struct uni *uni, enum uni_sig sig, uint32_t cookie,
|
|
||||||
struct uni_msg *m)
|
|
||||||
{
|
|
||||||
u_int i;
|
|
||||||
|
|
||||||
for (i = 0; maptab[i].name != NULL; i++) {
|
|
||||||
if (maptab[i].sig == sig) {
|
|
||||||
if (uni->proto == UNIPROTO_UNI40U) {
|
|
||||||
if (!(maptab[i].proto & UNIU))
|
|
||||||
uniapi_uni_error(uni,
|
|
||||||
UNIAPI_ERROR_BAD_SIGNAL, cookie, 0);
|
|
||||||
} else if(uni->proto == UNIPROTO_UNI40N) {
|
|
||||||
if (!(maptab[i].proto & UNIN))
|
|
||||||
uniapi_uni_error(uni,
|
|
||||||
UNIAPI_ERROR_BAD_SIGNAL, cookie, 0);
|
|
||||||
} else if(uni->proto == UNIPROTO_PNNI10) {
|
|
||||||
if (!(maptab[i].proto & PNNI))
|
|
||||||
uniapi_uni_error(uni,
|
|
||||||
UNIAPI_ERROR_BAD_SIGNAL, cookie, 0);
|
|
||||||
} else {
|
|
||||||
uniapi_uni_error(uni,
|
|
||||||
UNIAPI_ERROR_BAD_SIGNAL, cookie, 0);
|
|
||||||
}
|
|
||||||
if (uni_msg_len(m) != maptab[i].arglen) {
|
|
||||||
VERBOSE(uni, UNI_FAC_ERR, 1, "bogus data in %s"
|
|
||||||
" (expecting %zu, got %zu)", maptab[i].name,
|
|
||||||
maptab[i].arglen, uni_msg_len(m));
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_BAD_ARG,
|
|
||||||
cookie, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (maptab[i].arglen == 0) {
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
m = NULL;
|
|
||||||
}
|
|
||||||
VERBOSE(uni, UNI_FAC_API, 1, "got signal %s - "
|
|
||||||
"delivering to Coord", maptab[i].name);
|
|
||||||
uni_enq_coord(uni, maptab[i].coord_sig, cookie, m);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
VERBOSE(uni, UNI_FAC_ERR, 1, "bogus uni signal %u", sig);
|
|
||||||
uni_msg_destroy(m);
|
|
||||||
uniapi_uni_error(uni, UNIAPI_ERROR_BAD_SIGNAL, cookie, 0);
|
|
||||||
}
|
|
||||||
#undef UNIU
|
|
||||||
#undef UNIN
|
|
||||||
#undef PNNI
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_work(struct uni *uni)
|
|
||||||
{
|
|
||||||
struct sig *s;
|
|
||||||
|
|
||||||
if (uni->working)
|
|
||||||
return;
|
|
||||||
uni->working = 1;
|
|
||||||
|
|
||||||
while ((s = TAILQ_FIRST(&uni->workq)) != NULL) {
|
|
||||||
TAILQ_REMOVE(&uni->workq, s, link);
|
|
||||||
switch (s->type) {
|
|
||||||
|
|
||||||
case SIG_COORD:
|
|
||||||
uni_sig_coord(uni, s->sig, s->cookie, s->msg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIG_RESET_START:
|
|
||||||
uni_sig_start(uni, s->sig, s->cookie, s->msg, s->u);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIG_RESET_RESP:
|
|
||||||
uni_sig_respond(uni, s->sig, s->cookie, s->msg, s->u);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIG_CALL:
|
|
||||||
uni_sig_call(s->call, s->sig, s->cookie, s->msg, s->u);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIG_PARTY:
|
|
||||||
uni_sig_party(s->party, s->sig, s->cookie, s->msg, s->u);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ASSERT(0, ("bad signal type"));
|
|
||||||
}
|
|
||||||
SIG_FREE(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
uni->working = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enqueue a signal in the working queue
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_enq_sig(struct uni *uni, u_int type, struct call *call,
|
|
||||||
struct party *party, uint32_t sig, uint32_t cookie,
|
|
||||||
struct uni_msg *msg, struct uni_all *u)
|
|
||||||
{
|
|
||||||
struct sig *s;
|
|
||||||
|
|
||||||
if ((s = SIG_ALLOC()) != NULL) {
|
|
||||||
s->type = type;
|
|
||||||
s->sig = sig;
|
|
||||||
s->cookie = cookie;
|
|
||||||
s->msg = msg;
|
|
||||||
s->call = call;
|
|
||||||
s->party = party;
|
|
||||||
s->u = u;
|
|
||||||
TAILQ_INSERT_TAIL(&uni->workq, s, link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enqueue a signal in the delayed queue
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_delenq_sig(struct uni *uni, u_int type, struct call *call,
|
|
||||||
struct party *party, uint32_t sig, uint32_t cookie,
|
|
||||||
struct uni_msg *msg, struct uni_all *u)
|
|
||||||
{
|
|
||||||
struct sig *s;
|
|
||||||
|
|
||||||
if ((s = SIG_ALLOC()) != NULL) {
|
|
||||||
s->type = type;
|
|
||||||
s->sig = sig;
|
|
||||||
s->cookie = cookie;
|
|
||||||
s->msg = msg;
|
|
||||||
s->call = call;
|
|
||||||
s->party = party;
|
|
||||||
s->u = u;
|
|
||||||
TAILQ_INSERT_TAIL(&uni->delq, s, link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
uniapi_uni_error(struct uni *uni, uint32_t reason, uint32_t cookie,
|
|
||||||
uint32_t state)
|
|
||||||
{
|
|
||||||
struct uni_msg *resp;
|
|
||||||
struct uniapi_error *err;
|
|
||||||
|
|
||||||
if (cookie == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
resp = uni_msg_alloc(sizeof(struct uniapi_error));
|
|
||||||
err = uni_msg_wptr(resp, struct uniapi_error *);
|
|
||||||
resp->b_wptr += sizeof(struct uniapi_error);
|
|
||||||
|
|
||||||
err->reason = reason;
|
|
||||||
err->state = state;
|
|
||||||
|
|
||||||
uni->funcs->uni_output(uni, uni->arg, UNIAPI_ERROR, cookie, resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
uniapi_call_error(struct call *c, uint32_t reason, uint32_t cookie)
|
|
||||||
{
|
|
||||||
uniapi_uni_error(c->uni, reason, cookie, callstates[c->cstate].ext);
|
|
||||||
}
|
|
||||||
void
|
|
||||||
uniapi_party_error(struct party *p, uint32_t reason, uint32_t cookie)
|
|
||||||
{
|
|
||||||
uniapi_uni_error(p->call->uni, reason, cookie,
|
|
||||||
callstates[p->call->cstate].ext);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void
|
|
||||||
uni_status(struct uni *uni, void *arg)
|
|
||||||
{
|
|
||||||
uni->funcs->status(uni, uni->arg, arg,
|
|
||||||
"working: %s\n", uni->working ? "yes" : "no");
|
|
||||||
uni->funcs->status(uni, uni->arg, arg,
|
|
||||||
"work queue: %sempty\n", TAILQ_EMPTY(&uni->workq)? "" : "not ");
|
|
||||||
uni->funcs->status(uni, uni->arg, arg,
|
|
||||||
"delayed work queue: %sempty\n",
|
|
||||||
TAILQ_EMPTY(&uni->delq)? "" : "not ");
|
|
||||||
uni->funcs->status(uni, uni->arg, arg,
|
|
||||||
"coordinator: %s\n", custat_names[uni->custat]);
|
|
||||||
uni->funcs->status(uni, uni->arg, arg,
|
|
||||||
"reset-start: %s\n", globstat_names[uni->glob_start]);
|
|
||||||
uni->funcs->status(uni, uni->arg, arg,
|
|
||||||
"reset-respond: %s\n", globstat_names[uni->glob_respond]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_undel(struct uni *uni, int (*filter)(struct sig *, void *), void *arg)
|
|
||||||
{
|
|
||||||
struct sigqueue newq;
|
|
||||||
struct sig *s, *s1;
|
|
||||||
|
|
||||||
if (TAILQ_EMPTY(&uni->delq))
|
|
||||||
return;
|
|
||||||
|
|
||||||
TAILQ_INIT(&newq);
|
|
||||||
|
|
||||||
s = TAILQ_FIRST(&uni->delq);
|
|
||||||
while (s != NULL) {
|
|
||||||
s1 = TAILQ_NEXT(s, link);
|
|
||||||
if ((*filter)(s, arg)) {
|
|
||||||
TAILQ_REMOVE(&uni->delq, s, link);
|
|
||||||
TAILQ_INSERT_TAIL(&uni->workq, s, link);
|
|
||||||
}
|
|
||||||
s = s1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_delsig(struct uni *uni, u_int type, struct call *c, struct party *p)
|
|
||||||
{
|
|
||||||
struct sig *s, *s1;
|
|
||||||
|
|
||||||
s = TAILQ_FIRST(&uni->workq);
|
|
||||||
while (s != NULL) {
|
|
||||||
s1 = TAILQ_NEXT(s, link);
|
|
||||||
if ((type == SIG_CALL && s->type == SIG_CALL &&
|
|
||||||
s->call == c) ||
|
|
||||||
(type == SIG_PARTY && s->type == SIG_PARTY &&
|
|
||||||
s->call == c && s->party == p)) {
|
|
||||||
TAILQ_REMOVE(&uni->workq, s, link);
|
|
||||||
if (s->msg)
|
|
||||||
uni_msg_destroy(s->msg);
|
|
||||||
if (s->u)
|
|
||||||
UNI_FREE(s->u);
|
|
||||||
SIG_FREE(s);
|
|
||||||
}
|
|
||||||
s = s1;
|
|
||||||
}
|
|
||||||
|
|
||||||
s = TAILQ_FIRST(&uni->delq);
|
|
||||||
while (s != NULL) {
|
|
||||||
s1 = TAILQ_NEXT(s, link);
|
|
||||||
if ((type == SIG_CALL && s->type == SIG_CALL &&
|
|
||||||
s->call == c) ||
|
|
||||||
(type == SIG_PARTY && s->type == SIG_PARTY &&
|
|
||||||
s->call == c && s->party == p)) {
|
|
||||||
TAILQ_REMOVE(&uni->delq, s, link);
|
|
||||||
if (s->msg)
|
|
||||||
uni_msg_destroy(s->msg);
|
|
||||||
if (s->u)
|
|
||||||
UNI_FREE(s->u);
|
|
||||||
SIG_FREE(s); \
|
|
||||||
}
|
|
||||||
s = s1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_get_config(const struct uni *uni, struct uni_config *config)
|
|
||||||
{
|
|
||||||
config->proto = uni->proto;
|
|
||||||
|
|
||||||
config->popt = 0;
|
|
||||||
if (uni->cx.q2932)
|
|
||||||
config->popt |= UNIPROTO_GFP;
|
|
||||||
|
|
||||||
config->option = 0;
|
|
||||||
if (uni->cx.git_hard)
|
|
||||||
config->option |= UNIOPT_GIT_HARD;
|
|
||||||
if (uni->cx.bearer_hard)
|
|
||||||
config->option |= UNIOPT_BEARER_HARD;
|
|
||||||
if (uni->cx.cause_hard)
|
|
||||||
config->option |= UNIOPT_CAUSE_HARD;
|
|
||||||
if (uni->sb_tb)
|
|
||||||
config->popt |= UNIPROTO_SB_TB;
|
|
||||||
|
|
||||||
config->timer301 = uni->timer301;
|
|
||||||
config->timer303 = uni->timer303;
|
|
||||||
config->init303 = uni->init303;
|
|
||||||
config->timer308 = uni->timer308;
|
|
||||||
config->init308 = uni->init308;
|
|
||||||
config->timer309 = uni->timer309;
|
|
||||||
config->timer310 = uni->timer310;
|
|
||||||
config->timer313 = uni->timer313;
|
|
||||||
config->timer316 = uni->timer316;
|
|
||||||
config->init316 = uni->init316;
|
|
||||||
config->timer317 = uni->timer317;
|
|
||||||
config->timer322 = uni->timer322;
|
|
||||||
config->init322 = uni->init322;
|
|
||||||
config->timer397 = uni->timer397;
|
|
||||||
config->timer398 = uni->timer398;
|
|
||||||
config->timer399 = uni->timer399;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_set_config(struct uni *uni, const struct uni_config *config,
|
|
||||||
uint32_t *mask, uint32_t *popt_mask, uint32_t *opt_mask)
|
|
||||||
{
|
|
||||||
int idle;
|
|
||||||
|
|
||||||
idle = TAILQ_EMPTY(&uni->calls) &&
|
|
||||||
TAILQ_EMPTY(&uni->workq) &&
|
|
||||||
TAILQ_EMPTY(&uni->delq);
|
|
||||||
|
|
||||||
if ((*mask & UNICFG_PROTO) && idle) {
|
|
||||||
switch (config->proto) {
|
|
||||||
|
|
||||||
case UNIPROTO_UNI40U:
|
|
||||||
case UNIPROTO_UNI40N:
|
|
||||||
/* case UNIPROTO_PNNI10: XXX */
|
|
||||||
uni->proto = config->proto;
|
|
||||||
*mask &= ~UNICFG_PROTO;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (*popt_mask & UNIPROTO_GFP) {
|
|
||||||
if (config->popt & UNIPROTO_GFP) {
|
|
||||||
uni->cx.q2932 = 1;
|
|
||||||
*popt_mask &= ~UNIPROTO_GFP;
|
|
||||||
} else {
|
|
||||||
if (!uni->cx.q2932 || idle) {
|
|
||||||
uni->cx.q2932 = 0;
|
|
||||||
*popt_mask &= ~UNIPROTO_GFP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (*popt_mask & UNIPROTO_SB_TB) {
|
|
||||||
uni->sb_tb = ((config->popt & UNIPROTO_SB_TB) != 0);
|
|
||||||
*popt_mask &= ~UNIPROTO_SB_TB;
|
|
||||||
}
|
|
||||||
if (*opt_mask & UNIOPT_GIT_HARD) {
|
|
||||||
uni->cx.git_hard = ((config->option & UNIOPT_GIT_HARD) != 0);
|
|
||||||
*opt_mask &= ~UNIOPT_GIT_HARD;
|
|
||||||
}
|
|
||||||
if (*opt_mask & UNIOPT_BEARER_HARD) {
|
|
||||||
uni->cx.bearer_hard = ((config->option & UNIOPT_BEARER_HARD) != 0);
|
|
||||||
*opt_mask &= ~UNIOPT_BEARER_HARD;
|
|
||||||
}
|
|
||||||
if (*opt_mask & UNIOPT_CAUSE_HARD) {
|
|
||||||
uni->cx.cause_hard = ((config->option & UNIOPT_CAUSE_HARD) != 0);
|
|
||||||
*opt_mask &= ~UNIOPT_CAUSE_HARD;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SET_TIMER(NAME,name) \
|
|
||||||
if (*mask & UNICFG_##NAME) { \
|
|
||||||
uni->name = config->name; \
|
|
||||||
*mask &= ~UNICFG_##NAME; \
|
|
||||||
}
|
|
||||||
|
|
||||||
SET_TIMER(TIMER301, timer301);
|
|
||||||
SET_TIMER(TIMER303, timer303);
|
|
||||||
SET_TIMER(INIT303, init303);
|
|
||||||
SET_TIMER(TIMER308, timer308);
|
|
||||||
SET_TIMER(INIT308, init308);
|
|
||||||
SET_TIMER(TIMER309, timer309);
|
|
||||||
SET_TIMER(TIMER310, timer310);
|
|
||||||
SET_TIMER(TIMER313, timer313);
|
|
||||||
SET_TIMER(TIMER316, timer316);
|
|
||||||
SET_TIMER(INIT316, init316);
|
|
||||||
SET_TIMER(TIMER317, timer317);
|
|
||||||
SET_TIMER(TIMER322, timer322);
|
|
||||||
SET_TIMER(INIT322, init322);
|
|
||||||
SET_TIMER(TIMER397, timer397);
|
|
||||||
SET_TIMER(TIMER398, timer398);
|
|
||||||
SET_TIMER(TIMER399, timer399);
|
|
||||||
|
|
||||||
#undef SET_TIMER
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_set_debug(struct uni *uni, enum uni_verb fac, u_int level)
|
|
||||||
{
|
|
||||||
uni->debug[fac] = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
u_int
|
|
||||||
uni_get_debug(const struct uni *uni, enum uni_verb fac)
|
|
||||||
{
|
|
||||||
return (uni->debug[fac]);
|
|
||||||
}
|
|
||||||
|
|
||||||
u_int
|
|
||||||
uni_getcustate(const struct uni *uni)
|
|
||||||
{
|
|
||||||
return (uni->custat);
|
|
||||||
}
|
|
@ -1,594 +0,0 @@
|
|||||||
/* This file was created automatically
|
|
||||||
* Source file: $Begemot: libunimsg/atm/msg/msg.def,v 1.3 2003/09/19 11:58:15 hbb Exp $
|
|
||||||
* $FreeBSD$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <netnatm/msg/unistruct.h>
|
|
||||||
#include <netnatm/sig/unimsgcpy.h>
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_alerting(struct uni_alerting *src, struct uni_alerting *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->connid))
|
|
||||||
dst->connid = src->connid;
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
if(IE_ISGOOD(src->report))
|
|
||||||
dst->report = src->report;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_call_proc(struct uni_call_proc *src, struct uni_call_proc *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->connid))
|
|
||||||
dst->connid = src->connid;
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_connect(struct uni_connect *src, struct uni_connect *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->aal))
|
|
||||||
dst->aal = src->aal;
|
|
||||||
if(IE_ISGOOD(src->blli))
|
|
||||||
dst->blli = src->blli;
|
|
||||||
if(IE_ISGOOD(src->connid))
|
|
||||||
dst->connid = src->connid;
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->conned))
|
|
||||||
dst->conned = src->conned;
|
|
||||||
if(IE_ISGOOD(src->connedsub))
|
|
||||||
dst->connedsub = src->connedsub;
|
|
||||||
if(IE_ISGOOD(src->eetd))
|
|
||||||
dst->eetd = src->eetd;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
if(IE_ISGOOD(src->traffic))
|
|
||||||
dst->traffic = src->traffic;
|
|
||||||
if(IE_ISGOOD(src->exqos))
|
|
||||||
dst->exqos = src->exqos;
|
|
||||||
if(IE_ISGOOD(src->facility))
|
|
||||||
dst->facility = src->facility;
|
|
||||||
if(IE_ISGOOD(src->abrsetup))
|
|
||||||
dst->abrsetup = src->abrsetup;
|
|
||||||
if(IE_ISGOOD(src->abradd))
|
|
||||||
dst->abradd = src->abradd;
|
|
||||||
if(IE_ISGOOD(src->called_soft))
|
|
||||||
dst->called_soft = src->called_soft;
|
|
||||||
if(IE_ISGOOD(src->report))
|
|
||||||
dst->report = src->report;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_connect_ack(struct uni_connect_ack *src, struct uni_connect_ack *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_release(struct uni_release *src, struct uni_release *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
for(s = d = 0; s < 2; s++)
|
|
||||||
if(IE_ISGOOD(src->cause[s]))
|
|
||||||
dst->cause[d++] = src->cause[s];
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
if(IE_ISGOOD(src->facility))
|
|
||||||
dst->facility = src->facility;
|
|
||||||
if(IE_ISGOOD(src->crankback))
|
|
||||||
dst->crankback = src->crankback;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_release_compl(struct uni_release_compl *src, struct uni_release_compl *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
for(s = d = 0; s < 2; s++)
|
|
||||||
if(IE_ISGOOD(src->cause[s]))
|
|
||||||
dst->cause[d++] = src->cause[s];
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
if(IE_ISGOOD(src->crankback))
|
|
||||||
dst->crankback = src->crankback;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_setup(struct uni_setup *src, struct uni_setup *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->aal))
|
|
||||||
dst->aal = src->aal;
|
|
||||||
if(IE_ISGOOD(src->traffic))
|
|
||||||
dst->traffic = src->traffic;
|
|
||||||
if(IE_ISGOOD(src->bearer))
|
|
||||||
dst->bearer = src->bearer;
|
|
||||||
if(IE_ISGOOD(src->bhli))
|
|
||||||
dst->bhli = src->bhli;
|
|
||||||
if(IE_ISGOOD(src->blli_repeat))
|
|
||||||
dst->blli_repeat = src->blli_repeat;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_BLLI; s++)
|
|
||||||
if(IE_ISGOOD(src->blli[s]))
|
|
||||||
dst->blli[d++] = src->blli[s];
|
|
||||||
if(IE_ISGOOD(src->called))
|
|
||||||
dst->called = src->called;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_CALLEDSUB; s++)
|
|
||||||
if(IE_ISGOOD(src->calledsub[s]))
|
|
||||||
dst->calledsub[d++] = src->calledsub[s];
|
|
||||||
if(IE_ISGOOD(src->calling))
|
|
||||||
dst->calling = src->calling;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_CALLINGSUB; s++)
|
|
||||||
if(IE_ISGOOD(src->callingsub[s]))
|
|
||||||
dst->callingsub[d++] = src->callingsub[s];
|
|
||||||
if(IE_ISGOOD(src->connid))
|
|
||||||
dst->connid = src->connid;
|
|
||||||
if(IE_ISGOOD(src->qos))
|
|
||||||
dst->qos = src->qos;
|
|
||||||
if(IE_ISGOOD(src->eetd))
|
|
||||||
dst->eetd = src->eetd;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->scompl))
|
|
||||||
dst->scompl = src->scompl;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_TNS; s++)
|
|
||||||
if(IE_ISGOOD(src->tns[s]))
|
|
||||||
dst->tns[d++] = src->tns[s];
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->atraffic))
|
|
||||||
dst->atraffic = src->atraffic;
|
|
||||||
if(IE_ISGOOD(src->mintraffic))
|
|
||||||
dst->mintraffic = src->mintraffic;
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->lij_callid))
|
|
||||||
dst->lij_callid = src->lij_callid;
|
|
||||||
if(IE_ISGOOD(src->lij_param))
|
|
||||||
dst->lij_param = src->lij_param;
|
|
||||||
if(IE_ISGOOD(src->lij_seqno))
|
|
||||||
dst->lij_seqno = src->lij_seqno;
|
|
||||||
if(IE_ISGOOD(src->exqos))
|
|
||||||
dst->exqos = src->exqos;
|
|
||||||
if(IE_ISGOOD(src->abrsetup))
|
|
||||||
dst->abrsetup = src->abrsetup;
|
|
||||||
if(IE_ISGOOD(src->abradd))
|
|
||||||
dst->abradd = src->abradd;
|
|
||||||
if(IE_ISGOOD(src->cscope))
|
|
||||||
dst->cscope = src->cscope;
|
|
||||||
if(IE_ISGOOD(src->calling_soft))
|
|
||||||
dst->calling_soft = src->calling_soft;
|
|
||||||
if(IE_ISGOOD(src->called_soft))
|
|
||||||
dst->called_soft = src->called_soft;
|
|
||||||
if(IE_ISGOOD(src->dtl_repeat))
|
|
||||||
dst->dtl_repeat = src->dtl_repeat;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_DTL; s++)
|
|
||||||
if(IE_ISGOOD(src->dtl[s]))
|
|
||||||
dst->dtl[d++] = src->dtl[s];
|
|
||||||
if(IE_ISGOOD(src->report))
|
|
||||||
dst->report = src->report;
|
|
||||||
if(IE_ISGOOD(src->mdcr))
|
|
||||||
dst->mdcr = src->mdcr;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_status(struct uni_status *src, struct uni_status *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->callstate))
|
|
||||||
dst->callstate = src->callstate;
|
|
||||||
if(IE_ISGOOD(src->cause))
|
|
||||||
dst->cause = src->cause;
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->epstate))
|
|
||||||
dst->epstate = src->epstate;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_status_enq(struct uni_status_enq *src, struct uni_status_enq *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_notify(struct uni_notify *src, struct uni_notify *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_restart(struct uni_restart *src, struct uni_restart *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->connid))
|
|
||||||
dst->connid = src->connid;
|
|
||||||
if(IE_ISGOOD(src->restart))
|
|
||||||
dst->restart = src->restart;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_restart_ack(struct uni_restart_ack *src, struct uni_restart_ack *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->connid))
|
|
||||||
dst->connid = src->connid;
|
|
||||||
if(IE_ISGOOD(src->restart))
|
|
||||||
dst->restart = src->restart;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_add_party(struct uni_add_party *src, struct uni_add_party *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->aal))
|
|
||||||
dst->aal = src->aal;
|
|
||||||
if(IE_ISGOOD(src->bhli))
|
|
||||||
dst->bhli = src->bhli;
|
|
||||||
if(IE_ISGOOD(src->blli))
|
|
||||||
dst->blli = src->blli;
|
|
||||||
if(IE_ISGOOD(src->called))
|
|
||||||
dst->called = src->called;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_CALLEDSUB; s++)
|
|
||||||
if(IE_ISGOOD(src->calledsub[s]))
|
|
||||||
dst->calledsub[d++] = src->calledsub[s];
|
|
||||||
if(IE_ISGOOD(src->calling))
|
|
||||||
dst->calling = src->calling;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_CALLINGSUB; s++)
|
|
||||||
if(IE_ISGOOD(src->callingsub[s]))
|
|
||||||
dst->callingsub[d++] = src->callingsub[s];
|
|
||||||
if(IE_ISGOOD(src->scompl))
|
|
||||||
dst->scompl = src->scompl;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_TNS; s++)
|
|
||||||
if(IE_ISGOOD(src->tns[s]))
|
|
||||||
dst->tns[d++] = src->tns[s];
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->eetd))
|
|
||||||
dst->eetd = src->eetd;
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->lij_seqno))
|
|
||||||
dst->lij_seqno = src->lij_seqno;
|
|
||||||
if(IE_ISGOOD(src->calling_soft))
|
|
||||||
dst->calling_soft = src->calling_soft;
|
|
||||||
if(IE_ISGOOD(src->called_soft))
|
|
||||||
dst->called_soft = src->called_soft;
|
|
||||||
if(IE_ISGOOD(src->dtl_repeat))
|
|
||||||
dst->dtl_repeat = src->dtl_repeat;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_DTL; s++)
|
|
||||||
if(IE_ISGOOD(src->dtl[s]))
|
|
||||||
dst->dtl[d++] = src->dtl[s];
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_add_party_ack(struct uni_add_party_ack *src, struct uni_add_party_ack *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->aal))
|
|
||||||
dst->aal = src->aal;
|
|
||||||
if(IE_ISGOOD(src->blli))
|
|
||||||
dst->blli = src->blli;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->eetd))
|
|
||||||
dst->eetd = src->eetd;
|
|
||||||
if(IE_ISGOOD(src->conned))
|
|
||||||
dst->conned = src->conned;
|
|
||||||
if(IE_ISGOOD(src->connedsub))
|
|
||||||
dst->connedsub = src->connedsub;
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->called_soft))
|
|
||||||
dst->called_soft = src->called_soft;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_party_alerting(struct uni_party_alerting *src, struct uni_party_alerting *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_add_party_rej(struct uni_add_party_rej *src, struct uni_add_party_rej *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->cause))
|
|
||||||
dst->cause = src->cause;
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->crankback))
|
|
||||||
dst->crankback = src->crankback;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_drop_party(struct uni_drop_party *src, struct uni_drop_party *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->cause))
|
|
||||||
dst->cause = src->cause;
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_drop_party_ack(struct uni_drop_party_ack *src, struct uni_drop_party_ack *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->cause))
|
|
||||||
dst->cause = src->cause;
|
|
||||||
if(IE_ISGOOD(src->uu))
|
|
||||||
dst->uu = src->uu;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_leaf_setup_req(struct uni_leaf_setup_req *src, struct uni_leaf_setup_req *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_TNS; s++)
|
|
||||||
if(IE_ISGOOD(src->tns[s]))
|
|
||||||
dst->tns[d++] = src->tns[s];
|
|
||||||
if(IE_ISGOOD(src->calling))
|
|
||||||
dst->calling = src->calling;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_CALLINGSUB; s++)
|
|
||||||
if(IE_ISGOOD(src->callingsub[s]))
|
|
||||||
dst->callingsub[d++] = src->callingsub[s];
|
|
||||||
if(IE_ISGOOD(src->called))
|
|
||||||
dst->called = src->called;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_CALLEDSUB; s++)
|
|
||||||
if(IE_ISGOOD(src->calledsub[s]))
|
|
||||||
dst->calledsub[d++] = src->calledsub[s];
|
|
||||||
if(IE_ISGOOD(src->lij_callid))
|
|
||||||
dst->lij_callid = src->lij_callid;
|
|
||||||
if(IE_ISGOOD(src->lij_seqno))
|
|
||||||
dst->lij_seqno = src->lij_seqno;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_leaf_setup_fail(struct uni_leaf_setup_fail *src, struct uni_leaf_setup_fail *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->cause))
|
|
||||||
dst->cause = src->cause;
|
|
||||||
if(IE_ISGOOD(src->called))
|
|
||||||
dst->called = src->called;
|
|
||||||
if(IE_ISGOOD(src->calledsub))
|
|
||||||
dst->calledsub = src->calledsub;
|
|
||||||
if(IE_ISGOOD(src->lij_seqno))
|
|
||||||
dst->lij_seqno = src->lij_seqno;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_TNS; s++)
|
|
||||||
if(IE_ISGOOD(src->tns[s]))
|
|
||||||
dst->tns[d++] = src->tns[s];
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_cobisetup(struct uni_cobisetup *src, struct uni_cobisetup *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->facility))
|
|
||||||
dst->facility = src->facility;
|
|
||||||
if(IE_ISGOOD(src->called))
|
|
||||||
dst->called = src->called;
|
|
||||||
if(IE_ISGOOD(src->calledsub))
|
|
||||||
dst->calledsub = src->calledsub;
|
|
||||||
if(IE_ISGOOD(src->calling))
|
|
||||||
dst->calling = src->calling;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_facility(struct uni_facility *src, struct uni_facility *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->facility))
|
|
||||||
dst->facility = src->facility;
|
|
||||||
if(IE_ISGOOD(src->called))
|
|
||||||
dst->called = src->called;
|
|
||||||
if(IE_ISGOOD(src->calledsub))
|
|
||||||
dst->calledsub = src->calledsub;
|
|
||||||
if(IE_ISGOOD(src->calling))
|
|
||||||
dst->calling = src->calling;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_modify_req(struct uni_modify_req *src, struct uni_modify_req *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->traffic))
|
|
||||||
dst->traffic = src->traffic;
|
|
||||||
if(IE_ISGOOD(src->atraffic))
|
|
||||||
dst->atraffic = src->atraffic;
|
|
||||||
if(IE_ISGOOD(src->mintraffic))
|
|
||||||
dst->mintraffic = src->mintraffic;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_modify_ack(struct uni_modify_ack *src, struct uni_modify_ack *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->report))
|
|
||||||
dst->report = src->report;
|
|
||||||
if(IE_ISGOOD(src->traffic))
|
|
||||||
dst->traffic = src->traffic;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_modify_rej(struct uni_modify_rej *src, struct uni_modify_rej *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->cause))
|
|
||||||
dst->cause = src->cause;
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_conn_avail(struct uni_conn_avail *src, struct uni_conn_avail *dst)
|
|
||||||
{
|
|
||||||
u_int s, d;
|
|
||||||
|
|
||||||
if(IE_ISGOOD(src->notify))
|
|
||||||
dst->notify = src->notify;
|
|
||||||
for(s = d = 0; s < UNI_NUM_IE_GIT; s++)
|
|
||||||
if(IE_ISGOOD(src->git[s]))
|
|
||||||
dst->git[d++] = src->git[s];
|
|
||||||
if(IE_ISGOOD(src->report))
|
|
||||||
dst->report = src->report;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_unknown(struct uni_unknown *src, struct uni_unknown *dst)
|
|
||||||
{
|
|
||||||
if(IE_ISGOOD(src->epref))
|
|
||||||
dst->epref = src->epref;
|
|
||||||
if(IE_ISGOOD(src->unrec))
|
|
||||||
dst->unrec = src->unrec;
|
|
||||||
}
|
|
@ -1,442 +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/sig/sig_verify.c,v 1.19 2004/07/08 08:22:23 brandt Exp $
|
|
||||||
*
|
|
||||||
* Message verification with explicit action indicators.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <netnatm/unimsg.h>
|
|
||||||
#include <netnatm/saal/sscfudef.h>
|
|
||||||
#include <netnatm/msg/unistruct.h>
|
|
||||||
#include <netnatm/msg/unimsglib.h>
|
|
||||||
#include <netnatm/sig/uni.h>
|
|
||||||
|
|
||||||
#include <netnatm/sig/unipriv.h>
|
|
||||||
#include <netnatm/sig/unimkmsg.h>
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_mandate_ie(struct uni *uni, enum uni_ietype ie)
|
|
||||||
{
|
|
||||||
struct uni_ierr *e;
|
|
||||||
|
|
||||||
FOREACH_ERR(e, uni)
|
|
||||||
if (e->ie == ie) {
|
|
||||||
e->man = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (UNI_SAVE_IERR(&uni->cx, ie, UNI_IEACT_DEFAULT, UNI_IERR_MIS))
|
|
||||||
uni->cx.err[uni->cx.errcnt - 1].man = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This special handling is required for ADD PARTY, PARTY ALERTING and
|
|
||||||
* ADD PARTY ACKNOWLEDGE by Q.2971 9.5.3.2.1.
|
|
||||||
* It means, that the EPREF should be handled as mandatory only if
|
|
||||||
* no other IEs have explicit action indicators.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_mandate_epref(struct uni *uni, struct uni_ie_epref *epref)
|
|
||||||
{
|
|
||||||
struct uni_ierr *e;
|
|
||||||
int maxact;
|
|
||||||
|
|
||||||
if (!IE_ISPRESENT(*epref)) {
|
|
||||||
/*
|
|
||||||
* 9.5.3.2.1 -- missing endpoint reference
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* a) if any unrecognized or IE with error has a CLEAR
|
|
||||||
* action indicator, this takes precedence.
|
|
||||||
* b) if any unrecognized or IE with error has a
|
|
||||||
* discard message and report action indicator, this takes
|
|
||||||
* precedence.
|
|
||||||
* c) if any unrecognized or IE with error has a
|
|
||||||
* discard message action indicator, this takes
|
|
||||||
* precedence.
|
|
||||||
*
|
|
||||||
* In any of these cases we must remove the EPREF IE
|
|
||||||
* if it has CLEAR, otherwise the CLEAR would take over.
|
|
||||||
*/
|
|
||||||
maxact = -1;
|
|
||||||
FOREACH_ERR(e, uni) {
|
|
||||||
if (e->ie == UNI_IE_EPREF)
|
|
||||||
continue;
|
|
||||||
if (e->act == UNI_IEACT_CLEAR)
|
|
||||||
maxact = UNI_IEACT_CLEAR;
|
|
||||||
else if (e->act == UNI_IEACT_MSG_REPORT) {
|
|
||||||
if (maxact == -1 && maxact != UNI_IEACT_CLEAR)
|
|
||||||
maxact = UNI_IEACT_MSG_REPORT;
|
|
||||||
} else if (e->act == UNI_IEACT_MSG_IGNORE) {
|
|
||||||
if (maxact == -1)
|
|
||||||
maxact = UNI_IEACT_MSG_IGNORE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxact != -1) {
|
|
||||||
/* ok, second pass to remove UNI_IE_EPREF */
|
|
||||||
FOREACH_ERR(e, uni)
|
|
||||||
if (e->ie == UNI_IE_EPREF) {
|
|
||||||
memmove(e, e + 1,
|
|
||||||
(uni->cx.errcnt - (e - uni->cx.err)
|
|
||||||
- 1) * sizeof(uni->cx.err[0]));
|
|
||||||
uni->cx.errcnt--;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* d) if nothing of the above, the IE is mandatory
|
|
||||||
*/
|
|
||||||
uni_mandate_ie(uni, UNI_IE_EPREF);
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (IE_ISGOOD(*epref))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* It has an error obviously
|
|
||||||
* 9.5.3.2.2
|
|
||||||
*
|
|
||||||
* It turns out, that Q.2931 handling just does the right thing
|
|
||||||
* if we don't mandate the IE.
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Look, what to do with this message. We assume, that the message itself is
|
|
||||||
* recognized.
|
|
||||||
*
|
|
||||||
* This is rather complicated. We must use the information provided in the
|
|
||||||
* fields of the context, because IEs with length errors may not be set
|
|
||||||
* altogether.
|
|
||||||
*/
|
|
||||||
enum verify
|
|
||||||
uni_verify(struct uni *uni, enum uni_msgact msgact)
|
|
||||||
{
|
|
||||||
struct uni_ierr *e1;
|
|
||||||
|
|
||||||
if (uni->debug[UNI_FAC_VERIFY] >= 2) {
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 2, "ie=%02x err=%u man=%d"
|
|
||||||
" act=%u", e1->ie, e1->err, e1->man, e1->act);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Look for missing mandatory IEs. The action indicator is ignored
|
|
||||||
* according to 5.6.7.1. If IEs are missing the action is to
|
|
||||||
* ignore the message and report status for all messages except
|
|
||||||
* RELEASE, RELEASE_COMPLETE and SETUP. Because we must differentiate
|
|
||||||
* this RAI from other RAIs in this case, use another return code.
|
|
||||||
* Note, that mandatory IEs with errors are not handled here.
|
|
||||||
*/
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->err == UNI_IERR_MIS) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_MANDAT);
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "RAIM");
|
|
||||||
return (VFY_RAIM);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When any IE with error specifies a CLR action indicator, this
|
|
||||||
* takes precedence obviously. There are two cases here:
|
|
||||||
* unrecognized IEs and IEs with error. So we look through the
|
|
||||||
* error array twice and send only one STATUS. Unrecognized will
|
|
||||||
* take precedence.
|
|
||||||
*
|
|
||||||
* 5.7.2a)
|
|
||||||
*/
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->act == UNI_IEACT_CLEAR && e1->err == UNI_IERR_UNK) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_IE_NIMPL);
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "CLR1");
|
|
||||||
return (VFY_CLR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->act == UNI_IEACT_CLEAR &&
|
|
||||||
(e1->err == UNI_IERR_LEN || e1->err == UNI_IERR_BAD ||
|
|
||||||
e1->err == UNI_IERR_ACC)) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_IE_INV);
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "CLR2");
|
|
||||||
return (VFY_CLR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Now check, whether anybody wants to explicitly ignore the message
|
|
||||||
* and report status.
|
|
||||||
*
|
|
||||||
* 5.7.2a)
|
|
||||||
*/
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->act == UNI_IEACT_MSG_REPORT && e1->err == UNI_IERR_UNK) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_IE_NIMPL);
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "RAI");
|
|
||||||
return (VFY_RAI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->act == UNI_IEACT_MSG_REPORT &&
|
|
||||||
(e1->err == UNI_IERR_LEN || e1->err == UNI_IERR_BAD ||
|
|
||||||
e1->err == UNI_IERR_ACC)) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_IE_INV);
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "RAI");
|
|
||||||
return (VFY_RAI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Now look whether some IE wants to explicitely ignore the message
|
|
||||||
* without any report.
|
|
||||||
*/
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->act == UNI_IEACT_MSG_IGNORE) {
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "I1");
|
|
||||||
return (VFY_I);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* At this point we have left only
|
|
||||||
* mandatory and non-mandatory IEs with error that want the IE to be
|
|
||||||
* ignored or ignored with report or defaulted.
|
|
||||||
* Because a mandatory IE with errors lead to
|
|
||||||
* the message beeing ignored, we make this of higher
|
|
||||||
* precedence, than the rest.
|
|
||||||
*/
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->man) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_MANDAT);
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "RAI");
|
|
||||||
return (VFY_RAI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Now look for ignoring the IE and reporting. This takes precedence
|
|
||||||
* over simply ignoring it. We also collect defaulted (non-mandatory)
|
|
||||||
* IEs.
|
|
||||||
*
|
|
||||||
* 5.7.2d) and 5.6.8.1
|
|
||||||
*/
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if ((e1->act == UNI_IEACT_DEFAULT ||
|
|
||||||
e1->act == UNI_IEACT_REPORT)
|
|
||||||
&& e1->err != UNI_IERR_UNK) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_IE_INV);
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "RAP");
|
|
||||||
return (VFY_RAP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if ((e1->act == UNI_IEACT_DEFAULT ||
|
|
||||||
e1->act == UNI_IEACT_REPORT)
|
|
||||||
&& e1->err == UNI_IERR_UNK) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_IE_NIMPL);
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "RAPU");
|
|
||||||
return (VFY_RAPU);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This leaves us with IEs, that want to be ignored. Among these may
|
|
||||||
* be mandatory IEs. If we have an mandatory IEs here in the error
|
|
||||||
* array, then the message wil not contain enough information and
|
|
||||||
* must be handled according to 5.8 as either in 5.6.7.1 (this
|
|
||||||
* means, that mandatory IEs cannot really be ignored) or 5.7.1.
|
|
||||||
*/
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->man) {
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_MANDAT);
|
|
||||||
if (msgact == UNI_MSGACT_CLEAR) {
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "CLR3");
|
|
||||||
return (VFY_CLR);
|
|
||||||
}
|
|
||||||
if (msgact == UNI_MSGACT_IGNORE) {
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "I2");
|
|
||||||
return (VFY_I);
|
|
||||||
}
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "RAI");
|
|
||||||
return (VFY_RAI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Now only non-mandatory IEs are left, that want to be explicitely
|
|
||||||
* ignored.
|
|
||||||
*/
|
|
||||||
if (uni->cx.errcnt != 0)
|
|
||||||
MK_IE_CAUSE(uni->cause, UNI_CAUSE_LOC_USER,
|
|
||||||
UNI_CAUSE_IE_INV);
|
|
||||||
|
|
||||||
VERBOSE(uni, UNI_FAC_VERIFY, 1, "OK");
|
|
||||||
return (VFY_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Collect the IE identifiers for some of the known cause codes.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_vfy_collect_ies(struct uni *uni)
|
|
||||||
{
|
|
||||||
struct uni_ierr *e;
|
|
||||||
|
|
||||||
#define STUFF_IE(IE) \
|
|
||||||
uni->cause.u.ie.ie[uni->cause.u.ie.len++] = (IE); \
|
|
||||||
if (uni->cause.u.ie.len == UNI_CAUSE_IE_N) \
|
|
||||||
break;
|
|
||||||
|
|
||||||
uni->cause.u.ie.len = 0;
|
|
||||||
if (uni->cause.cause == UNI_CAUSE_MANDAT) {
|
|
||||||
FOREACH_ERR(e, uni) {
|
|
||||||
if (e->err == UNI_IERR_MIS || e->man != 0) {
|
|
||||||
STUFF_IE(e->ie);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (uni->cause.cause == UNI_CAUSE_IE_NIMPL) {
|
|
||||||
FOREACH_ERR(e, uni) {
|
|
||||||
if (e->err == UNI_IERR_UNK) {
|
|
||||||
STUFF_IE(e->ie);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (uni->cause.cause == UNI_CAUSE_IE_INV) {
|
|
||||||
FOREACH_ERR(e, uni) {
|
|
||||||
if (e->err == UNI_IERR_LEN ||
|
|
||||||
e->err == UNI_IERR_BAD ||
|
|
||||||
e->err == UNI_IERR_ACC) {
|
|
||||||
STUFF_IE(e->ie);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (uni->cause.u.ie.len != 0)
|
|
||||||
uni->cause.h.present |= UNI_CAUSE_IE_P;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
uni_respond_status_verify(struct uni *uni, struct uni_cref *cref,
|
|
||||||
enum uni_callstate cs, struct uni_ie_epref *epref,
|
|
||||||
enum uni_epstate ps)
|
|
||||||
{
|
|
||||||
struct uni_all *resp;
|
|
||||||
|
|
||||||
if ((resp = UNI_ALLOC()) == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
uni_vfy_collect_ies(uni);
|
|
||||||
|
|
||||||
MK_MSG_RESP(resp, UNI_STATUS, cref);
|
|
||||||
MK_IE_CALLSTATE(resp->u.status.callstate, cs);
|
|
||||||
resp->u.status.cause = uni->cause;
|
|
||||||
if (epref && IE_ISGOOD(*epref)) {
|
|
||||||
MK_IE_EPREF(resp->u.status.epref, epref->epref, !epref->flag);
|
|
||||||
MK_IE_EPSTATE(resp->u.status.epstate, ps);
|
|
||||||
}
|
|
||||||
|
|
||||||
uni_send_output(resp, uni);
|
|
||||||
|
|
||||||
UNI_FREE(resp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Handling of Q.2971 9.5.8.1:
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_vfy_remove_unknown(struct uni *uni)
|
|
||||||
{
|
|
||||||
struct uni_ierr *e1, *e0;
|
|
||||||
int flag = 0;
|
|
||||||
|
|
||||||
FOREACH_ERR(e1, uni) {
|
|
||||||
if (e1->err == UNI_IERR_UNK) {
|
|
||||||
if (e1->act == UNI_IEACT_CLEAR ||
|
|
||||||
e1->act == UNI_IEACT_MSG_IGNORE ||
|
|
||||||
e1->act == UNI_IEACT_MSG_REPORT)
|
|
||||||
return;
|
|
||||||
if (e1->act == UNI_IEACT_REPORT ||
|
|
||||||
e1->act == UNI_IEACT_DEFAULT)
|
|
||||||
flag = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (flag)
|
|
||||||
return;
|
|
||||||
e0 = e1 = uni->cx.err;
|
|
||||||
while (e1 < uni->cx.err + uni->cx.errcnt) {
|
|
||||||
if (e1->err != UNI_IERR_UNK) {
|
|
||||||
if (e0 != e1)
|
|
||||||
*e0 = *e1;
|
|
||||||
e0++;
|
|
||||||
}
|
|
||||||
e1++;
|
|
||||||
}
|
|
||||||
uni->cx.errcnt = e0 - uni->cx.err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Handling for ADD_PARTY_REJ and DROP_PARTY_ACK with bad cause
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uni_vfy_remove_cause(struct uni *uni)
|
|
||||||
{
|
|
||||||
struct uni_ierr *e1, *e0;
|
|
||||||
|
|
||||||
e0 = e1 = uni->cx.err;
|
|
||||||
while (e1 < uni->cx.err + uni->cx.errcnt) {
|
|
||||||
if (e1->ie != UNI_IE_CAUSE) {
|
|
||||||
if (e0 != e1)
|
|
||||||
*e0 = *e1;
|
|
||||||
e0++;
|
|
||||||
}
|
|
||||||
e1++;
|
|
||||||
}
|
|
||||||
uni->cx.errcnt = e0 - uni->cx.err;
|
|
||||||
}
|
|
@ -1,106 +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/sig/uni.h,v 1.5 2004/07/08 08:22:24 brandt Exp $
|
|
||||||
*
|
|
||||||
* Public UNI interface
|
|
||||||
*/
|
|
||||||
#ifndef _NETNATM_SIG_UNI_H_
|
|
||||||
#define _NETNATM_SIG_UNI_H_
|
|
||||||
|
|
||||||
#include <netnatm/sig/unidef.h>
|
|
||||||
|
|
||||||
struct uni;
|
|
||||||
|
|
||||||
/* functions to be supplied by the user */
|
|
||||||
struct uni_funcs {
|
|
||||||
/* output to the upper layer */
|
|
||||||
void (*uni_output)(struct uni *, void *, enum uni_sig,
|
|
||||||
uint32_t, struct uni_msg *);
|
|
||||||
|
|
||||||
/* output to the SAAL */
|
|
||||||
void (*saal_output)(struct uni *, void *, enum saal_sig,
|
|
||||||
struct uni_msg *);
|
|
||||||
|
|
||||||
/* verbosity */
|
|
||||||
void (*verbose)(struct uni *, void *, enum uni_verb,
|
|
||||||
const char *, ...) __printflike(4, 5);
|
|
||||||
|
|
||||||
/* function to 'print' status */
|
|
||||||
void (*status)(struct uni *, void *, void *,
|
|
||||||
const char *, ...) __printflike(4, 5);
|
|
||||||
|
|
||||||
#ifndef _KERNEL
|
|
||||||
/* start a timer */
|
|
||||||
void *(*start_timer)(struct uni *, void *, u_int,
|
|
||||||
void (*)(void *), void *);
|
|
||||||
|
|
||||||
/* stop a timer */
|
|
||||||
void (*stop_timer)(struct uni *, void *, void *);
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/* create a UNI instance */
|
|
||||||
struct uni *uni_create(void *, const struct uni_funcs *);
|
|
||||||
|
|
||||||
/* destroy a UNI instance, free all resources */
|
|
||||||
void uni_destroy(struct uni *);
|
|
||||||
|
|
||||||
/* generate a status report */
|
|
||||||
void uni_status(struct uni *, void *);
|
|
||||||
|
|
||||||
/* get current instance configuration */
|
|
||||||
void uni_get_config(const struct uni *, struct uni_config *);
|
|
||||||
|
|
||||||
/* set new instance configuration */
|
|
||||||
void uni_set_config(struct uni *, const struct uni_config *,
|
|
||||||
uint32_t *, uint32_t *, uint32_t *);
|
|
||||||
|
|
||||||
/* input from the SAAL to the instance */
|
|
||||||
void uni_saal_input(struct uni *, enum saal_sig, struct uni_msg *);
|
|
||||||
|
|
||||||
/* input from the upper layer to the instance */
|
|
||||||
void uni_uni_input(struct uni *, enum uni_sig, uint32_t, struct uni_msg *);
|
|
||||||
|
|
||||||
/* do work on pending signals */
|
|
||||||
void uni_work(struct uni *);
|
|
||||||
|
|
||||||
/* set debuging level */
|
|
||||||
void uni_set_debug(struct uni *, enum uni_verb, u_int level);
|
|
||||||
u_int uni_get_debug(const struct uni *, enum uni_verb);
|
|
||||||
|
|
||||||
/* reset a UNI instance */
|
|
||||||
void uni_reset(struct uni *);
|
|
||||||
|
|
||||||
/* states */
|
|
||||||
u_int uni_getcustate(const struct uni *);
|
|
||||||
|
|
||||||
/* return a reference to the coding/decoding context */
|
|
||||||
struct unicx *uni_context(struct uni *);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,480 +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/sig/unidef.h,v 1.9 2004/07/08 08:22:24 brandt Exp $
|
|
||||||
*
|
|
||||||
* UNI public definitions.
|
|
||||||
*/
|
|
||||||
#ifndef _ATM_SIG_UNIDEF_H_
|
|
||||||
#define _ATM_SIG_UNIDEF_H_
|
|
||||||
|
|
||||||
#ifdef _KERNEL
|
|
||||||
#include <sys/stdint.h>
|
|
||||||
#else
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Debug facilities
|
|
||||||
*/
|
|
||||||
#define UNI_DEBUG_FACILITIES \
|
|
||||||
UNI_DEBUG_DEFINE(TIMEOUT) \
|
|
||||||
UNI_DEBUG_DEFINE(RESTART) \
|
|
||||||
UNI_DEBUG_DEFINE(SAAL) \
|
|
||||||
UNI_DEBUG_DEFINE(PARSE) \
|
|
||||||
UNI_DEBUG_DEFINE(CALL) \
|
|
||||||
UNI_DEBUG_DEFINE(WARN) \
|
|
||||||
UNI_DEBUG_DEFINE(COORD) \
|
|
||||||
UNI_DEBUG_DEFINE(API) \
|
|
||||||
UNI_DEBUG_DEFINE(MSG) \
|
|
||||||
UNI_DEBUG_DEFINE(ERR) \
|
|
||||||
UNI_DEBUG_DEFINE(VERIFY) \
|
|
||||||
|
|
||||||
enum uni_verb {
|
|
||||||
#define UNI_DEBUG_DEFINE(D) UNI_FAC_##D,
|
|
||||||
UNI_DEBUG_FACILITIES
|
|
||||||
#undef UNI_DEBUG_DEFINE
|
|
||||||
|
|
||||||
UNI_MAXFACILITY,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Default timer values and repeat counts
|
|
||||||
*/
|
|
||||||
#define UNI_T301_DEFAULT 180000
|
|
||||||
#define UNI_T303_DEFAULT 4000
|
|
||||||
#define UNI_T303_CNT_DEFAULT 2
|
|
||||||
#define UNI_T308_DEFAULT 30000
|
|
||||||
#define UNI_T308_CNT_DEFAULT 2
|
|
||||||
#define UNI_T309_DEFAULT 10000
|
|
||||||
#define UNI_T310U_DEFAULT 30000
|
|
||||||
#define UNI_T310N_DEFAULT 10000
|
|
||||||
#define UNI_T313_DEFAULT 4000
|
|
||||||
#define UNI_T316_DEFAULT 120000
|
|
||||||
#define UNI_T316_CNT_DEFAULT 2
|
|
||||||
#define UNI_T317_DEFAULT 90000
|
|
||||||
#define UNI_T322_DEFAULT 4000
|
|
||||||
#define UNI_T322_CNT_DEFAULT 2
|
|
||||||
#define UNI_T397_DEFAULT UNI_T301_DEFAULT
|
|
||||||
#define UNI_T398_DEFAULT 4000
|
|
||||||
#define UNI_T399U_DEFAULT (UNI_T303_DEFAULT + UNI_T310U_DEFAULT)
|
|
||||||
#define UNI_T399N_DEFAULT (UNI_T303_DEFAULT + UNI_T310N_DEFAULT)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Protocol support
|
|
||||||
*/
|
|
||||||
enum uni_proto {
|
|
||||||
UNIPROTO_UNI40U, /* UNI4.0 user side */
|
|
||||||
UNIPROTO_UNI40N, /* UNI4.0 network side */
|
|
||||||
UNIPROTO_PNNI10, /* PNNI1.0 */
|
|
||||||
};
|
|
||||||
enum uni_popt {
|
|
||||||
UNIPROTO_GFP = 0x0001, /* enable GFP */
|
|
||||||
UNIPROTO_SB_TB = 0x0002, /* Coincident Sb-Tb/Tb */
|
|
||||||
|
|
||||||
UNIPROTO_ALLMASK = 0x0003,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Other options
|
|
||||||
*/
|
|
||||||
enum uni_option {
|
|
||||||
UNIOPT_GIT_HARD = 0x0001, /* harder check of GIT IE */
|
|
||||||
UNIOPT_BEARER_HARD = 0x0002, /* harder check of BEARER IE */
|
|
||||||
UNIOPT_CAUSE_HARD = 0x0004, /* harder check of CAUSE IE */
|
|
||||||
|
|
||||||
UNIOPT_ALLMASK = 0x0007,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* UNI configuration
|
|
||||||
*/
|
|
||||||
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 */
|
|
||||||
};
|
|
||||||
enum uni_config_mask {
|
|
||||||
UNICFG_PROTO = 0x00000001,
|
|
||||||
UNICFG_TIMER301 = 0x00000002,
|
|
||||||
UNICFG_TIMER303 = 0x00000004,
|
|
||||||
UNICFG_INIT303 = 0x00000008,
|
|
||||||
UNICFG_TIMER308 = 0x00000010,
|
|
||||||
UNICFG_INIT308 = 0x00000020,
|
|
||||||
UNICFG_TIMER309 = 0x00000040,
|
|
||||||
UNICFG_TIMER310 = 0x00000080,
|
|
||||||
UNICFG_TIMER313 = 0x00000100,
|
|
||||||
UNICFG_TIMER316 = 0x00000200,
|
|
||||||
UNICFG_INIT316 = 0x00000400,
|
|
||||||
UNICFG_TIMER317 = 0x00000800,
|
|
||||||
UNICFG_TIMER322 = 0x00001000,
|
|
||||||
UNICFG_INIT322 = 0x00002000,
|
|
||||||
UNICFG_TIMER397 = 0x00004000,
|
|
||||||
UNICFG_TIMER398 = 0x00008000,
|
|
||||||
UNICFG_TIMER399 = 0x00010000,
|
|
||||||
|
|
||||||
UNICFG_ALLMASK = 0x0001ffff,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* API signals
|
|
||||||
*/
|
|
||||||
enum uni_sig {
|
|
||||||
UNIAPI_ERROR = 0, /* UNI -> API */
|
|
||||||
|
|
||||||
UNIAPI_CALL_CREATED = 1, /* UNI -> API */
|
|
||||||
UNIAPI_CALL_DESTROYED = 2, /* UNI -> API */
|
|
||||||
UNIAPI_PARTY_CREATED = 3, /* UNI -> API */
|
|
||||||
UNIAPI_PARTY_DESTROYED = 4, /* UNI -> API */
|
|
||||||
|
|
||||||
UNIAPI_LINK_ESTABLISH_request = 5, /* API -> UNI */
|
|
||||||
UNIAPI_LINK_ESTABLISH_confirm = 6, /* UNI -> API */
|
|
||||||
UNIAPI_LINK_RELEASE_request = 7, /* API -> UNI */
|
|
||||||
UNIAPI_LINK_RELEASE_confirm = 8, /* UNI -> API */
|
|
||||||
|
|
||||||
UNIAPI_RESET_request = 9, /* API -> UNI */
|
|
||||||
UNIAPI_RESET_confirm = 10, /* UNI -> API */
|
|
||||||
UNIAPI_RESET_indication = 11, /* UNI -> API */
|
|
||||||
UNIAPI_RESET_ERROR_indication = 12, /* UNI -> API */
|
|
||||||
UNIAPI_RESET_response = 13, /* API -> UNI */
|
|
||||||
UNIAPI_RESET_ERROR_response = 14, /* API -> UNI */
|
|
||||||
UNIAPI_RESET_STATUS_indication = 15, /* UNI -> API */
|
|
||||||
|
|
||||||
UNIAPI_SETUP_request = 16, /* API -> UNI */
|
|
||||||
UNIAPI_SETUP_indication = 17, /* UNI -> API */
|
|
||||||
UNIAPI_SETUP_response = 18, /* API -> UNI */
|
|
||||||
UNIAPI_SETUP_confirm = 19, /* UNI -> API */
|
|
||||||
UNIAPI_SETUP_COMPLETE_indication= 20, /* U-UNI -> API */
|
|
||||||
UNIAPI_SETUP_COMPLETE_request = 46, /* API -> N-UNI */
|
|
||||||
UNIAPI_ALERTING_request = 21, /* API -> UNI */
|
|
||||||
UNIAPI_ALERTING_indication = 22, /* UNI -> API */
|
|
||||||
UNIAPI_PROCEEDING_request = 23, /* API -> UNI */
|
|
||||||
UNIAPI_PROCEEDING_indication = 24, /* UNI -> API */
|
|
||||||
UNIAPI_RELEASE_request = 25, /* API -> UNI */
|
|
||||||
UNIAPI_RELEASE_indication = 26, /* UNI -> API */
|
|
||||||
UNIAPI_RELEASE_response = 27, /* API -> UNI */
|
|
||||||
UNIAPI_RELEASE_confirm = 28, /* UNI -> API */
|
|
||||||
UNIAPI_NOTIFY_request = 29, /* API -> UNI */
|
|
||||||
UNIAPI_NOTIFY_indication = 30, /* UNI -> API */
|
|
||||||
UNIAPI_STATUS_indication = 31, /* UNI -> API */
|
|
||||||
UNIAPI_STATUS_ENQUIRY_request = 32, /* API -> UNI */
|
|
||||||
|
|
||||||
UNIAPI_ADD_PARTY_request = 33, /* API -> UNI */
|
|
||||||
UNIAPI_ADD_PARTY_indication = 34, /* UNI -> API */
|
|
||||||
UNIAPI_PARTY_ALERTING_request = 35, /* API -> UNI */
|
|
||||||
UNIAPI_PARTY_ALERTING_indication= 36, /* UNI -> API */
|
|
||||||
UNIAPI_ADD_PARTY_ACK_request = 37, /* API -> UNI */
|
|
||||||
UNIAPI_ADD_PARTY_ACK_indication = 38, /* UNI -> API */
|
|
||||||
UNIAPI_ADD_PARTY_REJ_request = 39, /* API -> UNI */
|
|
||||||
UNIAPI_ADD_PARTY_REJ_indication = 40, /* UNI -> API */
|
|
||||||
UNIAPI_DROP_PARTY_request = 41, /* API -> UNI */
|
|
||||||
UNIAPI_DROP_PARTY_indication = 42, /* UNI -> API */
|
|
||||||
UNIAPI_DROP_PARTY_ACK_request = 43, /* API -> UNI */
|
|
||||||
UNIAPI_DROP_PARTY_ACK_indication= 44, /* UNI -> API */
|
|
||||||
|
|
||||||
UNIAPI_ABORT_CALL_request = 45, /* API -> UNI */
|
|
||||||
|
|
||||||
UNIAPI_MAXSIG = 47
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_error {
|
|
||||||
uint32_t reason;
|
|
||||||
uint32_t state;
|
|
||||||
};
|
|
||||||
/* keep this in sync with atmapi.h:enum atmerr */
|
|
||||||
|
|
||||||
#define UNIAPI_DEF_ERRORS(MACRO) \
|
|
||||||
MACRO(OK, 0, "no error") \
|
|
||||||
MACRO(ERROR_BAD_SIGNAL, 1, "unknown signal") \
|
|
||||||
MACRO(ERROR_BADCU, 2, "signal in bad co-ordinator state") \
|
|
||||||
MACRO(ERROR_BAD_CALLSTATE, 3, "signal in bad call state") \
|
|
||||||
MACRO(ERROR_BAD_EPSTATE, 4, "signal in bad endpoint state") \
|
|
||||||
MACRO(ERROR_BAD_ARG, 5, "bad argument") \
|
|
||||||
MACRO(ERROR_BAD_CALL, 6, "unknown call reference") \
|
|
||||||
MACRO(ERROR_BAD_PARTY, 7, "unknown party") \
|
|
||||||
MACRO(ERROR_BAD_CTYPE, 8, "bad type of call for signal") \
|
|
||||||
MACRO(ERROR_BAD_IE, 9, "bad information element") \
|
|
||||||
MACRO(ERROR_EPREF_INUSE, 10, "endpoint reference already in use") \
|
|
||||||
MACRO(ERROR_MISSING_IE, 11, "missing information element") \
|
|
||||||
MACRO(ERROR_ENCODING, 12, "error during message encoding") \
|
|
||||||
MACRO(ERROR_NOMEM, 13, "out of memory") \
|
|
||||||
MACRO(ERROR_BUSY, 14, "status enquiry busy")
|
|
||||||
|
|
||||||
enum {
|
|
||||||
#define DEF(NAME, VAL, STR) UNIAPI_##NAME = VAL,
|
|
||||||
UNIAPI_DEF_ERRORS(DEF)
|
|
||||||
#undef DEF
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_call_created {
|
|
||||||
struct uni_cref cref;
|
|
||||||
};
|
|
||||||
struct uniapi_call_destroyed {
|
|
||||||
struct uni_cref cref;
|
|
||||||
};
|
|
||||||
struct uniapi_party_created {
|
|
||||||
struct uni_cref cref;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
};
|
|
||||||
struct uniapi_party_destroyed {
|
|
||||||
struct uni_cref cref;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
};
|
|
||||||
struct uniapi_abort_call_request {
|
|
||||||
struct uni_cref cref;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_reset_request {
|
|
||||||
struct uni_ie_restart restart;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_reset_confirm {
|
|
||||||
struct uni_ie_restart restart;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_reset_indication {
|
|
||||||
struct uni_ie_restart restart;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
|
|
||||||
};
|
|
||||||
struct uniapi_reset_error_indication {
|
|
||||||
uint32_t source; /* 0 - start, 1 - response */
|
|
||||||
uint32_t reason;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define UNIAPI_DEF_RESET_ERRORS(MACRO) \
|
|
||||||
MACRO(UNIAPI_RESET_ERROR_NO_CONFIRM, 0, \
|
|
||||||
"no confirmation") \
|
|
||||||
MACRO(UNIAPI_RESET_ERROR_NO_RESPONSE, 1, \
|
|
||||||
"no response") \
|
|
||||||
MACRO(UNIAPI_RESET_ERROR_PEER_INCOMP_STATE, 2, \
|
|
||||||
"incompatible state")
|
|
||||||
enum {
|
|
||||||
#define DEF(NAME, VALUE, STR) NAME = VALUE,
|
|
||||||
UNIAPI_DEF_RESET_ERRORS(DEF)
|
|
||||||
#undef DEF
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_reset_response {
|
|
||||||
struct uni_ie_restart restart;
|
|
||||||
struct uni_ie_connid connid;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_reset_error_response {
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_reset_status_indication {
|
|
||||||
struct uni_cref cref; /* STATUS message CREF */
|
|
||||||
struct uni_ie_callstate callstate;
|
|
||||||
struct uni_ie_cause cause;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_setup_request {
|
|
||||||
struct uni_setup setup;
|
|
||||||
};
|
|
||||||
struct uniapi_setup_indication {
|
|
||||||
struct uni_setup setup;
|
|
||||||
};
|
|
||||||
struct uniapi_setup_response {
|
|
||||||
struct uni_connect connect;
|
|
||||||
};
|
|
||||||
struct uniapi_setup_confirm {
|
|
||||||
struct uni_connect connect;
|
|
||||||
};
|
|
||||||
struct uniapi_setup_complete_indication {
|
|
||||||
struct uni_connect_ack connect_ack;
|
|
||||||
};
|
|
||||||
struct uniapi_setup_complete_request {
|
|
||||||
struct uni_connect_ack connect_ack;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_alerting_request {
|
|
||||||
struct uni_alerting alerting;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_alerting_indication {
|
|
||||||
struct uni_alerting alerting;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_proceeding_request {
|
|
||||||
struct uni_call_proc call_proc;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_proceeding_indication {
|
|
||||||
struct uni_call_proc call_proc;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct uniapi_release_request {
|
|
||||||
struct uni_release release;
|
|
||||||
};
|
|
||||||
struct uniapi_release_indication {
|
|
||||||
struct uni_release release;
|
|
||||||
};
|
|
||||||
struct uniapi_release_response {
|
|
||||||
struct uni_release_compl release_compl;
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
* A release confirm can come from a RELEASE COMPLETE or a RELEASE.
|
|
||||||
* Because the IEs in a RELEASE COMPLETE are a subset of a RELEASE,
|
|
||||||
* use the RELEASE here.
|
|
||||||
*/
|
|
||||||
struct uniapi_release_confirm {
|
|
||||||
struct uni_release release;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_notify_request {
|
|
||||||
struct uni_notify notify;
|
|
||||||
};
|
|
||||||
struct uniapi_notify_indication {
|
|
||||||
struct uni_notify notify;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_status_indication {
|
|
||||||
struct uni_cref cref;
|
|
||||||
enum uni_callstate my_state;
|
|
||||||
enum uni_cause my_cause;
|
|
||||||
struct uni_ie_callstate his_state;
|
|
||||||
struct uni_ie_cause his_cause;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
struct uni_ie_epstate epstate;
|
|
||||||
};
|
|
||||||
struct uniapi_status_enquiry_request {
|
|
||||||
struct uni_cref cref;
|
|
||||||
struct uni_ie_epref epref;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_add_party_request {
|
|
||||||
struct uni_add_party add;
|
|
||||||
};
|
|
||||||
struct uniapi_add_party_indication {
|
|
||||||
struct uni_add_party add;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_party_alerting_request {
|
|
||||||
struct uni_party_alerting alert;
|
|
||||||
};
|
|
||||||
struct uniapi_party_alerting_indication {
|
|
||||||
struct uni_party_alerting alert;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_add_party_ack_request {
|
|
||||||
struct uni_add_party_ack ack;
|
|
||||||
};
|
|
||||||
struct uniapi_add_party_ack_indication {
|
|
||||||
struct uni_add_party_ack ack;
|
|
||||||
};
|
|
||||||
struct uniapi_add_party_rej_request {
|
|
||||||
struct uni_add_party_rej rej;
|
|
||||||
};
|
|
||||||
struct uniapi_add_party_rej_indication {
|
|
||||||
struct uni_add_party_rej rej;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_drop_party_request {
|
|
||||||
struct uni_drop_party drop;
|
|
||||||
};
|
|
||||||
struct uniapi_drop_party_indication {
|
|
||||||
struct uni_drop_party drop;
|
|
||||||
struct uni_ie_cause my_cause;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uniapi_drop_party_ack_request {
|
|
||||||
struct uni_drop_party_ack ack;
|
|
||||||
};
|
|
||||||
struct uniapi_drop_party_ack_indication {
|
|
||||||
struct uni_drop_party drop;
|
|
||||||
struct uni_ie_crankback crankback;
|
|
||||||
};
|
|
||||||
|
|
||||||
union uniapi_all {
|
|
||||||
struct uniapi_error error;
|
|
||||||
struct uniapi_call_created call_created;
|
|
||||||
struct uniapi_call_destroyed call_destroyed;
|
|
||||||
struct uniapi_party_created party_created;
|
|
||||||
struct uniapi_party_destroyed party_destroyed;
|
|
||||||
struct uniapi_abort_call_request abort_call_request;
|
|
||||||
struct uniapi_reset_request reset_request;
|
|
||||||
struct uniapi_reset_confirm reset_confirm;
|
|
||||||
struct uniapi_reset_indication reset_indication;
|
|
||||||
struct uniapi_reset_error_indication reset_error_indication;
|
|
||||||
struct uniapi_reset_response reset_response;
|
|
||||||
struct uniapi_reset_error_response reset_error_response;
|
|
||||||
struct uniapi_reset_status_indication reset_status_indication;
|
|
||||||
struct uniapi_setup_request setup_request;
|
|
||||||
struct uniapi_setup_indication setup_indication;
|
|
||||||
struct uniapi_setup_response setup_response;
|
|
||||||
struct uniapi_setup_confirm setup_confirm;
|
|
||||||
struct uniapi_setup_complete_indication setup_complete_indication;
|
|
||||||
struct uniapi_setup_complete_request setup_complete_request;
|
|
||||||
struct uniapi_alerting_request alerting_request;
|
|
||||||
struct uniapi_alerting_indication alerting_indication;
|
|
||||||
struct uniapi_proceeding_request proceeding_request;
|
|
||||||
struct uniapi_proceeding_indication proceeding_indication;
|
|
||||||
struct uniapi_release_request release_request;
|
|
||||||
struct uniapi_release_indication release_indication;
|
|
||||||
struct uniapi_release_response release_response;
|
|
||||||
struct uniapi_release_confirm release_confirm;
|
|
||||||
struct uniapi_notify_request notify_request;
|
|
||||||
struct uniapi_notify_indication notify_indication;
|
|
||||||
struct uniapi_status_indication status_indication;
|
|
||||||
struct uniapi_status_enquiry_request status_enquiry_request;
|
|
||||||
struct uniapi_add_party_request add_party_request;
|
|
||||||
struct uniapi_add_party_indication add_party_indication;
|
|
||||||
struct uniapi_party_alerting_request party_alerting_request;
|
|
||||||
struct uniapi_party_alerting_indication party_alerting_indication;
|
|
||||||
struct uniapi_add_party_ack_request add_party_ack_request;
|
|
||||||
struct uniapi_add_party_ack_indication add_party_ack_indication;
|
|
||||||
struct uniapi_add_party_rej_request add_party_rej_request;
|
|
||||||
struct uniapi_add_party_rej_indication add_party_rej_indication;
|
|
||||||
struct uniapi_drop_party_request drop_party_request;
|
|
||||||
struct uniapi_drop_party_indication drop_party_indication;
|
|
||||||
struct uniapi_drop_party_ack_request drop_party_ack_request;
|
|
||||||
struct uniapi_drop_party_ack_indication drop_party_ack_indication;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,159 +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/sig/unimkmsg.h,v 1.4 2003/09/19 12:03:34 hbb Exp $
|
|
||||||
*
|
|
||||||
* Macros to make messages.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MK_MSG_ORIG(MSG,TYPE,CREF,FLAG) \
|
|
||||||
do { \
|
|
||||||
(MSG)->mtype = (TYPE); \
|
|
||||||
(MSG)->u.hdr.cref.cref = (CREF); \
|
|
||||||
(MSG)->u.hdr.cref.flag = (FLAG); \
|
|
||||||
(MSG)->u.hdr.act = UNI_MSGACT_DEFAULT; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MK_MSG_RESP(MSG,TYPE,CREF) \
|
|
||||||
do { \
|
|
||||||
(MSG)->mtype = (TYPE); \
|
|
||||||
(MSG)->u.hdr.cref.cref = (CREF)->cref; \
|
|
||||||
(MSG)->u.hdr.cref.flag = !(CREF)->flag; \
|
|
||||||
(MSG)->u.hdr.act = UNI_MSGACT_DEFAULT; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MK_IE_CALLSTATE(IE,CS) \
|
|
||||||
do { \
|
|
||||||
(IE).h.present = 0; \
|
|
||||||
IE_SETPRESENT(IE); \
|
|
||||||
(IE).h.coding = UNI_CODING_ITU; \
|
|
||||||
(IE).h.act = UNI_IEACT_DEFAULT; \
|
|
||||||
(IE).state = CS; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MK_IE_EPREF(IE,EPREF,FLAG) \
|
|
||||||
do { \
|
|
||||||
(IE).h.present = 0; \
|
|
||||||
IE_SETPRESENT(IE); \
|
|
||||||
(IE).h.coding = UNI_CODING_ITU; \
|
|
||||||
(IE).h.act = UNI_IEACT_DEFAULT; \
|
|
||||||
(IE).epref = EPREF; \
|
|
||||||
(IE).flag = FLAG; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MK_IE_EPSTATE(IE,STATE) \
|
|
||||||
do { \
|
|
||||||
(IE).h.present = 0; \
|
|
||||||
IE_SETPRESENT(IE); \
|
|
||||||
(IE).h.coding = UNI_CODING_ITU; \
|
|
||||||
(IE).h.act = UNI_IEACT_DEFAULT; \
|
|
||||||
(IE).state = STATE; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MK_IE_CAUSE(IE,LOC,CAUSE) \
|
|
||||||
do { \
|
|
||||||
(IE).h.present = 0; \
|
|
||||||
IE_SETPRESENT(IE); \
|
|
||||||
(IE).h.coding = UNI_CODING_ITU; \
|
|
||||||
(IE).h.act = UNI_IEACT_DEFAULT; \
|
|
||||||
(IE).loc = LOC; \
|
|
||||||
(IE).cause = CAUSE; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define ADD_CAUSE_MTYPE(IE,MTYPE) \
|
|
||||||
do { \
|
|
||||||
(IE).h.present |= UNI_CAUSE_MTYPE_P; \
|
|
||||||
(IE).u.mtype = MTYPE; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define ADD_CAUSE_CHANNID(IE,VPI,VCI) \
|
|
||||||
do { \
|
|
||||||
(IE).h.present |= UNI_CAUSE_VPCI_P; \
|
|
||||||
(IE).u.vpci.vpci = VPI; \
|
|
||||||
(IE).u.vpci.vci = VCI; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define ADD_CAUSE_TIMER(IE,TIMER) \
|
|
||||||
do { \
|
|
||||||
(IE).h.present |= UNI_CAUSE_TIMER_P; \
|
|
||||||
(IE).u.timer[0] = (TIMER)[0]; \
|
|
||||||
(IE).u.timer[1] = (TIMER)[1]; \
|
|
||||||
(IE).u.timer[2] = (TIMER)[2]; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
|
|
||||||
#define COPY_FROM_RELEASE_COMPL(U,DEST) \
|
|
||||||
do { \
|
|
||||||
u_int _i, _j; \
|
|
||||||
\
|
|
||||||
for(_i = _j = 0; _i < 2; _i++) \
|
|
||||||
if(IE_ISGOOD((U)->u.release_compl.cause[_i])) \
|
|
||||||
(DEST)->cause[_j++] = \
|
|
||||||
(U)->u.release_compl.cause[_i]; \
|
|
||||||
for(_i = _j = 0; _i < UNI_NUM_IE_GIT; _i++) \
|
|
||||||
if(IE_ISGOOD((U)->u.release_compl.git[_i])) \
|
|
||||||
(DEST)->git[_j++] = \
|
|
||||||
(U)->u.release_compl.git[_i]; \
|
|
||||||
if(IE_ISGOOD((U)->u.release_compl.uu)) \
|
|
||||||
(DEST)->uu = (U)->u.release_compl.uu; \
|
|
||||||
if(IE_ISGOOD((U)->u.release_compl.crankback)) \
|
|
||||||
(DEST)->crankback = (U)->u.release_compl.crankback; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define COPY_FROM_DROP_ACK(U,DEST) \
|
|
||||||
do { \
|
|
||||||
u_int _i, _j; \
|
|
||||||
\
|
|
||||||
if(IE_ISGOOD((U)->u.drop_party_ack.epref)) \
|
|
||||||
(DEST)->epref = (U)->u.drop_party_ack.epref; \
|
|
||||||
if(IE_ISGOOD((U)->u.drop_party_ack.cause)) \
|
|
||||||
(DEST)->cause = (U)->u.drop_party_ack.cause; \
|
|
||||||
if(IE_ISGOOD((U)->u.drop_party_ack.uu)) \
|
|
||||||
(DEST)->uu = (U)->u.drop_party_ack.uu; \
|
|
||||||
for(_i = _j = 0; _i < UNI_NUM_IE_GIT; _i++) \
|
|
||||||
if(IE_ISGOOD((U)->u.drop_party_ack.git[_i])) \
|
|
||||||
(DEST)->git[_j++] = \
|
|
||||||
(U)->u.drop_party_ack.git[_i]; \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define COPY_FROM_ADD_REJ(U,DEST) \
|
|
||||||
do { \
|
|
||||||
u_int _i, _j; \
|
|
||||||
\
|
|
||||||
if(IE_ISGOOD((U)->u.add_party_rej.epref)) \
|
|
||||||
(DEST)->epref = (U)->u.add_party_rej.epref; \
|
|
||||||
if(IE_ISGOOD((U)->u.add_party_rej.cause)) \
|
|
||||||
(DEST)->cause = (U)->u.add_party_rej.cause; \
|
|
||||||
if(IE_ISGOOD((U)->u.add_party_rej.uu)) \
|
|
||||||
(DEST)->uu = (U)->u.add_party_rej.uu; \
|
|
||||||
for(_i = _j = 0; _i < UNI_NUM_IE_GIT; _i++) \
|
|
||||||
if(IE_ISGOOD((U)->u.add_party_rej.git[_i])) \
|
|
||||||
(DEST)->git[_j++] = \
|
|
||||||
(U)->u.add_party_rej.git[_i]; \
|
|
||||||
} while(0)
|
|
@ -1,113 +0,0 @@
|
|||||||
/* This file was created automatically
|
|
||||||
* Source file: $Begemot: libunimsg/atm/msg/msg.def,v 1.3 2003/09/19 11:58:15 hbb Exp $
|
|
||||||
* $FreeBSD$
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_alerting(struct uni_alerting *src, struct uni_alerting *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_call_proc(struct uni_call_proc *src, struct uni_call_proc *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_connect(struct uni_connect *src, struct uni_connect *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_connect_ack(struct uni_connect_ack *src, struct uni_connect_ack *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_release(struct uni_release *src, struct uni_release *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_release_compl(struct uni_release_compl *src, struct uni_release_compl *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_setup(struct uni_setup *src, struct uni_setup *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_status(struct uni_status *src, struct uni_status *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_status_enq(struct uni_status_enq *src, struct uni_status_enq *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_notify(struct uni_notify *src, struct uni_notify *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_restart(struct uni_restart *src, struct uni_restart *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_restart_ack(struct uni_restart_ack *src, struct uni_restart_ack *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_add_party(struct uni_add_party *src, struct uni_add_party *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_add_party_ack(struct uni_add_party_ack *src, struct uni_add_party_ack *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_party_alerting(struct uni_party_alerting *src, struct uni_party_alerting *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_add_party_rej(struct uni_add_party_rej *src, struct uni_add_party_rej *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_drop_party(struct uni_drop_party *src, struct uni_drop_party *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_drop_party_ack(struct uni_drop_party_ack *src, struct uni_drop_party_ack *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_leaf_setup_req(struct uni_leaf_setup_req *src, struct uni_leaf_setup_req *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_leaf_setup_fail(struct uni_leaf_setup_fail *src, struct uni_leaf_setup_fail *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_cobisetup(struct uni_cobisetup *src, struct uni_cobisetup *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_facility(struct uni_facility *src, struct uni_facility *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_modify_req(struct uni_modify_req *src, struct uni_modify_req *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_modify_ack(struct uni_modify_ack *src, struct uni_modify_ack *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_modify_rej(struct uni_modify_rej *src, struct uni_modify_rej *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_conn_avail(struct uni_conn_avail *src, struct uni_conn_avail *dst);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
copy_msg_unknown(struct uni_unknown *src, struct uni_unknown *dst);
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user