uni.h revision 225736
1316722Sdelphij/* 2316722Sdelphij * Copyright (c) 2001-2003 3316722Sdelphij * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4316722Sdelphij * All rights reserved. 5316722Sdelphij * 6316722Sdelphij * Redistribution and use in source and binary forms, with or without 7316722Sdelphij * modification, are permitted provided that the following conditions 8316722Sdelphij * are met: 9316722Sdelphij * 1. Redistributions of source code must retain the above copyright 10316722Sdelphij * notice, this list of conditions and the following disclaimer. 11316722Sdelphij * 2. Redistributions in binary form must reproduce the above copyright 12316722Sdelphij * notice, this list of conditions and the following disclaimer in the 13316722Sdelphij * documentation and/or other materials provided with the distribution. 14316722Sdelphij * 15316722Sdelphij * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16316722Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17316722Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18316722Sdelphij * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19316722Sdelphij * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20316722Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21316722Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22316722Sdelphij * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23316722Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24316722Sdelphij * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25316722Sdelphij * SUCH DAMAGE. 26316722Sdelphij * 27316722Sdelphij * Author: Hartmut Brandt <harti@freebsd.org> 28316722Sdelphij * 29316722Sdelphij * $Begemot: libunimsg/netnatm/sig/uni.h,v 1.5 2004/07/08 08:22:24 brandt Exp $ 30316722Sdelphij * 31316722Sdelphij * Public UNI interface 32316722Sdelphij */ 33316722Sdelphij#ifndef _NETNATM_SIG_UNI_H_ 34316722Sdelphij#define _NETNATM_SIG_UNI_H_ 35316722Sdelphij 36316722Sdelphij#include <netnatm/sig/unidef.h> 37316722Sdelphij 38316722Sdelphijstruct uni; 39316722Sdelphij 40316722Sdelphij/* functions to be supplied by the user */ 41316722Sdelphijstruct uni_funcs { 42316722Sdelphij /* output to the upper layer */ 43316722Sdelphij void (*uni_output)(struct uni *, void *, enum uni_sig, 44316722Sdelphij uint32_t, struct uni_msg *); 45316722Sdelphij 46316722Sdelphij /* output to the SAAL */ 47316722Sdelphij void (*saal_output)(struct uni *, void *, enum saal_sig, 48316722Sdelphij struct uni_msg *); 49316722Sdelphij 50316722Sdelphij /* verbosity */ 51316722Sdelphij void (*verbose)(struct uni *, void *, enum uni_verb, 52316722Sdelphij const char *, ...) __printflike(4, 5); 53316722Sdelphij 54316722Sdelphij /* function to 'print' status */ 55316722Sdelphij void (*status)(struct uni *, void *, void *, 56316722Sdelphij const char *, ...) __printflike(4, 5); 57316722Sdelphij 58316722Sdelphij#ifndef _KERNEL 59316722Sdelphij /* start a timer */ 60316722Sdelphij void *(*start_timer)(struct uni *, void *, u_int, 61316722Sdelphij void (*)(void *), void *); 62316722Sdelphij 63316722Sdelphij /* stop a timer */ 64316722Sdelphij void (*stop_timer)(struct uni *, void *, void *); 65316722Sdelphij#endif 66316722Sdelphij}; 67316722Sdelphij 68316722Sdelphij/* create a UNI instance */ 69316722Sdelphijstruct uni *uni_create(void *, const struct uni_funcs *); 70316722Sdelphij 71316722Sdelphij/* destroy a UNI instance, free all resources */ 72316722Sdelphijvoid uni_destroy(struct uni *); 73316722Sdelphij 74316722Sdelphij/* generate a status report */ 75316722Sdelphijvoid uni_status(struct uni *, void *); 76316722Sdelphij 77316722Sdelphij/* get current instance configuration */ 78316722Sdelphijvoid uni_get_config(const struct uni *, struct uni_config *); 79316722Sdelphij 80316722Sdelphij/* set new instance configuration */ 81316722Sdelphijvoid uni_set_config(struct uni *, const struct uni_config *, 82316722Sdelphij uint32_t *, uint32_t *, uint32_t *); 83316722Sdelphij 84316722Sdelphij/* input from the SAAL to the instance */ 85316722Sdelphijvoid uni_saal_input(struct uni *, enum saal_sig, struct uni_msg *); 86316722Sdelphij 87316722Sdelphij/* input from the upper layer to the instance */ 88316722Sdelphijvoid uni_uni_input(struct uni *, enum uni_sig, uint32_t, struct uni_msg *); 89316722Sdelphij 90316722Sdelphij/* do work on pending signals */ 91316722Sdelphijvoid uni_work(struct uni *); 92316722Sdelphij 93316722Sdelphij/* set debuging level */ 94316722Sdelphijvoid uni_set_debug(struct uni *, enum uni_verb, u_int level); 95316722Sdelphiju_int uni_get_debug(const struct uni *, enum uni_verb); 96316722Sdelphij 97316722Sdelphij/* reset a UNI instance */ 98316722Sdelphijvoid uni_reset(struct uni *); 99316722Sdelphij 100316722Sdelphij/* states */ 101316722Sdelphiju_int uni_getcustate(const struct uni *); 102316722Sdelphij 103316722Sdelphij/* return a reference to the coding/decoding context */ 104316722Sdelphijstruct unicx *uni_context(struct uni *); 105316722Sdelphij 106316722Sdelphij#endif 107316722Sdelphij