DM protocol analysis.

Source: Internet
Author: User

The DM protocol consists of five steps (package0 ~ Package4), as shown in:

Note: package0 indicates that the server sends a notification to the terminal device. This step is not necessary. Many terminals do not always listen to connections from the server.

The entire process is divided into two phases: setup and management.
The management stage is composed of one or moreProtocol IterationComposition (so-calledProtocol IterationThat is, the terminal sends a message to the server, and then the server returns the message to the terminal ).
The content in the message packet sent from the server to the terminal determines whether the current session is to end. If the message package sent by the server contains a management command that requires the terminal to respond (the terminal returns a response through status or results in the returned message), in the management phase of the Protocol, the consumer sends a new message package to the server, which contains the terminal's response to the server's management commands. The client's response to the management command will start a newProtocol Iteration. Server can send a new management Command Message package, and therefore initialize the Server Multiple timesProtocol IterationProcess.

When the message package sent from the server to the terminal does not contain management commands, the producer will create a message package that only contains the status and synchdr responses and send it back to the server. At this time, do not send a response packet, and the protocol ends. The server must respond to all message packets of the terminal.

The message package to be processed may contain management commands that require a lot of time. Therefore, the SyncML DM protocol does not specify timeout when processing the message package.

If the management commands are not specifically described, the terminal and server can freely select the execution sequence of the management commands in the message package. However, if the execution order is specified in the Parent Management command, it must be executed in the order in which the management command is sent.

Both the terminal and the server can stop the session at any time in the session. The possible reasons for session suspension include shutdown on the server, shutdown on the terminal, and user interaction on the terminal. At this time, the abort party should send a session abort alert message. The message must also contain the status information of all the management commands being executed. The response of the receiver of this message is ignored and connection ends.

In some cases, session suspension is uncontrollable, for example, when the terminal is out of service or the battery is suddenly used up. The server and the terminal must be able to abort a session without a signal.

The terminal cannot send any management commands other than the replace command to the server.(The replace Command sent from the terminal to the server is only for DevInfo ).

Package 0: Initialize alert messages sent from the server to the terminal

Many terminal devices cannot continuously listen for connections from DM server. Some devices do not want to enable a port to accept connections from the security perspective. However, most devices can receive unrequested messages, which are sometimes called"Notification".

DM server can use"NotificationAllows the terminal to initiate a connection to the server. SyncML DM protocol 1.1 specifies several methods for managing the initialization notification message. You can find the definition and content of the notification message method in SyncML DM notification.

Note that there may be other ways to achieve the effect of receiving notification messages (this effect is to trigger the connection from the terminal to the server ). For example, the UI interface on the terminal device allows the user to start the connection from the terminal to the server; or when the terminal initiates a connection to the server beyond a certain date; or when an error occurs on the terminal, the terminal initiates a connection to the server.

Package 1: The terminal sends the initialization message package to the server.

The description of setup stage is almost the same as that in SyncML synchronization protocol.
The purpose of the initialization package sent by the client is:

  • Send device information (such as the manufacturer and model of the terminal device) to the DM server). This information is defined in syncml_dm_std_obj. The first message sent by the terminal to the server must contain the device information.
  • Server identification terminal device
  • Tell the server whether the current session is initiated by the server or by the terminal

The detailed requirements for terminal-to-Server Message package initialization are as follows:
1. synchdr element format requirements:

  • The verdtd value must be 1.1"
  • Verproto must be "dm/1.1"
  • Sessionid must be included to identify the ID of the current session. If the terminal is responding to the "Notification", the Alert Code is server-initiated Mgmt
    (1200), The sessionid must be the same as the one in the notification information. Otherwise, the terminal must generate a unique sessionid in the terminal. The sessionid of the entire session is the same.
  • Msgid identifies the message sent from the server to the client (the msgid in a message iteration is the same)
  • Target is used to identify the target device.
  • Source is used to identify the source device.
  • CRED may be included in the authentication message from the terminal to the server.

