unipriv.h (122205) | unipriv.h (131826) |
---|---|
1/* 2 * Copyright (c) 1996-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * Author: Hartmut Brandt <harti@freebsd.org> 28 * | 1/* 2 * Copyright (c) 1996-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * Author: Hartmut Brandt <harti@freebsd.org> 28 * |
29 * $Begemot: libunimsg/atm/sig/unipriv.h,v 1.5 2003/09/24 10:27:50 hbb Exp $ | 29 * $Begemot: libunimsg/netnatm/sig/unipriv.h,v 1.17 2004/07/08 08:22:25 brandt Exp $ |
30 * 31 * Private UNI stuff. 32 */ 33#ifndef unipriv_h 34#define unipriv_h 35 36#ifdef _KERNEL 37#ifdef __FreeBSD__ --- 186 unchanged lines hidden (view full) --- 224 SIG_PARTY, 225}; 226 227struct sig { 228 TAILQ_ENTRY(sig) link; 229 u_int type; /* one of the above */ 230 struct call *call; /* call to send to */ 231 struct party *party; /* party to send to */ | 30 * 31 * Private UNI stuff. 32 */ 33#ifndef unipriv_h 34#define unipriv_h 35 36#ifdef _KERNEL 37#ifdef __FreeBSD__ --- 186 unchanged lines hidden (view full) --- 224 SIG_PARTY, 225}; 226 227struct sig { 228 TAILQ_ENTRY(sig) link; 229 u_int type; /* one of the above */ 230 struct call *call; /* call to send to */ 231 struct party *party; /* party to send to */ |
232 u_int32_t sig; /* the signal */ 233 u_int32_t cookie; /* user cookie */ | 232 uint32_t sig; /* the signal */ 233 uint32_t cookie; /* user cookie */ |
234 struct uni_msg *msg; /* attached message */ 235 struct uni_all *u; /* dito */ 236}; 237TAILQ_HEAD(sigqueue, sig); 238 239#define SIGQ_CLEAR(Q) \ 240 do { \ 241 struct sig *s; \ 242 while(!TAILQ_EMPTY(Q)) { \ 243 s = TAILQ_FIRST(Q); \ 244 TAILQ_REMOVE(Q, s, link); \ 245 if(s->msg) uni_msg_destroy(s->msg); \ 246 if(s->u) UNI_FREE(s->u); \ 247 SIG_FREE(s); \ 248 } \ 249 } while(0) 250 | 234 struct uni_msg *msg; /* attached message */ 235 struct uni_all *u; /* dito */ 236}; 237TAILQ_HEAD(sigqueue, sig); 238 239#define SIGQ_CLEAR(Q) \ 240 do { \ 241 struct sig *s; \ 242 while(!TAILQ_EMPTY(Q)) { \ 243 s = TAILQ_FIRST(Q); \ 244 TAILQ_REMOVE(Q, s, link); \ 245 if(s->msg) uni_msg_destroy(s->msg); \ 246 if(s->u) UNI_FREE(s->u); \ 247 SIG_FREE(s); \ 248 } \ 249 } while(0) 250 |
251void uni_sig_party(struct party *, enum party_sig, u_int32_t cookie, | 251void uni_sig_party(struct party *, enum party_sig, uint32_t cookie, |
252 struct uni_msg *, struct uni_all *); | 252 struct uni_msg *, struct uni_all *); |
253void uni_sig_call(struct call *, enum call_sig, u_int32_t cookie, | 253void uni_sig_call(struct call *, enum call_sig, uint32_t cookie, |
254 struct uni_msg *, struct uni_all *); | 254 struct uni_msg *, struct uni_all *); |
255void uni_sig_coord(struct uni *, enum coord_sig, u_int32_t cookie, | 255void uni_sig_coord(struct uni *, enum coord_sig, uint32_t cookie, |
256 struct uni_msg *); | 256 struct uni_msg *); |
257void uni_sig_start(struct uni *, enum start_sig, u_int32_t cookie, | 257void uni_sig_start(struct uni *, enum start_sig, uint32_t cookie, |
258 struct uni_msg *, struct uni_all *); | 258 struct uni_msg *, struct uni_all *); |
259void uni_sig_respond(struct uni *, enum respond_sig, u_int32_t cookie, | 259void uni_sig_respond(struct uni *, enum respond_sig, uint32_t cookie, |
260 struct uni_msg *, struct uni_all *); 261 262/************************************************************* 263 * 264 * CALL INSTANCES 265 */ 266struct party { 267 struct call *call; --- 10 unchanged lines hidden (view full) --- 278#define PARTY_CONNECT 0x0002 /* connect request from this party */ 279 280TAILQ_HEAD(partyqueue, party); 281 282void uni_destroy_party(struct party *, int); 283struct party *uni_find_party(struct call *, struct uni_ie_epref *); 284struct party *uni_find_partyx(struct call *, u_int epref, u_int mine); 285struct party *uni_create_party(struct call *, struct uni_ie_epref *); | 260 struct uni_msg *, struct uni_all *); 261 262/************************************************************* 263 * 264 * CALL INSTANCES 265 */ 266struct party { 267 struct call *call; --- 10 unchanged lines hidden (view full) --- 278#define PARTY_CONNECT 0x0002 /* connect request from this party */ 279 280TAILQ_HEAD(partyqueue, party); 281 282void uni_destroy_party(struct party *, int); 283struct party *uni_find_party(struct call *, struct uni_ie_epref *); 284struct party *uni_find_partyx(struct call *, u_int epref, u_int mine); 285struct party *uni_create_party(struct call *, struct uni_ie_epref *); |
286struct party *uni_create_partyx(struct call *, u_int epref, u_int mine, u_int32_t cookie); | 286struct party *uni_create_partyx(struct call *, u_int epref, u_int mine, 287 uint32_t cookie); |
287u_int uni_party_act_count(struct call *, int); 288 289enum call_type { 290 CALL_NULL, /* not known yet */ 291 CALL_P2P, /* normal point-to-point call */ 292 CALL_COBI, /* Q.2932.1 COBI call */ 293 CALL_ROOT, /* point-to-multipoint root */ 294 CALL_LEAF, /* point-to-multipoint leaf */ --- 36 unchanged lines hidden (view full) --- 331 u_int cnt322; 332}; 333 334TAILQ_HEAD(callqueue, call); 335 336struct call *uni_find_call(struct uni *, struct uni_cref *); 337struct call *uni_find_callx(struct uni *, u_int cref, u_int mine); 338struct call *uni_create_call(struct uni *, u_int cref, u_int mine, | 288u_int uni_party_act_count(struct call *, int); 289 290enum call_type { 291 CALL_NULL, /* not known yet */ 292 CALL_P2P, /* normal point-to-point call */ 293 CALL_COBI, /* Q.2932.1 COBI call */ 294 CALL_ROOT, /* point-to-multipoint root */ 295 CALL_LEAF, /* point-to-multipoint leaf */ --- 36 unchanged lines hidden (view full) --- 332 u_int cnt322; 333}; 334 335TAILQ_HEAD(callqueue, call); 336 337struct call *uni_find_call(struct uni *, struct uni_cref *); 338struct call *uni_find_callx(struct uni *, u_int cref, u_int mine); 339struct call *uni_create_call(struct uni *, u_int cref, u_int mine, |
339 u_int32_t cookie); 340struct call *uni_create_new_call(struct uni *, u_int32_t cookie); | 340 uint32_t cookie); 341struct call *uni_create_new_call(struct uni *, uint32_t cookie); |
341void uni_destroy_call(struct call *, int); 342 343void uni_bad_message(struct call *, struct uni_all *, u_int, 344 struct uni_ie_epref *, int); 345 346extern const struct callstates { 347 const char *name; 348 enum uni_callstate ext; --- 10 unchanged lines hidden (view full) --- 359 enum uni_proto proto; /* protocol */ 360 struct unicx cx; /* decoding/coding context */ 361 int sb_tb : 1; /* Sb-Tb/Tb point */ 362 363 struct sigqueue workq; /* work queue */ 364 struct sigqueue delq; /* delayed signal queue */ 365 int working; 366 | 342void uni_destroy_call(struct call *, int); 343 344void uni_bad_message(struct call *, struct uni_all *, u_int, 345 struct uni_ie_epref *, int); 346 347extern const struct callstates { 348 const char *name; 349 enum uni_callstate ext; --- 10 unchanged lines hidden (view full) --- 360 enum uni_proto proto; /* protocol */ 361 struct unicx cx; /* decoding/coding context */ 362 int sb_tb : 1; /* Sb-Tb/Tb point */ 363 364 struct sigqueue workq; /* work queue */ 365 struct sigqueue delq; /* delayed signal queue */ 366 int working; 367 |
367 u_int32_t cref_alloc; | 368 uint32_t cref_alloc; |
368 369 enum cu_stat custat; /* coordinator state */ 370 struct uni_timer t309; 371 u_int timer309; 372 373 enum uni_callstate glob_start; 374 enum uni_callstate glob_respond; 375 struct uni_timer t316; --- 22 unchanged lines hidden (view full) --- 398 u_int init322; 399 u_int timer397; 400 u_int timer398; 401 u_int timer399; 402 403 u_int debug[UNI_MAXFACILITY]; 404}; 405 | 369 370 enum cu_stat custat; /* coordinator state */ 371 struct uni_timer t309; 372 u_int timer309; 373 374 enum uni_callstate glob_start; 375 enum uni_callstate glob_respond; 376 struct uni_timer t316; --- 22 unchanged lines hidden (view full) --- 399 u_int init322; 400 u_int timer397; 401 u_int timer398; 402 u_int timer399; 403 404 u_int debug[UNI_MAXFACILITY]; 405}; 406 |
406void uniapi_uni_error(struct uni *uni, u_int32_t reason, u_int32_t cookie, 407 u_int32_t state); 408void uniapi_call_error(struct call *c, u_int32_t reason, u_int32_t cookie); 409void uniapi_party_error(struct party *p, u_int32_t reason, u_int32_t cookie); | 407void uniapi_uni_error(struct uni *uni, uint32_t reason, uint32_t cookie, 408 uint32_t state); 409void uniapi_call_error(struct call *c, uint32_t reason, uint32_t cookie); 410void uniapi_party_error(struct party *p, uint32_t reason, uint32_t cookie); |
410 411/************************************************************* 412 * 413 * INLINE FUNCTIONS 414 */ 415 416/* Enqueue a signal in the working queue */ 417void uni_enq_sig(struct uni *, u_int, struct call *, struct party *, --- 90 unchanged lines hidden (view full) --- 508 if(((API) = uni_msg_alloc(sizeof(TYPE))) != NULL) { \ 509 _tmp = uni_msg_wptr((API), TYPE *); \ 510 (API)->b_wptr += sizeof(TYPE); \ 511 memset(_tmp, 0, sizeof(TYPE)); \ 512 } \ 513 _tmp; \ 514 }) 515 | 411 412/************************************************************* 413 * 414 * INLINE FUNCTIONS 415 */ 416 417/* Enqueue a signal in the working queue */ 418void uni_enq_sig(struct uni *, u_int, struct call *, struct party *, --- 90 unchanged lines hidden (view full) --- 509 if(((API) = uni_msg_alloc(sizeof(TYPE))) != NULL) { \ 510 _tmp = uni_msg_wptr((API), TYPE *); \ 511 (API)->b_wptr += sizeof(TYPE); \ 512 memset(_tmp, 0, sizeof(TYPE)); \ 513 } \ 514 _tmp; \ 515 }) 516 |
516#define VERBOSE(UNI, FAC, LEVEL, FMT, ARGS...) do { \ | 517#if defined(__GNUC__) && __GNUC__ < 3 518 519#define VERBOSE(UNI, FAC, LEVEL, ARGS...) do { \ |
517 if ((UNI)->debug[(FAC)] >= (LEVEL)) { \ | 520 if ((UNI)->debug[(FAC)] >= (LEVEL)) { \ |
518 (UNI)->funcs->verbose((UNI), (UNI)->arg, (FAC), \ 519 FMT , ## ARGS); \ | 521 (UNI)->funcs->verbose((UNI), (UNI)->arg, (FAC) ,\ 522 ## ARGS); \ |
520 } \ 521 } while(0) 522 | 523 } \ 524 } while(0) 525 |
523#define VERBOSE0(UNI, FAC, FMT, ARGS...) do { \ 524 (UNI)->funcs->verbose((UNI), (UNI)->arg, (FAC), FMT , \ | 526#define VERBOSE0(UNI, FAC, ARGS...) do { \ 527 (UNI)->funcs->verbose((UNI), (UNI)->arg, (FAC) , \ |
525 ## ARGS); \ 526 } while(0) 527 | 528 ## ARGS); \ 529 } while(0) 530 |
531#else 532 533#define VERBOSE(UNI, FAC, LEVEL, ...) do { \ 534 if ((UNI)->debug[(FAC)] >= (LEVEL)) { \ 535 (UNI)->funcs->verbose((UNI), (UNI)->arg, (FAC), \ 536 __VA_ARGS__); \ 537 } \ 538 } while(0) 539 540#define VERBOSE0(UNI, FAC, ...) do { \ 541 (UNI)->funcs->verbose((UNI), (UNI)->arg, (FAC), \ 542 __VA_ARGS__); \ 543 } while(0) 544 545#endif 546 |
|
528#define TIMER_INIT_UNI(U,T) _TIMER_INIT(U,T) 529#define TIMER_INIT_CALL(C,T) _TIMER_INIT(C,T) 530#define TIMER_INIT_PARTY(P,T) _TIMER_INIT(P,T) 531 532#define TIMER_DESTROY_UNI(U,T) _TIMER_DESTROY(U, (U)->T) 533#define TIMER_DESTROY_CALL(C,T) _TIMER_DESTROY((C)->uni, (C)->T) 534#define TIMER_DESTROY_PARTY(P,T) _TIMER_DESTROY((P)->call->uni, (P)->T) 535 536#define TIMER_STOP_UNI(U,T) _TIMER_STOP(U, (U)->T) 537#define TIMER_STOP_CALL(C,T) _TIMER_STOP((C)->uni, (C)->T) 538#define TIMER_STOP_PARTY(P,T) _TIMER_STOP((P)->call->uni, (P)->T) 539 540#define TIMER_START_UNI(U,T,N) _TIMER_START(U, U, (U)->T, N, _##T##_func) 541#define TIMER_START_CALL(C,T,N) _TIMER_START(C->uni, C, (C)->T, N, _##T##_func) 542#define TIMER_START_PARTY(P,T,N) _TIMER_START(P->call->uni, P, (P)->T, N, _##T##_func) 543 544#endif | 547#define TIMER_INIT_UNI(U,T) _TIMER_INIT(U,T) 548#define TIMER_INIT_CALL(C,T) _TIMER_INIT(C,T) 549#define TIMER_INIT_PARTY(P,T) _TIMER_INIT(P,T) 550 551#define TIMER_DESTROY_UNI(U,T) _TIMER_DESTROY(U, (U)->T) 552#define TIMER_DESTROY_CALL(C,T) _TIMER_DESTROY((C)->uni, (C)->T) 553#define TIMER_DESTROY_PARTY(P,T) _TIMER_DESTROY((P)->call->uni, (P)->T) 554 555#define TIMER_STOP_UNI(U,T) _TIMER_STOP(U, (U)->T) 556#define TIMER_STOP_CALL(C,T) _TIMER_STOP((C)->uni, (C)->T) 557#define TIMER_STOP_PARTY(P,T) _TIMER_STOP((P)->call->uni, (P)->T) 558 559#define TIMER_START_UNI(U,T,N) _TIMER_START(U, U, (U)->T, N, _##T##_func) 560#define TIMER_START_CALL(C,T,N) _TIMER_START(C->uni, C, (C)->T, N, _##T##_func) 561#define TIMER_START_PARTY(P,T,N) _TIMER_START(P->call->uni, P, (P)->T, N, _##T##_func) 562 563#endif |