11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * CAPI encode/decode prototypes and defines 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (C) 1996 Universidade de Lisboa 5475be4d85a274d0961593db41cf85689db1d583cJoe Perches * 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Written by Pedro Roque Marques (roque@di.fc.ul.pt) 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 8475be4d85a274d0961593db41cf85689db1d583cJoe Perches * This software may be used and distributed according to the terms of 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the GNU General Public License, incorporated herein by reference. 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef CAPI_H 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CAPI_H 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define REQ_CAUSE 0x01 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define REQ_DISPLAY 0x04 18475be4d85a274d0961593db41cf85689db1d583cJoe Perches#define REQ_USER_TO_USER 0x08 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 20475be4d85a274d0961593db41cf85689db1d583cJoe Perches#define AppInfoMask REQ_CAUSE | REQ_DISPLAY | REQ_USER_TO_USER 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Connection Setup */ 23475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_conn_req(const char *calledPN, struct sk_buff **buf, 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int proto); 25475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_decode_conn_conf(struct pcbit_chan *chan, struct sk_buff *skb, 26475be4d85a274d0961593db41cf85689db1d583cJoe Perches int *complete); 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 28475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_decode_conn_ind(struct pcbit_chan *chan, struct sk_buff *skb, 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct callb_data *info); 30475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_conn_resp(struct pcbit_chan *chan, struct sk_buff **skb); 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 32475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_conn_active_req(struct pcbit_chan *chan, struct sk_buff **skb); 33475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_decode_conn_actv_conf(struct pcbit_chan *chan, 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct sk_buff *skb); 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 36475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_decode_conn_actv_ind(struct pcbit_chan *chan, 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct sk_buff *skb); 38475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_conn_active_resp(struct pcbit_chan *chan, 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct sk_buff **skb); 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Data */ 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb, 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int outgoing); 44475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_decode_sel_proto_conf(struct pcbit_chan *chan, 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct sk_buff *skb); 461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 47475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_activate_transp_req(struct pcbit_chan *chan, 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct sk_buff **skb); 49475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_decode_actv_trans_conf(struct pcbit_chan *chan, 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct sk_buff *skb); 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 52475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_tdata_req(struct pcbit_chan *chan, struct sk_buff *skb); 53475be4d85a274d0961593db41cf85689db1d583cJoe Perchesextern int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff **skb); 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Connection Termination */ 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause); 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb); 591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb); 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef DEBUG 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int capi_decode_debug_188(u_char *hdr, ushort hdrlen); 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 65475be4d85a274d0961593db41cf85689db1d583cJoe Perchesstatic inline struct pcbit_chan * 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldscapi_channel(struct pcbit_dev *dev, struct sk_buff *skb) 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ushort callref; 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 70475be4d85a274d0961593db41cf85689db1d583cJoe Perches callref = *((ushort *)skb->data); 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds skb_pull(skb, 2); 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (dev->b1->callref == callref) 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return dev->b1; 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds else if (dev->b2->callref == callref) 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return dev->b2; 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return NULL; 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 82