smasi_pdu.h
上传用户:gzpyjq
上传日期:2013-01-31
资源大小:1852k
文件大小:3k
源码类别:

手机WAP编程

开发平台:

WINDOWS

  1. /*
  2.  * smasi_pdu.h - declarations for SMASI PDUs
  3.  *
  4.  * Stipe Tolj <tolj@wapme-systems.de>
  5.  */
  6. #ifndef SMASI_PDU_H
  7. #define SMASI_PDU_H
  8. #include "gwlib/gwlib.h"
  9. /* 
  10.  * Any PDUs that are below this ID will be packed with a 
  11.  * prefixed hyphen.
  12.  */
  13. #define SMASI_HYPHEN_ID     0x00000010
  14. enum {
  15.     #define NONTERMINATED(name)
  16.     #define COMATERMINATED(name)
  17.     #define PDU(name, id, fields) name = id,
  18.     #include "smasi_pdu.def"
  19.     SMASI_PDU_DUMMY_TYPE
  20. };
  21. typedef struct SMASI_PDU SMASI_PDU;
  22. struct SMASI_PDU {
  23.     unsigned long type;
  24.     const char *type_name;
  25.     unsigned int needs_hyphen;
  26.     union {
  27.     #define NONTERMINATED(name) Octstr *name;
  28.     #define COMATERMINATED(name) Octstr *name;
  29.     #define PDU(name, id, fields) struct name { fields } name;
  30.     #include "smasi_pdu.def"
  31.     } u;
  32. };
  33. /******************************************************************************
  34. * Numering Plan Indicator and Type of Number codes from
  35. * GSM 03.40 Version 5.3.0 Section 9.1.2.5.
  36. * http://www.etsi.org/
  37. */
  38. #define GSM_ADDR_TON_UNKNOWN          0x00000000
  39. #define GSM_ADDR_TON_INTERNATIONAL    0x00000001
  40. #define GSM_ADDR_TON_NATIONAL         0x00000002
  41. #define GSM_ADDR_TON_NETWORKSPECIFIC  0x00000003
  42. #define GSM_ADDR_TON_SUBSCRIBER       0x00000004
  43. #define GSM_ADDR_TON_ALPHANUMERIC     0x00000005 /* GSM TS 03.38 */
  44. #define GSM_ADDR_TON_ABBREVIATED      0x00000006
  45. #define GSM_ADDR_TON_EXTENSION        0x00000007 /* Reserved */
  46. #define GSM_ADDR_NPI_UNKNOWN          0x00000000
  47. #define GSM_ADDR_NPI_E164             0x00000001
  48. #define GSM_ADDR_NPI_X121             0x00000003
  49. #define GSM_ADDR_NPI_TELEX            0x00000004
  50. #define GSM_ADDR_NPI_NATIONAL         0x00000008
  51. #define GSM_ADDR_NPI_PRIVATE          0x00000009
  52. #define GSM_ADDR_NPI_ERMES            0x0000000A /* ETSI DE/PS 3 01-3 */
  53. #define GSM_ADDR_NPI_EXTENSION        0x0000000F /* Reserved */
  54. /******************************************************************************
  55.  * esm_class parameters
  56.  */
  57. #define ESM_CLASS_DEFAULT_SMSC_MODE        0x00000000
  58. #define ESM_CLASS_DATAGRAM_MODE            0x00000001
  59. #define ESM_CLASS_FORWARD_MODE             0x00000002
  60. #define ESM_CLASS_STORE_AND_FORWARD_MODE   0x00000003
  61. #define ESM_CLASS_DELIVERY_ACK             0x00000008
  62. #define ESM_CLASS_USER_ACK                 0x00000010
  63. #define ESM_CLASS_UDH_INDICATOR            0x00000040
  64. #define ESM_CLASS_RPI                      0x00000080
  65. #define ESM_CLASS_UDH_AND_RPI              0x000000C0
  66. SMASI_PDU *smasi_pdu_create(unsigned long type);
  67. void smasi_pdu_destroy(SMASI_PDU *pdu);
  68. int smasi_pdu_is_valid(SMASI_PDU *pdu); /* XXX */
  69. Octstr *smasi_pdu_pack(SMASI_PDU *pdu);
  70. SMASI_PDU *smasi_pdu_unpack(Octstr *data_without_len);
  71. void smasi_pdu_dump(SMASI_PDU *pdu);
  72. Octstr *smasi_pdu_read(Connection *conn);
  73. #endif