0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <linux/kernel.h>
0014 #include <linux/spinlock.h>
0015 #include <linux/list.h>
0016 #include <linux/isdn/capilli.h>
0017
0018 #ifdef KCAPI_DEBUG
0019 #define DBG(format, arg...) do { \
0020 printk(KERN_DEBUG "%s: " format "\n" , __func__ , ## arg); \
0021 } while (0)
0022 #else
0023 #define DBG(format, arg...)
0024 #endif
0025
0026 enum {
0027 CAPI_CTR_DETACHED = 0,
0028 CAPI_CTR_DETECTED = 1,
0029 CAPI_CTR_LOADING = 2,
0030 CAPI_CTR_RUNNING = 3,
0031 };
0032
0033 extern struct capi_ctr *capi_controller[CAPI_MAXCONTR];
0034 extern struct mutex capi_controller_lock;
0035
0036 extern struct capi20_appl *capi_applications[CAPI_MAXAPPL];
0037
0038 void kcapi_proc_init(void);
0039 void kcapi_proc_exit(void);
0040
0041 struct capi20_appl {
0042 u16 applid;
0043 capi_register_params rparam;
0044 void (*recv_message)(struct capi20_appl *ap, struct sk_buff *skb);
0045 void *private;
0046
0047
0048 unsigned long nrecvctlpkt;
0049 unsigned long nrecvdatapkt;
0050 unsigned long nsentctlpkt;
0051 unsigned long nsentdatapkt;
0052 struct mutex recv_mtx;
0053 struct sk_buff_head recv_queue;
0054 struct work_struct recv_work;
0055 int release_in_progress;
0056 };
0057
0058 u16 capi20_isinstalled(void);
0059 u16 capi20_register(struct capi20_appl *ap);
0060 u16 capi20_release(struct capi20_appl *ap);
0061 u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
0062 u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
0063 u16 capi20_get_version(u32 contr, struct capi_version *verp);
0064 u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
0065 u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
0066 int capi20_manufacturer(unsigned long cmd, void __user *data);
0067
0068 #define CAPICTR_UP 0
0069 #define CAPICTR_DOWN 1
0070
0071 int kcapi_init(void);
0072 void kcapi_exit(void);
0073
0074
0075
0076 typedef __u8 *_cstruct;
0077
0078 typedef enum {
0079 CAPI_COMPOSE,
0080 CAPI_DEFAULT
0081 } _cmstruct;
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091 typedef struct {
0092
0093 __u16 ApplId;
0094 __u8 Command;
0095 __u8 Subcommand;
0096 __u16 Messagenumber;
0097
0098
0099 union {
0100 __u32 adrController;
0101 __u32 adrPLCI;
0102 __u32 adrNCCI;
0103 } adr;
0104
0105 _cmstruct AdditionalInfo;
0106 _cstruct B1configuration;
0107 __u16 B1protocol;
0108 _cstruct B2configuration;
0109 __u16 B2protocol;
0110 _cstruct B3configuration;
0111 __u16 B3protocol;
0112 _cstruct BC;
0113 _cstruct BChannelinformation;
0114 _cmstruct BProtocol;
0115 _cstruct CalledPartyNumber;
0116 _cstruct CalledPartySubaddress;
0117 _cstruct CallingPartyNumber;
0118 _cstruct CallingPartySubaddress;
0119 __u32 CIPmask;
0120 __u32 CIPmask2;
0121 __u16 CIPValue;
0122 __u32 Class;
0123 _cstruct ConnectedNumber;
0124 _cstruct ConnectedSubaddress;
0125 __u32 Data;
0126 __u16 DataHandle;
0127 __u16 DataLength;
0128 _cstruct FacilityConfirmationParameter;
0129 _cstruct Facilitydataarray;
0130 _cstruct FacilityIndicationParameter;
0131 _cstruct FacilityRequestParameter;
0132 __u16 FacilitySelector;
0133 __u16 Flags;
0134 __u32 Function;
0135 _cstruct HLC;
0136 __u16 Info;
0137 _cstruct InfoElement;
0138 __u32 InfoMask;
0139 __u16 InfoNumber;
0140 _cstruct Keypadfacility;
0141 _cstruct LLC;
0142 _cstruct ManuData;
0143 __u32 ManuID;
0144 _cstruct NCPI;
0145 __u16 Reason;
0146 __u16 Reason_B3;
0147 __u16 Reject;
0148 _cstruct Useruserdata;
0149
0150
0151 unsigned l, p;
0152 unsigned char *par;
0153 __u8 *m;
0154
0155
0156 __u8 buf[180];
0157
0158 } _cmsg;
0159
0160
0161
0162
0163
0164
0165
0166 char *capi_cmd2str(__u8 cmd, __u8 subcmd);
0167
0168 typedef struct {
0169 u_char *buf;
0170 u_char *p;
0171 size_t size;
0172 size_t pos;
0173 } _cdebbuf;
0174
0175 #define CDEBUG_SIZE 1024
0176 #define CDEBUG_GSIZE 4096
0177
0178 void cdebbuf_free(_cdebbuf *cdb);
0179 int cdebug_init(void);
0180 void cdebug_exit(void);
0181
0182 _cdebbuf *capi_message2str(__u8 *msg);