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

手机WAP编程

开发平台:

WINDOWS

  1. /*
  2.  * smpp_pdu.h - declarations for SMPP PDUs
  3.  *
  4.  * Lars Wirzenius
  5.  */
  6. #ifndef SMPP_PDU_H
  7. #define SMPP_PDU_H
  8. #include "gwlib/gwlib.h"
  9. enum {
  10.     #define INTEGER(name, octets)
  11.     #define NULTERMINATED(name, max_octets)
  12.     #define OCTETS(name, field_giving_octets)
  13.     #define PDU(name, id, fields) name = id,
  14.     #include "smpp_pdu.def"
  15.     SMPP_PDU_DUMMY_TYPE
  16. };
  17. typedef struct SMPP_PDU SMPP_PDU;
  18. struct SMPP_PDU {
  19.     unsigned long type;
  20.     const char *type_name;
  21.     union {
  22. #define INTEGER(name, octets) unsigned long name;
  23. #define NULTERMINATED(name, max_octets) Octstr *name;
  24. #define OCTETS(name, field_giving_octets) Octstr *name;
  25. #define PDU(name, id, fields) struct name { fields } name;
  26. #include "smpp_pdu.def"
  27.     } u;
  28. };
  29. /******************************************************************************
  30. * Numering Plan Indicator and Type of Number codes from 
  31. * GSM 03.40 Version 5.3.0 Section 9.1.2.5.
  32. * http://www.etsi.org/
  33. */
  34. #define GSM_ADDR_TON_UNKNOWN          0x00000000
  35. #define GSM_ADDR_TON_INTERNATIONAL    0x00000001
  36. #define GSM_ADDR_TON_NATIONAL         0x00000002
  37. #define GSM_ADDR_TON_NETWORKSPECIFIC  0x00000003
  38. #define GSM_ADDR_TON_SUBSCRIBER       0x00000004
  39. #define GSM_ADDR_TON_ALPHANUMERIC     0x00000005 /* GSM TS 03.38 */
  40. #define GSM_ADDR_TON_ABBREVIATED      0x00000006
  41. #define GSM_ADDR_TON_EXTENSION        0x00000007 /* Reserved */
  42. #define GSM_ADDR_NPI_UNKNOWN          0x00000000
  43. #define GSM_ADDR_NPI_E164             0x00000001 
  44. #define GSM_ADDR_NPI_X121             0x00000003
  45. #define GSM_ADDR_NPI_TELEX            0x00000004
  46. #define GSM_ADDR_NPI_NATIONAL         0x00000008
  47. #define GSM_ADDR_NPI_PRIVATE          0x00000009
  48. #define GSM_ADDR_NPI_ERMES            0x0000000A /* ETSI DE/PS 3 01-3 */
  49. #define GSM_ADDR_NPI_EXTENSION        0x0000000F /* Reserved */
  50. /******************************************************************************
  51.  * esm_class parameters for both submit_sm and deliver_sm PDUs
  52.  */
  53. #define ESM_CLASS_SUBMIT_DEFAULT_SMSC_MODE        0x00000000
  54. #define ESM_CLASS_SUBMIT_DATAGRAM_MODE            0x00000001
  55. #define ESM_CLASS_SUBMIT_FORWARD_MODE             0x00000002
  56. #define ESM_CLASS_SUBMIT_STORE_AND_FORWARD_MODE   0x00000003
  57. #define ESM_CLASS_SUBMIT_DELIVERY_ACK             0x00000008
  58. #define ESM_CLASS_SUBMIT_USER_ACK                 0x00000010
  59. #define ESM_CLASS_SUBMIT_UDH_INDICATOR            0x00000040
  60. #define ESM_CLASS_SUBMIT_RPI                      0x00000080
  61. #define ESM_CLASS_SUBMIT_UDH_AND_RPI              0x000000C0
  62. #define ESM_CLASS_DELIVER_DEFAULT_TYPE            0x00000000
  63. #define ESM_CLASS_DELIVER_SMSC_DELIVER_ACK        0x00000004
  64. #define ESM_CLASS_DELIVER_SME_DELIVER_ACK         0x00000008
  65. #define ESM_CLASS_DELIVER_SME_MANULAL_ACK         0x00000010
  66. #define ESM_CLASS_DELIVER_INTERM_DEL_NOTIFICATION 0x00000020
  67. SMPP_PDU *smpp_pdu_create(unsigned long type, unsigned long seq_no);
  68. void smpp_pdu_destroy(SMPP_PDU *pdu);
  69. int smpp_pdu_is_valid(SMPP_PDU *pdu); /* XXX */
  70. Octstr *smpp_pdu_pack(SMPP_PDU *pdu);
  71. SMPP_PDU *smpp_pdu_unpack(Octstr *data_without_len);
  72. void smpp_pdu_dump(SMPP_PDU *pdu);
  73. long smpp_pdu_read_len(Connection *conn);
  74. Octstr *smpp_pdu_read_data(Connection *conn, long len);
  75. #endif