~ubuntu-branches/ubuntu/saucy/libpri/saucy

« back to all changes in this revision

Viewing changes to pri_internal.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2005-12-07 21:25:46 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051207212546-lv02jlyw3pm9ho0q
Tags: 1.2.1-1
* New upstream release
* Disable bristuff for new upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
/* No more than 128 scheduled events */
41
41
#define MAX_SCHED 128
42
42
 
 
43
#define MAX_TIMERS 32
 
44
 
43
45
struct pri {
44
46
        int fd;                         /* File descriptor for D-Channel */
 
47
        pri_io_cb read_func;            /* Read data callback */
 
48
        pri_io_cb write_func;           /* Write data callback */
 
49
        void *userdata;
45
50
        struct pri *subchannel; /* Sub-channel if appropriate */
46
51
        struct pri *master;             /* Master channel if appropriate */
47
52
        struct pri_sched pri_sched[MAX_SCHED];  /* Scheduled events */
76
81
        int sabme_timer;        /* SABME retransmit */
77
82
        int t203_timer;         /* Max idle time */
78
83
        int t200_timer;         /* T-200 retransmission timer */
79
 
        
 
84
        /* All ISDN Timer values */
 
85
        int timers[MAX_TIMERS];
 
86
 
80
87
        /* Used by scheduler */
81
88
        struct timeval tv;
82
89
        int schedev;
99
106
        unsigned int q931_txcount;
100
107
        unsigned int q931_rxcount;
101
108
#endif
 
109
 
 
110
        unsigned char last_invoke;      /* Last ROSE invoke ID */
 
111
        unsigned char sendfacility;
102
112
};
103
113
 
104
114
struct pri_sr {
114
124
        int calledplan;
115
125
        int userl1;
116
126
        int numcomplete;
 
127
        char *redirectingnum;
 
128
        int redirectingplan;
 
129
        int redirectingpres;
 
130
        int redirectingreason;
 
131
        int justsignalling;
 
132
        char *useruserinfo;
117
133
};
118
134
 
119
135
/* Internal switch types */
120
 
#define PRI_SWITCH_GR303_EOC_PATH       10
121
 
#define PRI_SWITCH_GR303_TMC_SWITCHING  11
 
136
#define PRI_SWITCH_GR303_EOC_PATH       19
 
137
#define PRI_SWITCH_GR303_TMC_SWITCHING  20
 
138
 
 
139
struct apdu_event {
 
140
        int message;                    /* What message to send the ADPU in */
 
141
        void (*callback)(void *data);   /* Callback function for when response is received */
 
142
        void *data;                     /* Data to callback */
 
143
        unsigned char apdu[255];                        /* ADPU to send */
 
144
        int apdu_len;                   /* Length of ADPU */
 
145
        int sent;                       /* Have we been sent already? */
 
146
        struct apdu_event *next;        /* Linked list pointer */
 
147
};
 
148
 
 
149
/* q931_call datastructure */
 
150
 
 
151
struct q931_call {
 
152
        struct pri *pri;        /* PRI */
 
153
        int cr;                         /* Call Reference */
 
154
        int forceinvert;        /* Force inversion of call number even if 0 */
 
155
        q931_call *next;
 
156
        /* Slotmap specified (bitmap of channels 31/24-1) (Channel Identifier IE) (-1 means not specified) */
 
157
        int slotmap;
 
158
        /* An explicit channel (Channel Identifier IE) (-1 means not specified) */
 
159
        int channelno;
 
160
        /* An explicit DS1 (-1 means not specified) */
 
161
        int ds1no;
 
162
        /* Whether or not the ds1 is explicitly identified or implicit.  If implicit
 
163
           the bchan is on the same span as the current active dchan (NFAS) */
 
164
        int ds1explicit;
 
165
        /* Channel flags (0 means none retrieved) */
 
166
        int chanflags;
 
167
        
 
168
        int alive;                      /* Whether or not the call is alive */
 
169
        int acked;                      /* Whether setup has been acked or not */
 
170
        int sendhangupack;      /* Whether or not to send a hangup ack */
 
171
        int proc;                       /* Whether we've sent a call proceeding / alerting */
 
172
        
 
173
        int ri;                         /* Restart Indicator (Restart Indicator IE) */
 
174
 
 
175
        /* Bearer Capability */
 
176
        int transcapability;
 
177
        int transmoderate;
 
178
        int transmultiple;
 
179
        int userl1;
 
180
        int userl2;
 
181
        int userl3;
 
182
        int rateadaption;
 
183
        
 
184
        int sentchannel;
 
185
        int justsignalling;             /* for a signalling-only connection */
 
186
 
 
187
        int progcode;                   /* Progress coding */
 
188
        int progloc;                    /* Progress Location */ 
 
189
        int progress;                   /* Progress indicator */
 
190
        int progressmask;               /* Progress Indicator bitmask */
 
191
        
 
192
        int notify;                             /* Notification */
 
193
        
 
194
        int causecode;                  /* Cause Coding */
 
195
        int causeloc;                   /* Cause Location */
 
196
        int cause;                              /* Cause of clearing */
 
197
        
 
198
        int peercallstate;              /* Call state of peer as reported */
 
199
        int ourcallstate;               /* Our call state */
 
200
        int sugcallstate;               /* Status call state */
 
201
        
 
202
        int callerplan;
 
203
        int callerplanani;
 
204
        int callerpres;                 /* Caller presentation */
 
205
        char callerani[256];    /* Caller */
 
206
        char callernum[256];
 
207
        char callername[256];
 
208
 
 
209
        char digitbuf[64];              /* Buffer for digits that come in KEYPAD_FACILITY */
 
210
 
 
211
        int ani2;               /* ANI II */
 
212
        
 
213
        int calledplan;
 
214
        int nonisdn;
 
215
        char callednum[256];    /* Called Number */
 
216
        int complete;                   /* no more digits coming */
 
217
        int newcall;                    /* if the received message has a new call reference value */
 
218
 
 
219
        int retranstimer;               /* Timer for retransmitting DISC */
 
220
        int t308_timedout;              /* Whether t308 timed out once */
 
221
 
 
222
        int redirectingplan;
 
223
        int redirectingpres;
 
224
        int redirectingreason;        
 
225
        char redirectingnum[256];       /* Number of redirecting party */
 
226
        char redirectingname[256];      /* Name of redirecting party */
 
227
 
 
228
        /* Filled in cases of multiple diversions */
 
229
        int origcalledplan;
 
230
        int origcalledpres;
 
231
        int origredirectingreason;      /* Original reason for redirect (in cases of multiple redirects) */
 
232
        char origcalledname[256];       /* Original name of person being called */
 
233
        char origcallednum[256];        /* Orignal number of person being called */
 
234
 
 
235
        int useruserprotocoldisc;
 
236
        char useruserinfo[256];
 
237
        char callingsubaddr[256];       /* Calling parties sub address */
 
238
        
 
239
        long aoc_units;                         /* Advice of Charge Units */
 
240
 
 
241
        struct apdu_event *apdus;       /* APDU queue for call */
 
242
};
122
243
 
123
244
extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);
124
245
 
128
249
 
129
250
extern pri_event *pri_mkerror(struct pri *pri, char *errstr);
130
251
 
131
 
extern void pri_message(char *fmt, ...);
132
 
 
133
 
extern void pri_error(char *fmt, ...);
 
252
extern void pri_message(struct pri *pri, char *fmt, ...);
 
253
 
 
254
extern void pri_error(struct pri *pri, char *fmt, ...);
 
255
 
 
256
void libpri_copy_string(char *dst, const char *src, size_t size);
134
257
 
135
258
#endif