2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
6 * Author: Hartmut Brandt <harti@freebsd.org>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * $Begemot: libunimsg/netnatm/api/unisap.h,v 1.6 2005/05/23 11:49:17 brandt_h Exp $
31 #ifndef _NETNATM_API_UNISAP_H_
32 #define _NETNATM_API_UNISAP_H_
34 #include <netnatm/msg/uni_config.h>
37 UNISVE_ABSENT, /* Element is absent */
38 UNISVE_PRESENT, /* Element is present with specific value */
39 UNISVE_ANY /* Any values is acceptable */
44 enum uni_addr_type type; /* type of address */
45 enum uni_addr_plan plan; /* addressing plan */
46 uint32_t len; /* length of address */
47 u_char addr[UNI_ADDR_MAXLEN];
50 struct unisve_selector {
55 struct unisve_blli_id2 {
57 u_int proto:5; /* the protocol */
58 u_int user:7; /* user specific protocol */
61 struct unisve_blli_id3 {
63 u_int proto:5; /* L3 protocol */
64 u_int user:7; /* user specific protocol */
65 u_int ipi:8; /* ISO/IEC TR 9557 IPI */
66 u_int oui:24; /* IEEE 802.1 OUI */
67 u_int pid:16; /* IEEE 802.1 PID */
68 uint32_t noipi; /* ISO/IEC TR 9557 per frame */
73 enum uni_bhli type; /* type of info */
74 uint32_t len; /* length of info */
75 uint8_t info[8]; /* info itself */
79 struct unisve_addr addr;
80 struct unisve_selector selector;
81 struct unisve_blli_id2 blli_id2;
82 struct unisve_blli_id3 blli_id3;
83 struct unisve_bhli bhli;
86 int unisve_check_addr(const struct unisve_addr *);
87 int unisve_check_selector(const struct unisve_selector *);
88 int unisve_check_blli_id2(const struct unisve_blli_id2 *);
89 int unisve_check_blli_id3(const struct unisve_blli_id3 *);
90 int unisve_check_bhli(const struct unisve_bhli *);
92 int unisve_check_sap(const struct uni_sap *);
94 int unisve_overlap_addr(const struct unisve_addr *, const struct unisve_addr *);
95 int unisve_overlap_selector(const struct unisve_selector *,
96 const struct unisve_selector *);
97 int unisve_overlap_blli_id2(const struct unisve_blli_id2 *,
98 const struct unisve_blli_id2 *);
99 int unisve_overlap_blli_id3(const struct unisve_blli_id3 *,
100 const struct unisve_blli_id3 *);
101 int unisve_overlap_bhli(const struct unisve_bhli *,
102 const struct unisve_bhli *);
103 int unisve_overlap_sap(const struct uni_sap *, const struct uni_sap *);
105 int unisve_is_catchall(const struct uni_sap *);
106 int unisve_match(const struct uni_sap *, const struct uni_ie_called *,
107 const struct uni_ie_blli *, const struct uni_ie_bhli *);
111 UNISVE_ERROR_BAD_TAG,
112 UNISVE_ERROR_TYPE_PLAN_CONFLICT,
113 UNISVE_ERROR_ADDR_SEL_CONFLICT,
114 UNISVE_ERROR_ADDR_LEN,
115 UNISVE_ERROR_BAD_ADDR_TYPE,
116 UNISVE_ERROR_BAD_BHLI_TYPE,
117 UNISVE_ERROR_BAD_BHLI_LEN,
120 #define UNISVE_ERRSTR \
123 "bad address type/plan combination", \
124 "bad address plan/selector tag combination", \
125 "bad address length in SVE", \
126 "unknown address type in SVE", \
127 "bad BHLI type in SVE", \
128 "BHLI info too long in SVE",