unisap.h revision 146539
11832Swollman/* 21832Swollman * Copyright (c) 2001-2003 31832Swollman * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 41832Swollman * All rights reserved. 51832Swollman * 61832Swollman * Author: Hartmut Brandt <harti@freebsd.org> 71832Swollman * 81832Swollman * Redistribution and use in source and binary forms, with or without 91832Swollman * modification, are permitted provided that the following conditions 101832Swollman * are met: 111832Swollman * 1. Redistributions of source code must retain the above copyright 121832Swollman * notice, this list of conditions and the following disclaimer. 131832Swollman * 2. Redistributions in binary form must reproduce the above copyright 141832Swollman * notice, this list of conditions and the following disclaimer in the 151832Swollman * documentation and/or other materials provided with the distribution. 161832Swollman * 171832Swollman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 181832Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 191832Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 201832Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 211832Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 221832Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 231832Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 241832Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 251832Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 261832Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 271832Swollman * SUCH DAMAGE. 281832Swollman * 291832Swollman * $Begemot: libunimsg/netnatm/api/unisap.h,v 1.6 2005/05/23 11:49:17 brandt_h Exp $ 301832Swollman */ 311832Swollman#ifndef _NETNATM_API_UNISAP_H_ 321832Swollman#define _NETNATM_API_UNISAP_H_ 331832Swollman 341832Swollman#include <netnatm/msg/uni_config.h> 351832Swollman 361832Swollmanenum unisve_tag { 371832Swollman UNISVE_ABSENT, /* Element is absent */ 381832Swollman UNISVE_PRESENT, /* Element is present with specific value */ 391832Swollman UNISVE_ANY /* Any values is acceptable */ 401832Swollman}; 411832Swollman 421832Swollmanstruct unisve_addr { 431832Swollman enum unisve_tag tag; 441832Swollman enum uni_addr_type type; /* type of address */ 451832Swollman enum uni_addr_plan plan; /* addressing plan */ 461832Swollman uint32_t len; /* length of address */ 471832Swollman u_char addr[UNI_ADDR_MAXLEN]; 481832Swollman}; 491832Swollman 501832Swollmanstruct unisve_selector { 511832Swollman enum unisve_tag tag; 521832Swollman uint8_t selector; 531832Swollman}; 541832Swollman 551832Swollmanstruct unisve_blli_id2 { 561832Swollman enum unisve_tag tag; 571832Swollman u_int proto:5; /* the protocol */ 581832Swollman u_int user:7; /* user specific protocol */ 591832Swollman}; 601832Swollman 611832Swollmanstruct unisve_blli_id3 { 621832Swollman enum unisve_tag tag; 631832Swollman u_int proto:5; /* L3 protocol */ 641832Swollman u_int user:7; /* user specific protocol */ 651832Swollman u_int ipi:8; /* ISO/IEC TR 9557 IPI */ 661832Swollman u_int oui:24; /* IEEE 802.1 OUI */ 671832Swollman u_int pid:16; /* IEEE 802.1 PID */ 681832Swollman uint32_t noipi; /* ISO/IEC TR 9557 per frame */ 691832Swollman}; 701832Swollman 711832Swollmanstruct unisve_bhli { 721832Swollman enum unisve_tag tag; 731832Swollman enum uni_bhli type; /* type of info */ 741832Swollman uint32_t len; /* length of info */ 751832Swollman uint8_t info[8]; /* info itself */ 761832Swollman}; 771832Swollman 781832Swollmanstruct uni_sap { 791832Swollman struct unisve_addr addr; 801832Swollman struct unisve_selector selector; 811832Swollman struct unisve_blli_id2 blli_id2; 821832Swollman struct unisve_blli_id3 blli_id3; 831832Swollman struct unisve_bhli bhli; 841832Swollman}; 851832Swollman 861832Swollmanint unisve_check_addr(const struct unisve_addr *); 871832Swollmanint unisve_check_selector(const struct unisve_selector *); 881832Swollmanint unisve_check_blli_id2(const struct unisve_blli_id2 *); 891832Swollmanint unisve_check_blli_id3(const struct unisve_blli_id3 *); 901832Swollmanint unisve_check_bhli(const struct unisve_bhli *); 911832Swollman 921832Swollmanint unisve_check_sap(const struct uni_sap *); 931832Swollman 941832Swollmanint unisve_overlap_addr(const struct unisve_addr *, const struct unisve_addr *); 951832Swollmanint unisve_overlap_selector(const struct unisve_selector *, 961832Swollman const struct unisve_selector *); 971832Swollmanint unisve_overlap_blli_id2(const struct unisve_blli_id2 *, 981832Swollman const struct unisve_blli_id2 *); 991832Swollmanint unisve_overlap_blli_id3(const struct unisve_blli_id3 *, 1001832Swollman const struct unisve_blli_id3 *); 101int unisve_overlap_bhli(const struct unisve_bhli *, 102 const struct unisve_bhli *); 103int unisve_overlap_sap(const struct uni_sap *, const struct uni_sap *); 104 105int unisve_is_catchall(const struct uni_sap *); 106int unisve_match(const struct uni_sap *, const struct uni_ie_called *, 107 const struct uni_ie_blli *, const struct uni_ie_bhli *); 108 109enum { 110 UNISVE_OK = 0, 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, 118}; 119 120#define UNISVE_ERRSTR \ 121 "no error", \ 122 "bad SVE tag", \ 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", 129 130#endif 131