summaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/eicon/kst_ifc.h
blob: 894fdfda10900152c6af23c244f026bb600d8f8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
/*
 *
 Copyright (c) Eicon Networks, 2000.
 *
 This source file is supplied for the use with
 Eicon Networks range of DIVA Server Adapters.
 *
 Eicon File Revision :    1.9
 *
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.
 *
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 See the GNU General Public License for more details.
 *
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */
#ifndef __DIVA_EICON_TRACE_API__
#define __DIVA_EICON_TRACE_API__

#define DIVA_TRACE_LINE_TYPE_LEN 64
#define DIVA_TRACE_IE_LEN        64
#define DIVA_TRACE_FAX_PRMS_LEN  128

typedef struct _diva_trace_ie {
	byte length;
	byte data[DIVA_TRACE_IE_LEN];
} diva_trace_ie_t;

/*
  Structure used to represent "State\\BX\\Modem" directory
  to user.
*/
typedef struct _diva_trace_modem_state {
	dword	ChannelNumber;

	dword	Event;

	dword	Norm;

	dword Options; /* Options received from Application */

	dword	TxSpeed;
	dword	RxSpeed;

	dword RoundtripMsec;

	dword SymbolRate;

	int		RxLeveldBm;
	int		EchoLeveldBm;

	dword	SNRdb;
	dword MAE;

	dword LocalRetrains;
	dword RemoteRetrains;
	dword LocalResyncs;
	dword RemoteResyncs;

	dword DiscReason;

} diva_trace_modem_state_t;

/*
  Representation of "State\\BX\\FAX" directory
*/
typedef struct _diva_trace_fax_state {
	dword	ChannelNumber;
	dword Event;
	dword Page_Counter;
	dword Features;
	char Station_ID[DIVA_TRACE_FAX_PRMS_LEN];
	char Subaddress[DIVA_TRACE_FAX_PRMS_LEN];
	char Password[DIVA_TRACE_FAX_PRMS_LEN];
	dword Speed;
	dword Resolution;
	dword Paper_Width;
	dword Paper_Length;
	dword Scanline_Time;
	dword Disc_Reason;
	dword	dummy;
} diva_trace_fax_state_t;

/*
  Structure used to represent Interface State in the abstract
  and interface/D-channel protocol independent form.
*/
typedef struct _diva_trace_interface_state {
	char Layer1[DIVA_TRACE_LINE_TYPE_LEN];
	char Layer2[DIVA_TRACE_LINE_TYPE_LEN];
} diva_trace_interface_state_t;

typedef struct _diva_incoming_call_statistics {
	dword Calls;
	dword Connected;
	dword User_Busy;
	dword Call_Rejected;
	dword Wrong_Number;
	dword Incompatible_Dst;
	dword Out_of_Order;
	dword Ignored;
} diva_incoming_call_statistics_t;

typedef struct _diva_outgoing_call_statistics {
	dword Calls;
	dword Connected;
	dword User_Busy;
	dword No_Answer;
	dword Wrong_Number;
	dword Call_Rejected;
	dword Other_Failures;
} diva_outgoing_call_statistics_t;

typedef struct _diva_modem_call_statistics {
	dword Disc_Normal;
	dword Disc_Unspecified;
	dword Disc_Busy_Tone;
	dword Disc_Congestion;
	dword Disc_Carr_Wait;
	dword Disc_Trn_Timeout;
	dword Disc_Incompat;
	dword Disc_Frame_Rej;
	dword Disc_V42bis;
} diva_modem_call_statistics_t;

typedef struct _diva_fax_call_statistics {
	dword Disc_Normal;
	dword Disc_Not_Ident;
	dword Disc_No_Response;
	dword Disc_Retries;
	dword Disc_Unexp_Msg;
	dword Disc_No_Polling;
	dword Disc_Training;
	dword Disc_Unexpected;
	dword Disc_Application;
	dword Disc_Incompat;
	dword Disc_No_Command;
	dword Disc_Long_Msg;
	dword Disc_Supervisor;
	dword Disc_SUB_SEP_PWD;
	dword Disc_Invalid_Msg;
	dword Disc_Page_Coding;
	dword Disc_App_Timeout;
	dword Disc_Unspecified;
} diva_fax_call_statistics_t;

