详谈短信开发-SMPP的WAP短信协议展开格式

WAP短信的SMPP的协议展开格式如下:

No.     Time                       Source                Destination           Protocol Length Info
   5753 2012-12-13 16:32:53.081911 10.8.14.20            10.64.14.1            MMSE     254    MMS m-notification-ind

Frame 5753: 254 bytes on wire (2032 bits), 254 bytes captured (2032 bits)
    Encapsulation type: Ethernet (1)
    Arrival Time: Dec 13, 2012 16:32:53.081911000 中国标准时间
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1355387573.081911000 seconds
    [Time delta from previous captured frame: 0.028159000 seconds]
    [Time delta from previous displayed frame: 5.195725000 seconds]
    [Time since reference or first frame: 137.117558000 seconds]
    Frame Number: 5753
    Frame Length: 254 bytes (2032 bits)
    Capture Length: 254 bytes (2032 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:ethertype:ip:tcp:smpp:gsm_sms_ud:wsp:mmse]
    [Coloring Rule Name: TCP]
    [Coloring Rule String: tcp]
Ethernet II, Src: CiscoInc_e7:89:41 (64:a0:e7:e7:89:41), Dst: IbmCorp_b6:cf:94 (5c:f3:fc:b6:cf:94)
    Destination: IbmCorp_b6:cf:94 (5c:f3:fc:b6:cf:94)
        Address: IbmCorp_b6:cf:94 (5c:f3:fc:b6:cf:94)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Source: CiscoInc_e7:89:41 (64:a0:e7:e7:89:41)
        Address: CiscoInc_e7:89:41 (64:a0:e7:e7:89:41)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 10.8.14.20 (10.8.14.20), Dst: 10.64.14.1 (10.64.14.1)
    Version: 4
    Header Length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
    Total Length: 240
    Identification: 0xf2d6 (62166)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 61
    Protocol: TCP (6)
    Header checksum: 0x19d5 [validation disabled]
        [Good: False]
        [Bad: False]
    Source: 10.8.14.20 (10.8.14.20)
    Destination: 10.64.14.1 (10.64.14.1)
    [Source GeoIP: Unknown]
    [Destination GeoIP: Unknown]
