1/*
2 * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $
3 *
4 * Kernel CAPI 2.0 Interface for Linux
5 *
6 * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
7 *
8 */
9#ifndef __KERNELCAPI_H__
10#define __KERNELCAPI_H__
11
12
13#include <linux/list.h>
14#include <linux/skbuff.h>
15#include <linux/workqueue.h>
16#include <linux/notifier.h>
17#include <uapi/linux/kernelcapi.h>
18
19struct capi20_appl {
20	u16 applid;
21	capi_register_params rparam;
22	void (*recv_message)(struct capi20_appl *ap, struct sk_buff *skb);
23	void *private;
24
25	/* internal to kernelcapi.o */
26	unsigned long nrecvctlpkt;
27	unsigned long nrecvdatapkt;
28	unsigned long nsentctlpkt;
29	unsigned long nsentdatapkt;
30	struct mutex recv_mtx;
31	struct sk_buff_head recv_queue;
32	struct work_struct recv_work;
33	int release_in_progress;
34};
35
36u16 capi20_isinstalled(void);
37u16 capi20_register(struct capi20_appl *ap);
38u16 capi20_release(struct capi20_appl *ap);
39u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
40u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
41u16 capi20_get_version(u32 contr, struct capi_version *verp);
42u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
43u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
44int capi20_manufacturer(unsigned long cmd, void __user *data);
45
46#define CAPICTR_UP			0
47#define CAPICTR_DOWN			1
48
49int register_capictr_notifier(struct notifier_block *nb);
50int unregister_capictr_notifier(struct notifier_block *nb);
51
52#define CAPI_NOERROR                      0x0000
53
54#define CAPI_TOOMANYAPPLS		  0x1001
55#define CAPI_LOGBLKSIZETOSMALL	          0x1002
56#define CAPI_BUFFEXECEEDS64K 	          0x1003
57#define CAPI_MSGBUFSIZETOOSMALL	          0x1004
58#define CAPI_ANZLOGCONNNOTSUPPORTED	  0x1005
59#define CAPI_REGRESERVED		  0x1006
60#define CAPI_REGBUSY 		          0x1007
61#define CAPI_REGOSRESOURCEERR	          0x1008
62#define CAPI_REGNOTINSTALLED 	          0x1009
63#define CAPI_REGCTRLERNOTSUPPORTEXTEQUIP  0x100a
64#define CAPI_REGCTRLERONLYSUPPORTEXTEQUIP 0x100b
65
66#define CAPI_ILLAPPNR		          0x1101
67#define CAPI_ILLCMDORSUBCMDORMSGTOSMALL   0x1102
68#define CAPI_SENDQUEUEFULL		  0x1103
69#define CAPI_RECEIVEQUEUEEMPTY	          0x1104
70#define CAPI_RECEIVEOVERFLOW 	          0x1105
71#define CAPI_UNKNOWNNOTPAR		  0x1106
72#define CAPI_MSGBUSY 		          0x1107
73#define CAPI_MSGOSRESOURCEERR	          0x1108
74#define CAPI_MSGNOTINSTALLED 	          0x1109
75#define CAPI_MSGCTRLERNOTSUPPORTEXTEQUIP  0x110a
76#define CAPI_MSGCTRLERONLYSUPPORTEXTEQUIP 0x110b
77
78typedef enum {
79        CapiMessageNotSupportedInCurrentState = 0x2001,
80        CapiIllContrPlciNcci                  = 0x2002,
81        CapiNoPlciAvailable                   = 0x2003,
82        CapiNoNcciAvailable                   = 0x2004,
83        CapiNoListenResourcesAvailable        = 0x2005,
84        CapiNoFaxResourcesAvailable           = 0x2006,
85        CapiIllMessageParmCoding              = 0x2007,
86} RESOURCE_CODING_PROBLEM;
87
88typedef enum {
89        CapiB1ProtocolNotSupported                      = 0x3001,
90        CapiB2ProtocolNotSupported                      = 0x3002,
91        CapiB3ProtocolNotSupported                      = 0x3003,
92        CapiB1ProtocolParameterNotSupported             = 0x3004,
93        CapiB2ProtocolParameterNotSupported             = 0x3005,
94        CapiB3ProtocolParameterNotSupported             = 0x3006,
95        CapiBProtocolCombinationNotSupported            = 0x3007,
96        CapiNcpiNotSupported                            = 0x3008,
97        CapiCipValueUnknown                             = 0x3009,
98        CapiFlagsNotSupported                           = 0x300a,
99        CapiFacilityNotSupported                        = 0x300b,
100        CapiDataLengthNotSupportedByCurrentProtocol     = 0x300c,
101        CapiResetProcedureNotSupportedByCurrentProtocol = 0x300d,
102        CapiTeiAssignmentFailed                         = 0x300e,
103} REQUESTED_SERVICES_PROBLEM;
104
105typedef enum {
106	CapiSuccess                                     = 0x0000,
107	CapiSupplementaryServiceNotSupported            = 0x300e,
108	CapiRequestNotAllowedInThisState                = 0x3010,
109} SUPPLEMENTARY_SERVICE_INFO;
110
111typedef enum {
112	CapiProtocolErrorLayer1                         = 0x3301,
113	CapiProtocolErrorLayer2                         = 0x3302,
114	CapiProtocolErrorLayer3                         = 0x3303,
115	CapiTimeOut                                     = 0x3303, // SuppServiceReason
116	CapiCallGivenToOtherApplication                 = 0x3304,
117} CAPI_REASON;
118
119#endif				/* __KERNELCAPI_H__ */
120