typedef struct _diva_prot_statistics {
	dword X_Frames;
	dword X_Bytes;
	dword X_Errors;
	dword R_Frames;
	dword R_Bytes;
	dword R_Errors;
} diva_prot_statistics_t;

typedef struct _diva_ifc_statistics {
	diva_incoming_call_statistics_t	inc;
	diva_outgoing_call_statistics_t outg;
	diva_modem_call_statistics_t mdm;
	diva_fax_call_statistics_t fax;
	diva_prot_statistics_t b1;
	diva_prot_statistics_t b2;
	diva_prot_statistics_t d1;
	diva_prot_statistics_t d2;
} diva_ifc_statistics_t;

/*
  Structure used to represent "State\\BX" directory
  to user.
*/
typedef struct _diva_trace_line_state {
	dword	ChannelNumber;

	char Line[DIVA_TRACE_LINE_TYPE_LEN];

	char Framing[DIVA_TRACE_LINE_TYPE_LEN];

	char Layer2[DIVA_TRACE_LINE_TYPE_LEN];
	char Layer3[DIVA_TRACE_LINE_TYPE_LEN];

	char RemoteAddress[DIVA_TRACE_LINE_TYPE_LEN];
	char RemoteSubAddress[DIVA_TRACE_LINE_TYPE_LEN];

	char LocalAddress[DIVA_TRACE_LINE_TYPE_LEN];
	char LocalSubAddress[DIVA_TRACE_LINE_TYPE_LEN];

	diva_trace_ie_t call_BC;
	diva_trace_ie_t call_HLC;
	diva_trace_ie_t call_LLC;

	dword Charges;

	dword CallReference;

	dword LastDisconnecCause;

	char UserID[DIVA_TRACE_LINE_TYPE_LEN];

	diva_trace_modem_state_t modem;
	diva_trace_fax_state_t fax;

	diva_trace_interface_state_t *pInterface;

	diva_ifc_statistics_t *pInterfaceStat;

} diva_trace_line_state_t;

#define DIVA_SUPER_TRACE_NOTIFY_LINE_CHANGE             ('l')
#define DIVA_SUPER_TRACE_NOTIFY_MODEM_CHANGE            ('m')
#define DIVA_SUPER_TRACE_NOTIFY_FAX_CHANGE              ('f')
#define DIVA_SUPER_TRACE_INTERFACE_CHANGE               ('i')
#define DIVA_SUPER_TRACE_NOTIFY_STAT_CHANGE             ('s')
#define DIVA_SUPER_TRACE_NOTIFY_MDM_STAT_CHANGE         ('M')
#define DIVA_SUPER_TRACE_NOTIFY_FAX_STAT_CHANGE         ('F')

struct _diva_strace_library_interface;
typedef void (*diva_trace_channel_state_change_proc_t)(void *user_context,
						       struct _diva_strace_library_interface *hLib,
						       int Adapter,
						       diva_trace_line_state_t *channel, int notify_subject);
typedef void (*diva_trace_channel_trace_proc_t)(void *user_context,
						struct _diva_strace_library_interface *hLib,
						int Adapter, void *xlog_buffer, int length);
typedef void (*diva_trace_error_proc_t)(void *user_context,
					struct _diva_strace_library_interface *hLib,
					int Adapter,
					int error, const char *file, int line);

/*
  This structure creates interface from user to library
*/
typedef struct _diva_trace_library_user_interface {
	void *user_context;
	diva_trace_channel_state_change_proc_t notify_proc;
	diva_trace_channel_trace_proc_t trace_proc;
	diva_trace_error_proc_t error_notify_proc;
} diva_trace_library_user_interface_t;