Transmission Control Protocol, Src Port: 32886 (32886), Dst Port: 12851 (12851), Seq: 33, Ack: 33, Len: 188
    Source Port: 32886 (32886)
    Destination Port: 12851 (12851)
    [Stream index: 138]
    [TCP Segment Len: 188]
    Sequence number: 33    (relative sequence number)
    [Next sequence number: 221    (relative sequence number)]
    Acknowledgment number: 33    (relative ack number)
    Header Length: 32 bytes
    .... 0000 0001 1000 = Flags: 0x018 (PSH, ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgment: Set
        .... .... 1... = Push: Set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
    Window size value: 1460
    [Calculated window size: 1460]
    [Window size scaling factor: -1 (unknown)]
    Checksum: 0xa6c3 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
    Urgent pointer: 0
    Options: (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
        No-Operation (NOP)
            Type: 1
                0... .... = Copy on fragmentation: No
                .00. .... = Class: Control (0)
                ...0 0001 = Number: No-Operation (NOP) (1)
        No-Operation (NOP)
            Type: 1
                0... .... = Copy on fragmentation: No
                .00. .... = Class: Control (0)
                ...0 0001 = Number: No-Operation (NOP) (1)
        Timestamps: TSval 72307162, TSecr 2014474617
            Kind: Time Stamp Option (8)
            Length: 10
            Timestamp value: 72307162
            Timestamp echo reply: 2014474617
    [SEQ/ACK analysis]
        [Bytes in flight: 188]
    [PDU Size: 188]
Short Message Peer to Peer, Command: Submit_sm, Seq: 36, Len: 188
    Length: 188
    Operation: Submit_sm (0x00000004)
    Sequence #: 36
    Service type: WAP
    Type of number (originator): Unknown (0x00)
    Numbering plan indicator (originator): ISDN (E163/E164) (0x01)
    Originator address: 5000
    Type of number (recipient): International (0x01)
    Numbering plan indicator (recipient): ISDN (E163/E164) (0x01)
    Recipient address: 959425000000
    .... ..00 = Messaging mode: Default SMSC mode (0x00)
    ..00 00.. = Message type: Default message type (0x00)
    01.. .... = GSM features: UDHI indicator (0x01)
    Protocol id.: 0x00
    Priority level: GSM: None      ANSI-136: Bulk         IS-95: Normal (0x00)
    Scheduled delivery time: Immediate delivery
    Validity period: SMSC default validity period
    .... ..01 = Delivery receipt: Delivery receipt requested (for success or failure) (0x01)
    .... 00.. = Message type: No recipient SME acknowledgement requested (0x00)
    ...0 .... = Intermediate notif: No intermediate notification requested (0x00)
    .... ...0 = Replace: Don't replace (0x00)
    Data coding: 0xf5
        SMPP Data Coding Scheme: Unknown (0xf5)
        GSM SMS Data Coding
        1111 .... = DCS Coding Group for SMS: SMS DCS: Data coding / message class (0x0f)
        .... 01.. = DCS Character set: 8-bit data (0x01)
        .... ..01 = DCS Message class: Class 1 - ME specific (0x01)
        GSM CBS Data Coding
        1111 .... = DCS Coding Group for CBS: SMS DCS: Data coding / message class (0x0f)
        .... 01.. = DCS Character set: 8-bit data (0x01)
        .... ..01 = DCS CBS Message class: Class 1 - User defined (0x01)
    Predefined message: 0
    Message length: 136
    Message
GSM Short Message Service User Data
    UDH Length: 11
        IE Id: SMS - Application port addressing scheme, 16 bit address (0x05): source port 9200, destination port 2948
            Destination port: 2948
            Source port: 9200
        IE Id: SMS - Concatenated short messages, 8-bit reference number (0x00): message 225, part 1 of 1
            Message identifier: 225
            Message parts: 1
            Message part number: 1
Wireless Session Protocol, Method: Push (0x06), Content-Type: application/vnd.wap.mms-message
    Transaction ID: 0x01
    PDU Type: Push (0x06)
    Headers Length: 40
    Content-Type: application/vnd.wap.mms-message
    Headers
        Push-Flag:  (Content trusted)
            .... ...0 = Initiator URI is authenticated: False (0)
            .... ..1. = Content is trusted: True (1)
            .... .0.. = Last push message: False (0)
        X-Wap-Application-Id: x-wap-application:mms.ua
        Content-Length: 81
MMS Message Encapsulation, Type: m-notification-ind
    X-Mms-Message-Type: m-notification-ind (0x82)
    X-Mms-Transaction-ID: MNPESW3WAAA
    X-Mms-MMS-Version: 1.0
    From: 959425000000
    X-Mms-Message-Class: Personal (0x80)
    X-Mms-Message-Size: 351
    X-Mms-Expiry: 259140.000000000 seconds
    X-Mms-Content-Location: http://mpt.mmsc.com/was/MNPESW3WA

对于wap的简单介绍:

      采用smpp发送wap短信时,除了短信体外,其他与长短信差不多,需要将Submit或Deliver消息中的esm_class设置为0X40,指示短信体内还有消息头;短信体则需要按照wap的标准进行编码,具体见规范wap-230-wsp-20010705-a及wap-259-wdp-20010614-a。

     以例子中的短信体进行分析:

0b 05 04 0b 84 23 f0 00 03 e1 01 01 01 06 28 1f  .....#........(.
20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 76 6e 64   application/vnd
2e 77 61 70 2e 6d 6d 73 2d 6d 65 73 73 61 67 65  .wap.mms-message
00 b4 82 af 84 8d d1 8c 82 98 4d 4e 50 45 53 57  ..........MNPESW
33 57 41 41 41 00 8d 90 89 0e 80 39 35 39 34 32  3WAAA......95942
35 30 30 30 30 30 30 00 8a 80 8e 02 01 5f 88 05  5000000......_..
81 03 03 f4 44 83 68 74 74 70 3a 2f 2f 6d 70 74  ....D.http://mpt
2e 6d 6d 73 63 2e 63 6f 6d 2f 77 61 73 2f 4d 4e  .mmsc.com/was/MN
50 45 53 57 33 57 41 00                          PESW3WA. 

其中WDP:0605040B8423F0

  # 06      | User-Data-Header (UDHL) Length = 6 bytes
  # 05      | UDH IE identifier: Port numbers
  # 04      | UDH port number IE length
  # 0B 84 | Destination port

  # 23 F0 | Originating port 

其中:0003e10101

   # 00 | UDH IE identifier: SAR
  # 03 | UDH SAR IE length
  # e1 | Datagram ref no.
  # 01 | Total number of segments in datagram
  # 01 | Segment count

WSP部分类似HTTP头域部分,指定一些头域信息。基本上就是Content-TypeContent-LengthPDU类型及流水号
WSP:0106281f206170706c696361

  # 01      | Transaction ID (流水号)

  # 06      | PDU type           (push)
  # 28      | Header length (头域部分长度,不包括PDU类型及流水号)
  # 1f20... | Content-type
  # 81 EA | charset=utf-8
  # 8D 4A | content-length: 74 wbxml部分长度)

最后就是WBXML的内容了:

0000   8c 82 98 64 73 6d 73 00 8d 90 89 15 80 2b 38 36  ...dsms......+86
0010   31 30 32 32 32 32 2f 54 59 50 45 3d 50 4c 4d 4e  102222/TYPE=PLMN
0020   00 8a 80 8e 03 00 8f 4f 88 05 81 03 01 51 80 83  .......O.....Q..
0030   68 74 74 70 3a 2f 2f 35 38 2e 32 34 30 2e 35 34  http://58.240.54
0040   2e 31 38 33 3a 35 31 33 37 38 2f 64 73 6d 73 2f  .183:51378/dsms/
0050   36 32 34 62 66 61 34 36 00                       624bfa46. 

MMS Message Encapsulation, Type: m-notification-ind
    X-Mms-Message-Type: m-notification-ind (0x82)
    X-Mms-Transaction-ID: MNPESW3WAAA
    X-Mms-MMS-Version: 1.0
    From: 959425000000
    X-Mms-Message-Class: Personal (0x80)
    X-Mms-Message-Size: 351
    X-Mms-Expiry: 259140.000000000 seconds
    X-Mms-Content-Location: http://mpt.mmsc.com/was/MNPESW3WA

WBXML的相关规范请参照WAP-192-WBXML-20010725-a等。

猜你喜欢

转载自blog.csdn.net/lzyzuixin/article/details/111316355