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