/*
  Interface from Library to User
*/
typedef int (*DivaSTraceLibraryStart_proc_t)(void *hLib);
typedef int (*DivaSTraceLibraryFinit_proc_t)(void *hLib);
typedef int (*DivaSTraceMessageInput_proc_t)(void *hLib);
typedef void* (*DivaSTraceGetHandle_proc_t)(void *hLib);

/*
  Turn Audio Tap trace on/off
  Channel should be in the range 1 ... Number of Channels
*/
typedef int (*DivaSTraceSetAudioTap_proc_t)(void *hLib, int Channel, int on);

/*
  Turn B-channel trace on/off
  Channel should be in the range 1 ... Number of Channels
*/
typedef int (*DivaSTraceSetBChannel_proc_t)(void *hLib, int Channel, int on);

/*
  Turn	D-channel (Layer1/Layer2/Layer3) trace on/off
  Layer1 - All D-channel frames received/sent over the interface
  inclusive Layer 2 headers, Layer 2 frames and TEI management frames
  Layer2 - Events from LAPD protocol instance with SAPI of signalling protocol
  Layer3 - All D-channel frames addressed to assigned to the card TEI and
  SAPI of signalling protocol, and signalling protocol events.
*/
typedef int (*DivaSTraceSetDChannel_proc_t)(void *hLib, int on);

/*
  Get overall card statistics
*/
typedef int (*DivaSTraceGetOutgoingCallStatistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetIncomingCallStatistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetModemStatistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetFaxStatistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetBLayer1Statistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetBLayer2Statistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetDLayer1Statistics_proc_t)(void *hLib);
typedef int (*DivaSTraceGetDLayer2Statistics_proc_t)(void *hLib);

/*
  Call control
*/
typedef int (*DivaSTraceClearCall_proc_t)(void *hLib, int Channel);

typedef struct _diva_strace_library_interface {
	void *hLib;
	DivaSTraceLibraryStart_proc_t DivaSTraceLibraryStart;
	DivaSTraceLibraryStart_proc_t DivaSTraceLibraryStop;
	DivaSTraceLibraryFinit_proc_t DivaSTraceLibraryFinit;
	DivaSTraceMessageInput_proc_t DivaSTraceMessageInput;
	DivaSTraceGetHandle_proc_t DivaSTraceGetHandle;
	DivaSTraceSetAudioTap_proc_t DivaSTraceSetAudioTap;
	DivaSTraceSetBChannel_proc_t DivaSTraceSetBChannel;
	DivaSTraceSetDChannel_proc_t DivaSTraceSetDChannel;
	DivaSTraceSetDChannel_proc_t DivaSTraceSetInfo;
	DivaSTraceGetOutgoingCallStatistics_proc_t \
	DivaSTraceGetOutgoingCallStatistics;
	DivaSTraceGetIncomingCallStatistics_proc_t \
	DivaSTraceGetIncomingCallStatistics;
	DivaSTraceGetModemStatistics_proc_t \
	DivaSTraceGetModemStatistics;
	DivaSTraceGetFaxStatistics_proc_t \
	DivaSTraceGetFaxStatistics;
	DivaSTraceGetBLayer1Statistics_proc_t \
	DivaSTraceGetBLayer1Statistics;
	DivaSTraceGetBLayer2Statistics_proc_t \
	DivaSTraceGetBLayer2Statistics;
	DivaSTraceGetDLayer1Statistics_proc_t \
	DivaSTraceGetDLayer1Statistics;
	DivaSTraceGetDLayer2Statistics_proc_t \
	DivaSTraceGetDLayer2Statistics;
	DivaSTraceClearCall_proc_t DivaSTraceClearCall;
} diva_strace_library_interface_t;

/*
  Create and return Library interface
*/
diva_strace_library_interface_t *DivaSTraceLibraryCreateInstance(int Adapter,
								 const diva_trace_library_user_interface_t *user_proc,
								 byte *pmem);
dword DivaSTraceGetMemotyRequirement(int channels);

#define DIVA_MAX_ADAPTERS  64
#define DIVA_MAX_LINES     32

#endif