2 * Copyright (c) 2001-2003
3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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
27 * Author: Hartmut Brandt <harti@freebsd.org>
29 * $Begemot: libunimsg/libngatm/unicust.h,v 1.4 2003/09/19 13:10:35 hbb Exp $
31 * Customisation of signalling source to user space.
33 #include <sys/types.h>
34 #include <sys/queue.h>
40 #define ASSERT(E, M) assert(E)
42 static __inline__ void *
45 void *ptr = malloc(s);
52 #define INS_ALLOC() mzalloc(sizeof(struct uni))
53 #define INS_FREE(P) free(P)
55 #define UNI_ALLOC() mzalloc(sizeof(struct uni_all))
56 #define UNI_FREE(P) free(P)
58 #define SIG_ALLOC() mzalloc(sizeof(struct sig))
59 #define SIG_FREE(P) free(P)
61 #define CALL_ALLOC() mzalloc(sizeof(struct call))
62 #define CALL_FREE(P) free(P)
64 #define PARTY_ALLOC() mzalloc(sizeof(struct party))
65 #define PARTY_FREE(P) free(P)
74 #define _TIMER_INIT(X,T) (X)->T.c = NULL
75 #define _TIMER_DESTROY(U,F) _TIMER_STOP(U,F)
76 #define _TIMER_STOP(U,F) \
79 (U)->funcs->stop_timer(U, U->arg, F.c); \
83 #define _TIMER_START(UNI,ARG,FIELD,DUE,FUNC) \
84 (void)(FIELD.c = (UNI)->funcs->start_timer(UNI, \
85 UNI->arg, DUE, FUNC, ARG))
87 #define TIMER_ISACT(X,T) (X->T.c != NULL)
89 #define TIMER_FUNC_UNI(T,F) \
90 static void F(struct uni *); \
92 _##T##_func(void *varg) \
94 struct uni *uni = (struct uni *)varg; \
100 * Be careful: call may be invalid after the call to F
102 #define TIMER_FUNC_CALL(T,F) \
103 static void F(struct call *); \
105 _##T##_func(void *varg) \
107 struct call *call = (struct call *)varg; \
113 * Be careful: call/party may be invalid after the call to F
115 #define TIMER_FUNC_PARTY(T,F) \
116 static void F(struct party *); \
118 _##T##_func(void *varg) \
120 struct party *party = (struct party *)varg; \