1/* 2 * Copyright (c) 2003-2004 3 * Hartmut Brandt 4 * All rights reserved. 5 * 6 * Author: Harti Brandt <harti@freebsd.org> 7 * 8 * Redistribution of this software and documentation and use in source and 9 * binary forms, with or without modification, are permitted provided that 10 * the following conditions are met: 11 * 12 * 1. Redistributions of source code or documentation must retain the above 13 * copyright notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR 19 * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 21 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 22 * THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 25 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 28 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * 30 * $Begemot: libunimsg/netnatm/api/ccatm.h,v 1.1 2004/07/08 08:21:58 brandt Exp $ 31 * 32 * ATM API as defined per af-saa-0108 33 * 34 * Interface to the supporting code. 35 */ 36 37#ifndef _API_CCATM_H_ 38#define _API_CCATM_H_ 39 40struct ccuser; 41struct ccconn; 42struct ccport; 43struct ccdata; 44 45struct cc_funcs { 46 /* send signal to API user */ 47 void (*send_user)(struct ccuser *, void *, u_int, void *, size_t); 48 49 /* respond API user */ 50 void (*respond_user)(struct ccuser *, void *, int, u_int, 51 void *, size_t); 52 53 /* send signal to uni for connection */ 54 void (*send_uni)(struct ccconn *, void *, u_int, u_int, 55 struct uni_msg *); 56 57 /* send global signal to uni */ 58 void (*send_uni_glob)(struct ccport *, void *, u_int, u_int, 59 struct uni_msg *); 60 61 /* log a message */ 62 void (*log)(const char *, ...); 63}; 64 65enum { 66 CCLOG_USER_STATE = 0x00000001, 67 CCLOG_USER_INST = 0x00000002, 68 CCLOG_USER_SIG = 0x00000004, 69 CCLOG_CONN_STATE = 0x00000010, 70 CCLOG_CONN_INST = 0x00000020, 71 CCLOG_CONN_SIG = 0x00000040, 72 CCLOG_PARTY_STATE = 0x00000100, 73 CCLOG_PARTY_INST = 0x00000200, 74 CCLOG_PARTY_SIG = 0x00000400, 75 CCLOG_SIGS = 0x00001000, 76}; 77 78/* instance handling */ 79struct ccdata *cc_create(const struct cc_funcs *); 80void cc_destroy(struct ccdata *); 81void cc_reset(struct ccdata *); 82 83/* input a response from the UNI layer to CC */ 84int cc_uni_response(struct ccport *, u_int cookie, u_int reason, u_int state); 85 86/* Signal from UNI on this port */ 87int cc_uni_signal(struct ccport *, u_int cookie, u_int sig, struct uni_msg *); 88 89/* retrieve addresses */ 90int cc_get_addrs(struct ccdata *, u_int, struct uni_addr **, u_int **, u_int *); 91 92/* dump state */ 93typedef int (*cc_dump_f)(struct ccdata *, void *, const char *); 94int cc_dump(struct ccdata *, size_t, cc_dump_f, void *); 95 96/* start/stop port */ 97int cc_port_stop(struct ccdata *, u_int); 98int cc_port_start(struct ccdata *, u_int); 99 100/* is port running? */ 101int cc_port_isrunning(struct ccdata *, u_int, int *); 102 103/* return port number */ 104u_int cc_port_no(struct ccport *); 105 106/* Clear address and prefix information from the named port. */ 107int cc_port_clear(struct ccdata *, u_int); 108 109/* Address registered. */ 110int cc_addr_register(struct ccdata *, u_int, const struct uni_addr *); 111 112/* Address unregistered. */ 113int cc_addr_unregister(struct ccdata *, u_int, const struct uni_addr *); 114 115/* get port info */ 116int cc_port_get_param(struct ccdata *, u_int, struct atm_port_info *); 117 118/* set port info */ 119int cc_port_set_param(struct ccdata *, const struct atm_port_info *); 120 121/* get port list */ 122int cc_port_getlist(struct ccdata *, u_int *, u_int **); 123 124/* create a port */ 125struct ccport *cc_port_create(struct ccdata *, void *, u_int); 126 127/* destroy a port */ 128void cc_port_destroy(struct ccport *, int); 129 130/* New endpoint created */ 131struct ccuser *cc_user_create(struct ccdata *, void *, const char *); 132 133/* destroy user endpoint */ 134void cc_user_destroy(struct ccuser *); 135 136/* signal from user */ 137int cc_user_signal(struct ccuser *, u_int, struct uni_msg *); 138 139/* Management is given up on this node. */ 140void cc_unmanage(struct ccdata *); 141 142/* handle all queued signals */ 143void cc_work(struct ccdata *); 144 145/* set/get logging flags */ 146void cc_set_log(struct ccdata *, u_int); 147u_int cc_get_log(const struct ccdata *); 148 149/* get extended status */ 150int cc_get_extended_status(const struct ccdata *, struct atm_exstatus *, 151 struct atm_exstatus_ep **, struct atm_exstatus_port **, 152 struct atm_exstatus_conn **, struct atm_exstatus_party **); 153 154#endif 155