blob: 075fab5f92e1a5331209f2ffae134935db22ae3c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#ifndef __KERNELCAPI_H__
11#define __KERNELCAPI_H__
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14#include <linux/list.h>
15#include <linux/skbuff.h>
Al Virod7fe0f22006-12-03 23:15:30 -050016#include <linux/workqueue.h>
Jan Kiszkaef69bb22010-02-08 10:12:13 +000017#include <linux/notifier.h>
David Howells607ca462012-10-13 10:46:48 +010018#include <uapi/linux/kernelcapi.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
20struct 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;
Matthias Kaehlcke67837f22007-07-17 04:04:16 -070031 struct mutex recv_mtx;
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 struct sk_buff_head recv_queue;
33 struct work_struct recv_work;
34 int release_in_progress;
Linus Torvalds1da177e2005-04-16 15:20:36 -070035};
36
37u16 capi20_isinstalled(void);
38u16 capi20_register(struct capi20_appl *ap);
39u16 capi20_release(struct capi20_appl *ap);
40u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
41u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
42u16 capi20_get_version(u32 contr, struct capi_version *verp);
43u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
44u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
Tilman Schmidt9ea8aa82014-10-11 13:46:30 +020045int capi20_manufacturer(unsigned long cmd, void __user *data);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
Jan Kiszkaef69bb22010-02-08 10:12:13 +000047#define CAPICTR_UP 0
48#define CAPICTR_DOWN 1
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Jan Kiszkaef69bb22010-02-08 10:12:13 +000050int register_capictr_notifier(struct notifier_block *nb);
51int unregister_capictr_notifier(struct notifier_block *nb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
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
79typedef 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
89typedef 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
106typedef enum {
107 CapiSuccess = 0x0000,
108 CapiSupplementaryServiceNotSupported = 0x300e,
109 CapiRequestNotAllowedInThisState = 0x3010,
110} SUPPLEMENTARY_SERVICE_INFO;
111
112typedef enum {
113 CapiProtocolErrorLayer1 = 0x3301,
114 CapiProtocolErrorLayer2 = 0x3302,
115 CapiProtocolErrorLayer3 = 0x3303,
116 CapiTimeOut = 0x3303, // SuppServiceReason
117 CapiCallGivenToOtherApplication = 0x3304,
118} CAPI_REASON;
119
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120#endif /* __KERNELCAPI_H__ */