l1oip.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * see notice in l1oip.c
  3. */
  4. /* debugging */
  5. #define DEBUG_L1OIP_INIT 0x00010000
  6. #define DEBUG_L1OIP_SOCKET 0x00020000
  7. #define DEBUG_L1OIP_MGR 0x00040000
  8. #define DEBUG_L1OIP_MSG 0x00080000
  9. /* enable to disorder received bchannels by sequence 2143658798... */
  10. /*
  11. #define REORDER_DEBUG
  12. */
  13. /* frames */
  14. #define L1OIP_MAX_LEN 2048 /* max packet size form l2 */
  15. #define L1OIP_MAX_PERFRAME 1400 /* max data size in one frame */
  16. /* timers */
  17. #define L1OIP_KEEPALIVE 15
  18. #define L1OIP_TIMEOUT 65
  19. /* socket */
  20. #define L1OIP_DEFAULTPORT 931
  21. /* channel structure */
  22. struct l1oip_chan {
  23. struct dchannel *dch;
  24. struct bchannel *bch;
  25. u32 tx_counter; /* counts xmit bytes/packets */
  26. u32 rx_counter; /* counts recv bytes/packets */
  27. u32 codecstate; /* used by codec to save data */
  28. #ifdef REORDER_DEBUG
  29. int disorder_flag;
  30. struct sk_buff *disorder_skb;
  31. u32 disorder_cnt;
  32. #endif
  33. };
  34. /* card structure */
  35. struct l1oip {
  36. struct list_head list;
  37. /* card */
  38. int registered; /* if registered with mISDN */
  39. char name[MISDN_MAX_IDLEN];
  40. int idx; /* card index */
  41. int pri; /* 1=pri, 0=bri */
  42. int d_idx; /* current dchannel number */
  43. int b_num; /* number of bchannels */
  44. u32 id; /* id of connection */
  45. int ondemand; /* if transmis. is on demand */
  46. int bundle; /* bundle channels in one frm */
  47. int codec; /* codec to use for transmis. */
  48. int limit; /* limit number of bchannels */
  49. /* timer */
  50. struct timer_list keep_tl;
  51. struct timer_list timeout_tl;
  52. int timeout_on;
  53. struct work_struct workq;
  54. /* socket */
  55. struct socket *socket; /* if set, socket is created */
  56. struct completion socket_complete;/* completion of sock thread */
  57. struct task_struct *socket_thread;
  58. spinlock_t socket_lock; /* access sock outside thread */
  59. u32 remoteip; /* if all set, ip is assigned */
  60. u16 localport; /* must always be set */
  61. u16 remoteport; /* must always be set */
  62. struct sockaddr_in sin_local; /* local socket name */
  63. struct sockaddr_in sin_remote; /* remote socket name */
  64. struct msghdr sendmsg; /* ip message to send */
  65. struct kvec sendiov; /* iov for message */
  66. /* frame */
  67. struct l1oip_chan chan[128]; /* channel instances */
  68. };
  69. extern int l1oip_law_to_4bit(u8 *data, int len, u8 *result, u32 *state);
  70. extern int l1oip_4bit_to_law(u8 *data, int len, u8 *result);
  71. extern int l1oip_alaw_to_ulaw(u8 *data, int len, u8 *result);
  72. extern int l1oip_ulaw_to_alaw(u8 *data, int len, u8 *result);
  73. extern void l1oip_4bit_free(void);
  74. extern int l1oip_4bit_alloc(int ulaw);