next up previous contents
: OX stack machine : Communication model of OpenXM : Expression of OX messages   ܼ

Standard encoding of OXexpressions and an implementation by TCP/IP sockets

The logical structure of OX messages are independent of implementations of communication. The OXexpression represents the logical structure. Here we explain an outline of the standard encoding scheme of OXexpression. This encoding scheme is used to implement OpenXM protocols on TCP/IP sockets. In addition, we also explain the control messages to control stack machines.

As the socket connection is peer to peer, destination and origin are omitted. The extension field is placed after the message_tag field. The extension field consists of the serial number for OX message, which is int32. The serial number is used to identify an OX message which caused an error on a server. In the following we regard the extension as a component of the message_tag field and omit the extension field. Thus OX messages are represented as follows.

ox message_tag message_body

More precisely it has the following representation.

ox message_tag, serial number message_body

As ox message_tag the following are provided.


#define   OX_COMMAND         513
#define   OX_DATA            514

#define   OX_DATA_WITH_LENGTH  521
#define   OX_DATA_OPENMATH_XML 523
#define   OX_DATA_MP           525

#define   OX_SYNC_BALL       515
#define   OX_NOTIFY          516

Two streams are provided for communication between a client and a server. One is the stream to exchange data and to send stack machine commands. The other is the stream to control stack machines. Messages on the latter stream are called control messages and results of control messages. The sample server implements the above two streams by using two ports on TCP/IP.

The stack machine command message has the following forms:

OX_COMMAND int32 function_id
message_tag message_body
,      (OX_COMMAND, (SM_*))

CMO data message has the following form:
message_tag message_body
,      (OX_DATA, CMObject data)

The control message has the following form:
OX_COMMAND int32 function_id
,      (OX_COMMAND,(SM_control_*))

The control message is used to interrupt a computation, to invoke debugging threads, or to exit form the debugging mode.

The result of a control message has the following form:
OX_DATA CMO_INT32 int32 data
,      (OX_DATA, Integer32 n)

int32 function_id is the value of a stack machine command. SM tags in SMobject/Primitive and SMobject/Basic and corresponding values are as follows.


#define SM_popSerializedLocalObject 258
#define SM_popCMO 262
#define SM_popString 263 

#define SM_mathcap 264
#define SM_pops 265
#define SM_setName 266
#define SM_evalName 267 
#define SM_executeStringByLocalParser 268 
#define SM_executeFunction 269
#define SM_beginBlock  270
#define SM_endBlock    271
#define SM_shutdown    272
#define SM_setMathCap  273
#define SM_executeStringByLocalParserInBatchMode 274
#define SM_getsp       275
#define SM_dupErrors   276

#define SM_control_kill 1024
#define SM_control_reset_connection  1030

For example


is encoded as follows.

int32 513 int32 265

The details of the operators are described in Section 5. Names of these constants may be represented by abbreviated forms.

next up previous contents
: OX stack machine : Communication model of OpenXM : Expression of OX messages   ܼ
Nobuki Takayama Heisei 28.8.27.