2. Alert must be included in syncbody, whether the current session is initiated by the terminal or by the server. The alert command requirements are as follows:

  • The consumer ID is required.
  • Data indicates the type of the current session, which can be server-initiated MGMT (1200) or client-initiated MGMT (1201)

3. The information of the terminal device must be indicated by the replace command in syncbody. The requirements for the replace command are as follows:

  • The consumer ID is required.
  • The objects corresponding to item can be found in the device information tree. All possible objects in the device information tree are defined in the syncml_dm_std_obj document.
  • The value of source in item identifies the URI of an object in the device information tree.
  • The value in data indicates the data corresponding to the device information.

4. Final must be included in syncbody, which is the last element of the message package.

Package 2: the server sends the initialization message package to the terminal.

The initialization message package sent by the server aims:

  • Action to identify the server to the terminal
  • Server can send user interaction commands (optional)
  • Server can send management data and commands (optional)

In package 2, you can disable the current session.
The detailed requirements of package 2 are as follows:
1. Requirements in synchdr

  • The verdtd value must be 1.1"
  • Verproto must be "dm/1.1"
  • Sessionid must be included to identify the ID of the current session.
  • Msgid identifies the message sent from the server to the client (the msgid in a message iteration is the same)
  • Target is used to identify the target device.
  • Source is used to identify the source device.
  • CRED may be included in the authentication message. The server always verifies the terminal device, although the transport layer may have completed the verification.

2. For the synchdr and alert commands sent by the response terminal, syncbody must contain status

3. Any management commands, including user interaction, are stored in syncbody.

  • The consumer ID is required.
  • Source is required
  • Target is required
  • If the current command is not delete, data contains the data of the current command.
  • The management command or item must contain meta to indicate the current data type.

4. Final must be included in syncbody, which is the last element of the message package.

Package 3: The terminal responds to the server

The content of package 3 is:

  • The running result of the management command sent by the server to the terminal
  • User interaction command running result

When package 2 contains a management command that requires the terminal to respond, the terminal sends package 3 to the server.
The detailed requirements of package 3 are as follows:
1. synchdr requirements:

  • The verdtd value must be 1.1"
  • Verproto must be "dm/1.1"
  • Sessionid must be included to identify the ID of the current session.
  • Msgid identifies the message sent from the server to the client (the msgid in a message iteration is the same)
  • Target is used to identify the target device.
  • Source is used to identify the source device.
  • Status must be included to identify whether the server has successfully authenticated the current terminal. The cmdref in status must be synchdr.

2. The syncbody must contain the status corresponding to the synchdr and alert commands sent from the server.

3. The syncbody must contain the status corresponding to the management command in package 2 sent by the server.

4. If package 2 contains the GET command, syncbody must contain the corresponding results. Results must contain meta (meta contains type and format) to describe the data content.

5. Final must be included in syncbody, which is the last element of the message package.

Package 4: more server management commands

Package 4 is often used to close management sessions. If the server sends any management command in package 4 that requires terminal response, the Protocol starts a new protocol iteration process from package 3.

The detailed requirements of Package 4 are as follows:
1. synchdr requirements:

  • The verdtd value must be 1.1"
  • Verproto must be "dm/1.1"
  • Sessionid must be included to identify the ID of the current session.
  • Msgid identifies the message sent from the server to the client (the msgid in a message iteration is the same)
  • Target is used to identify the target device.
  • Source is used to identify the source device.

2. corresponding to the synchrd sent by the server, the status must be included in the syncbody

3. Any management commands (including user interaction commands) are stored in syncbody

  • The consumer ID is required.
  • Source is required
  • Target is required
  • If the current command is not delete, data contains the data of the current command.
  • The management command or item must contain meta to indicate the current data type.

4. Final must be included in syncbody, which is the last element of the message package.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.