

















              TThhee XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn


                        RReevviissiioonn 00..11

                  XX VVeerrssiioonn 1111,, RReelleeaassee 77

                        lliibbXX1111 11..33..22




                      _T_a_k_a_s_h_i _F_u_j_i_w_a_r_a
                      FUJITSU LIMITED





                          _A_B_S_T_R_A_C_T

     This specification describes the transport layer
     interfaces between Xlib and IM Server, which makes
     various channels usable such as X protocol or,
     TCP/IP, DECnet and etc.







































Copyright © 1994 by FUJITSU LIMITED

Permission to use, copy, modify, and distribute this docu­
mentation for any purpose and without fee is hereby granted,
provided that the above copyright notice and this permission
notice appear in all copies.  Fujitsu makes no representa­
tions about the suitability for any purpose of the informa­
tion in this document.  This documentation is provided as is
without express or implied warranty.





Copyright © 1994 X Consortium

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documenta­
tion files (the ‘‘Software’’), to deal in the Software with­
out restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to
whom the Software is furnished to do so, subject to the fol­
lowing conditions:

The above copyright notice and this permission notice shall
be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED ‘‘AS IS’’, WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PUR­
POSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE X CONSOR­
TIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Con­
sortium shall not be used in advertising or otherwise to
promote the sale, use or other dealings in this Software
without prior written authorization from the X Consortium.














_X _W_i_n_d_o_w _S_y_s_t_e_m is a trademark of The Open Group.

































































11..  IInnttrroodduuccttiioonn

The Xlib XIM implementation is layered into three functions,
a protocol layer, an interface layer and a transport layer.
The purpose of this layering is to make the protocol inde­
pendent of transport implementation.  Each function of these
layers are:

     _T_h_e _p_r_o_t_o_c_o_l _l_a_y_e_r
          implements overall function of XIM and calls the
          interface layer functions when it needs to commu­
          nicate to IM Server.

     _T_h_e _i_n_t_e_r_f_a_c_e _l_a_y_e_r
          separates the implementation of the transport
          layer from the protocol layer, in other words, it
          provides implementation independent hook for the
          transport layer functions.

     _T_h_e _t_r_a_n_s_p_o_r_t _l_a_y_e_r
          handles actual data communication with IM Server.
          It is done by a set of several functions named
          transporters.

This specification describes the interface layer and the
transport layer, which makes various communication channels
usable such as X protocol or, TCP/IP, DECnet, STREAM, etc.,
and provides the information needed for adding another new
transport layer.  In addition, sample implementations for
the transporter using the X connection is described in sec­
tion 4.

22..  IInniittiiaalliizzaattiioonn

22..11..  RReeggiisstteerriinngg ssttrruuccttuurree ttoo iinniittiiaalliizzee

The structure typed as TransportSW contains the list of the
transport layer the specific implementations supports.


typedef struct {
      char *transport_name;
      Bool (*config);
} TransportSW;



_t_r_a_n_s_p_o_r_t___n_a_m_e name of transport(*1)

_c_o_n_f_i_g         initial configuration function

-----------
(*1) Refer to "The Input Method Protocol: Appendix
B"



                              11





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


A sample entry for the Xlib supporting transporters is shown
below:


TransportSW _XimTransportRec[] = {
/*   char _*_:
 _*   _t_r_a_n_s_p_o_r_t___n_a_m_e,     Bool _(_*_c_o_n_f_i_g_)_(_)
 */
     ‘‘X’’,              _XimXConf,
     ‘‘tcp’’,            _XimTransConf,
     ‘‘local’’,          _XimTransConf,
     ‘‘decnet’’,         _XimTransConf,
     ‘‘streams’’,        _XimTransConf,
     (char *)NULL,       (Bool (*)())NULL,
};



22..22..  IInniittiiaalliizzaattiioonn ffuunnccttiioonn

The following function will be called once when Xlib config­
ures the transporter functions.

Bool (*config)(_i_m, _t_r_a_n_s_p_o_r_t___d_a_t_a)
      XIM _i_m;
      char _*_t_r_a_n_s_p_o_r_t___d_a_t_a;


_i_m        Specifies XIM structure address.

_t_r_a_n_s_p_o_r_t___d_a_t_a
          Specifies the data specific to the transporter, in
          IM Server address. (*1)

This function must setup the transporter function pointers.

The actual _c_o_n_f_i_g function will be chosen by IM Server at
the pre‐connection time, matching by the _t_r_a_n_s_p_o_r_t___n_a_m_e
specified in the __XXiimmTTrraannssppoorrttRReecc array; The specific mem­
bers of XimProto structure listed below must be initialized
so that point they appropriate transporter functions.

If the specified transporter has been configured success­
fully, this function returns True. There is no Alternative
Entry for config function itself.

The structure XimProto contains the following function
pointers:



-----------
(*1) Refer to "The Input Method Protocol: Appendix
B"



                              22





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


     Bool (*connect)();       /* Open connection */
     Bool (*shutdown)();      /* Close connection */
     Bool (*write)();         /* Write data */
     Bool (*read)();          /* Read data */
     Bool (*flush)();         /* Flush data buffer */
     Bool (*register_dispatcher)();/* Register asynchronous data handler */
     Bool (*call_dispatcher)();/* Call dispatcher */

These functions are called when Xlib needs to communicate
the IM Server. These functions must process the appropriate
procedure described below.


33..  TThhee iinntteerrffaaccee//ttrraannssppoorrtt llaayyeerr ffuunnccttiioonnss

Following functions are used for the transport interface.

         Table 3‐1; The Transport Layer Functions.

 +-----------------------+---------------------+----------+
 |  AAlltteerrnnaattiivvee EEnnttrryy    |   XXiimmPPrroottoo mmeemmbbeerr   | SSeeccttiioonn  |
 |  ((IInntteerrffaaccee LLaayyeerr))    |  ((TTrraannssppoorrtt LLaayyeerr))  |          |
 +-----------------------+---------------------+----------+
 |__XXiimmCCoonnnneecctt            | connect             |   3.1    |
 +-----------------------+---------------------+----------+
 |__XXiimmSShhuuttddoowwnn           | shutdown            |   3.2    |
 +-----------------------+---------------------+----------+
 |__XXiimmWWrriittee              | write               |   3.3    |
 +-----------------------+---------------------+----------+
 |__XXiimmRReeaadd               | read                |   3.4    |
 +-----------------------+---------------------+----------+
 |__XXiimmFFlluusshh              | flush               |   3.5    |
 +-----------------------+---------------------+----------+
 |__XXiimmRReeggiisstteerrDDiissppaattcchheerr | register_dispatcher |   3.6    |
 +-----------------------+---------------------+----------+
 |__XXiimmCCaallllDDiissppaattcchheerr     | call_dispatcher     |   3.7    |
 +-----------------------+---------------------+----------+

The Protocol layer calls the above functions using the
Alternative Entry in the left column. The transport imple­
mentation defines XimProto member function in the right col­
umn. The Alternative Entry is provided so as to make easier
to implement the Protocol Layer.


33..11..  OOppeenniinngg ccoonnnneeccttiioonn

When XXOOppeennIIMM is called, the following function is called to
connect with the IM Server.

Bool (*connect)(_i_m)
      XIM _i_m;





                              33





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


_i_m        Specifies XIM structure address.

This function must establishes the connection to the IM
Server. If the connection is established successfully, this
function returns True.  The Alternative Entry for this func­
tion is:

Bool _XimConnect(_i_m)
      XIM _i_m;


_i_m        Specifies XIM structure address.


33..22..  CClloossiinngg ccoonnnneeccttiioonn

When XXCClloosseeIIMM is called, the following function is called to
disconnect the connection with the IM Server. The Alterna­
tive Entry for this function is:

Bool (*shutdown)(_i_m)
      XIM _i_m;


_i_m        Specifies XIM structure address.

This function must close connection with the IM Server. If
the connection is closed successfully, this function returns
True. The Alternative Entry for this function is:

Bool _XimShutdown(_i_m)
      XIM _i_m;


_i_m   Specifies XIM structure address.


33..33..  WWrriittiinngg ddaattaa

The following function is called, when Xlib needs to write
data to the IM Server.

Bool (*write)(_i_m, _l_e_n, _d_a_t_a)
      XIM _i_m;
      INT16 _l_e_n;
      XPointer _d_a_t_a;


_i_m        Specifies XIM structure address.

_l_e_n       Specifies the length of writing data.

_d_a_t_a      Specifies the writing data.




                              44





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


This function writes the _d_a_t_a to the IM Server, regardless
of the contents.  The number of bytes is passed to _l_e_n. The
writing data is passed to _d_a_t_a. If data is sent success­
fully, the function returns True. Refer to "The Input Method
Protocol" for the contents of the writing data. The Alterna­
tive Entry for this function is:

Bool _XimWrite(_i_m, _l_e_n, _d_a_t_a)
      XIM _i_m;
      INT16 _l_e_n;
      XPointer _d_a_t_a;


_i_m        Specifies XIM structure address.

_l_e_n       Specifies the length of writing data.

_d_a_t_a      Specifies the writing data.


33..44..  RReeaaddiinngg ddaattaa

The following function is called when Xlib waits for
response from IM server synchronously.

Bool (*read)(_i_m, _r_e_a_d___b_u_f, _b_u_f___l_e_n, _r_e_t___l_e_n)
      XIM _i_m;
      XPointer _r_e_a_d___b_u_f;
      int _b_u_f___l_e_n;
      int _*_r_e_t___l_e_n;


_i_m        Specifies XIM structure address.

_r_e_a_d___b_u_f  Specifies the buffer to store data.

_b_u_f___l_e_n   Specifies the size of the _b_u_f_f_e_r

_r_e_t___l_e_n   Specifies the length of stored data.

This function stores the read data in _r_e_a_d___b_u_f, which size
is specified as _b_u_f___l_e_n. The size of data is set to _r_e_t___l_e_n.
This function return True, if the data is read normally or
reading data is completed.

The Alternative Entry for this function is:











                              55





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


Bool _XimRead(_i_m, _r_e_t___l_e_n, _b_u_f, _b_u_f___l_e_n, _p_r_e_d_i_c_a_t_e, _p_r_e_d_i_c_a_t_e___a_r_g)
      XIM _i_m;
      INT16 _*_r_e_t___l_e_n;
      XPointer _b_u_f;
      int _b_u_f___l_e_n;
      Bool _(_*_p_r_e_d_i_c_a_t_e_)_(_);
      XPointer _p_r_e_d_i_c_a_t_e___a_r_g;


_i_m        Specifies XIM structure address.

_r_e_t___l_e_n   Specifies the size of the _d_a_t_a buffer.

_b_u_f       Specifies the buffer to store data.

_b_u_f___l_e_n   Specifies the length of _b_u_f_f_e_r.

_p_r_e_d_i_c_a_t_e Specifies the predicate for the XIM data.

_p_r_e_d_i_c_a_t_e___a_r_g
          Specifies the predicate specific data.

The predicate procedure indicates whether the _d_a_t_a is for
the XIM or not. _l_e_n This function stores the read data in
_b_u_f, which size is specified as _b_u_f___l_e_n. The size of data is
set to _r_e_t___l_e_n.  If _p_r_e_e_d_i_c_a_t_e_(_) returns True, this function
returns True.  If not, it calls the registered callback
function.

The procedure and its arguments are:


Bool (*predicate)(_i_m, _l_e_n, _d_a_t_a, _p_r_e_d_i_c_a_t_e___a_r_g)
      XIM _i_m;
      INT16 _l_e_n;
      XPointer _d_a_t_a;
      XPointer _p_r_e_d_i_c_a_t_e___a_r_g;


_i_m        Specifies XIM structure address.

_l_e_n       Specifies the size of the _d_a_t_a buffer.

_d_a_t_a      Specifies the buffer to store data.

_p_r_e_d_i_c_a_t_e___a_r_g
          Specifies the predicate specific data.


33..55..  FFlluusshhiinngg bbuuffffeerr

The following function is called when Xlib needs to flush
the data.




                              66





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


void (*flush)(_i_m)
      XIM _i_m;


_i_m        Specifies XIM structure address.

This function must flush the data stored in internal buffer
on the transport layer. If data transfer is completed, the
function returns True.  The Alternative Entry for this func­
tion is:

void _XimFlush(_i_m)
      XIM _i_m;


_i_m        Specifies XIM structure address.


33..66..  RReeggiisstteerriinngg aassyynncchhrroonnoouuss ddaattaa hhaannddlleerr

Xlib needs to handle asynchronous response from IM Server.
This is because some of the XIM data occur asynchronously to
X events.

Those data will be handled in the _F_i_l_t_e_r, and the _F_i_l_t_e_r
will call asynchronous data handler in the protocol layer.
Then it calls dispatchers in the transport layer. The dis­
patchers are implemented by the protocol layer. This func­
tion must store the information and prepare for later call
of the dispatchers using __XXiimmCCaallllDDiissppaattcchheerr.

When multiple dispatchers are registered, they will be
called sequentially in order of registration, on arrival of
asynchronous data. The register_dispatcher is declared as
following:

Bool (*register_dispatcher)(_i_m, _d_i_s_p_a_t_c_h_e_r, _c_a_l_l___d_a_t_a)
      XIM _i_m;
      Bool _(_*_d_i_s_p_a_t_c_h_e_r_)_(_);
      XPointer _c_a_l_l___d_a_t_a;


_i_m        Specifies XIM structure address.

_d_i_s_p_a_t_c_h_e_r
          Specifies the dispatcher function to register.

_c_a_l_l___d_a_t_a Specifies a parameter for the _d_i_s_p_a_t_c_h_e_r.

The dispatcher is a function of the following type:







                              77





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


Bool (*dispatcher)(_i_m, _l_e_n, _d_a_t_a, _c_a_l_l___d_a_t_a)
      XIM _i_m;
      INT16 _l_e_n;
      XPointer _d_a_t_a;
      XPointer _c_a_l_l___d_a_t_a;


_i_m        Specifies XIM structure address.

_l_e_n       Specifies the size of the _d_a_t_a buffer.

_d_a_t_a      Specifies the buffer to store data.

_c_a_l_l___d_a_t_a Specifies a parameter passed to the register_dis­
          patcher.

The dispatcher is provided by the protocol layer. They are
called once for every asynchronous data, in order of regis­
tration. If the data is used, it must return True. other­
wise, it must return False.

If the dispatcher function returns True, the Transport Layer
assume that the data has been processed by the upper layer.
The Alternative Entry for this function is:

Bool _XimRegisterDispatcher(_i_m, _d_i_s_p_a_t_c_h_e_r, _c_a_l_l___d_a_t_a)
      XIM _i_m;
      Bool _(_*_d_i_s_p_a_t_c_h_e_r_)_(_);
      XPointer _c_a_l_l___d_a_t_a;


_i_m        Specifies XIM structure address.

_d_i_s_p_a_t_c_h_e_r
          Specifies the dispatcher function to register.

_c_a_l_l___d_a_t_a Specifies a parameter for the _d_i_s_p_a_t_c_h_e_r.


33..77..  CCaalllliinngg ddiissppaattcchheerr

The following function is used to call the registered dis­
patcher function, when the asynchronous response from IM
Server has arrived.

Bool (*call_dispatcher)(_i_m, _l_e_n, _d_a_t_a)
      XIM _i_m;
      INT16 _l_e_n;
      XPointer _d_a_t_a;


_i_m        Specifies XIM structure address.





                              88





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


_l_e_n       Specifies the size of _d_a_t_a buffer.

_d_a_t_a      Specifies the buffer to store data.

The call_dispatcher must call the dispatcher function, in
order of their registration. _l_e_n and _d_a_t_a are the data
passed to register_dispatcher.

The return values are checked at each invocation, and if it
finds True, it immediately return with true for its return
value.

It is depend on the upper layer whether the read data is XIM
Protocol packet unit or not.  The Alternative Entry for this
function is:

Bool _XimCallDispatcher(_i_m, _l_e_n, _d_a_t_a)
      XIM _i_m;
      INT16 _l_e_n;
      XPointer _c_a_l_l___d_a_t_a;





































                              99





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


44..  SSaammppllee iimmpplleemmeennttaattiioonnss ffoorr tthhee TTrraannssppoorrtt LLaayyeerr

Sample implementations for the transporter using the X con­
nection is described here.


44..11..  XX TTrraannssppoorrtt

At the beginning of the X Transport connection for the XIM
transport mechanism, two different windows must be created
either in an Xlib XIM or in an IM Server, with which the
Xlib and the IM Server exchange the XIM transports by using
the ClientMessage events and Window Properties.  In the fol­
lowing, the window created by the Xlib is referred as the
"client communication window", and on the other hand, the
window created by the IM Server is referred as the "IMS com­
munication window".


44..11..11..  CCoonnnneeccttiioonn

In order to establish a connection, a communication window
is created.  A ClientMessage in the following event’s format
is sent to the owner window of XIM_SERVER selection, which
the IM Server has created.

Refer to "The Input Method Protocol" for the XIM_SERVER
atom.

    Table 4‐1; The ClientMessage sent to the IMS window.

-----------------------+------------------------------------------------
SSttrruuccttuurree MMeemmbbeerr       | CCoonntteennttss
-----------------------+------------------------------------------------
int       type         | ClientMessage
u_long    serial       | Set by the X Window System
Bool      send_event   | Set by the X Window System
Display   *display     | The display to which connects
Window    window       | IMS Window ID
Atom      message_type | XInternAtom(display, ‘‘_XIM_XCONNECT’’, False)
int       format       | 32
long      data.l[0]    | client communication window ID
long      data.l[1]    | client‐major‐transport‐version (*1)
long      data.l[2]    | client‐major‐transport‐version (*1)
-----------------------+------------------------------------------------


In order to establish the connection (to notify the IM
Server communication window), the IM Server sends a
ClientMessage in the following event’s format to the client
communication window.

      Table 4‐2; The ClientMessage sent by IM Server.




                             1100





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


-----------------------+-------------------------------------------------------
SSttrruuccttuurree MMeemmbbeerr       | CCoonntteennttss
-----------------------+-------------------------------------------------------
int       type         | ClientMessage
u_long    serial       | Set by the X Window System
Bool      send_event   | Set by the X Window System
Display   *display     | The display to which connects
Window    window       | client communication window ID
Atom      message_type | XInternAtom(display, ‘‘_XIM_XCONNECT’’, False)
int       format       | 32
long      data.l[0]    | IMS communication window ID
long      data.l[1]    | server‐major‐transport‐version (*1)
long      data.l[2]    | server‐minor‐transport‐version (*1)
long      data.l[3]    | dividing size between ClientMessage and Property (*2)
-----------------------+-------------------------------------------------------



(*1) major/minor‐transport‐version
          The read/write method is decided by the combina­
          tion of major/minor‐transport‐version, as follows:

     Table 4‐3; The read/write method and the major/minor‐transport‐version

   +------------------+---------------------------------------+
   |TTrraannssppoorrtt‐‐vveerrssiioonn | rreeaadd//wwrriittee                            |
   +--------+---------+---------------------------------------+
   | mmaajjoorr  |  mmiinnoorr  |                                       |
   +--------+---------+---------------------------------------+
   |   0    |    0    | only‐CM & Property‐with‐CM            |
   |        |    1    | only‐CM & multi‐CM                    |
   |        |    2    | only‐CM & multi‐CM & Property‐with‐CM |
   +--------+---------+---------------------------------------+
   |   1    |    0    | PropertyNotify                        |
   +--------+---------+---------------------------------------+
   |   2    |    0    | only‐CM & PropertyNotify              |
   |        |    1    | only‐CM & multi‐CM & PropertyNotify   |
   +--------+---------+---------------------------------------+



   only‐CM            :   data is sent via a ClientMessage
   multi‐CM           :   data is sent via multiple ClientMessages
   Property‐with‐CM   :   data is written in Property, and its Atom
                          is send via ClientMessage
   PropertyNotify     :   data is written in Property, and its Atom
                          is send via PropertyNotify


     The method to decide major/minor‐transport‐version is
     as follows:






                             1111





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


     (1)  The client sends 0 as major/minor‐transport‐ver­
          sion to the IM Server.  The client must support
          all methods in Table 4‐3.  The client may send
          another number as major/minor‐transport‐version to
          use other method than the above in the future.

     (2)  The IM Server sends its major/minor‐transport‐ver­
          sion number to the client. The client sends data
          using the method specified by the IM Server.

     (3)  If major/minor‐transport‐version number is not
          available, it is regarded as 0.


(*2) dividing size between ClientMessage and Property
          If data is sent via both of multi‐CM and Property,
          specify the dividing size between ClientMessage
          and Property. The data, which is smaller than this
          size, is sent via multi‐CM (or only‐CM), and the
          data, which is lager than this size, is sent via
          Property.


44..11..22..  rreeaadd//wwrriittee

The data is transferred via either ClientMessage or Window
Property in the X Window System.


44..11..22..11..  FFoorrmmaatt ffoorr tthhee ddaattaa ffrroomm tthhee CClliieenntt ttoo tthhee IIMM
SSeerrvveerr

CClliieennttMMeessssaaggee

     If data is sent via ClientMessage event, the format is
     as follows:

     Table 4‐4; The ClientMessage event’s format (first or middle)

     -----------------------+------------------------------------------------
     SSttrruuccttuurree MMeemmbbeerr       | CCoonntteennttss
     -----------------------+------------------------------------------------
     int       type         | ClientMessage
     u_long    serial       | Set by the X Window System
     Bool      send_event   | Set by the X Window System
     Display   *display     | The display to which connects
     Window    window       | IMS communication window ID
     Atom      message_type | XInternAtom(display, ‘‘_XIM_MOREDATA’’, False)
     int       format       | 8
     char      data.b[20]   | (read/write DATA : 20 byte)
     -----------------------+------------------------------------------------






                             1122





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


     Table 4‐5; The ClientMessage event’s format (only or last)

     -----------------------+------------------------------------------------
     SSttrruuccttuurree MMeemmbbeerr       | CCoonntteennttss
     -----------------------+------------------------------------------------
     int       type         | ClientMessage
     u_long    serial       | Set by the X Window System
     Bool      send_event   | Set by the X Window System
     Display   *display     | The display to which connects
     Window    window       | IMS communication window ID
     Atom      message_type | XInternAtom(display, ‘‘_XIM_PROTOCOL’’, False)
     int       format       | 8
     char      data.b[20]   | (read/write DATA : MAX 20 byte)  (*1)
     -----------------------+------------------------------------------------


     (*1) If the data is smaller than 20 byte, all data
          other than available data must be 0.

PPrrooppeerrttyy

     In the case of large data, data will be sent via the
     Window Property for the efficiency.  There are the fol­
     lowing two methods to notify Property, and transport‐
     version is decided which method is used.


     (1)  The XChangeProperty function is used to store data
          in the client communication window, and Atom of
          the stored data is notified to the IM Server via
          ClientMessage event.

     (2)  The XChangeProperty function is used to store data
          in the client communication window, and Atom of
          the stored data is notified to the IM Server via
          PropertyNotify event.

     The arguments of the XChangeProperty are as follows:

          Table 4‐6; The XChangeProperty event’s format

     --------------------+--------------------------------
     AArrgguummeenntt            | CCoonntteennttss
     --------------------+--------------------------------
     Display   *display  | The display to which connects
     Window    window    | IMS communication window ID
     Atom      property  | read/write property Atom (*1)
     Atom      type      | XA_STRING
     int       format    | 8
     int       mode      | PropModeAppend
     u_char    *data     | read/write DATA
     int       nelements | length of DATA
     --------------------+--------------------------------




                             1133





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


     (*1) The read/write property ATOM allocates the follow­
          ing strings by XXIInntteerrnnAAttoomm.
               ‘‘_clientXXX’’

     The client changes the property with the mode of Prop­
     ModeAppend and the IM Server will read it with the
     delete mode i.e. (delete = True).

     If Atom is notified via ClientMessage event, the format
     of the ClientMessage is as follows:

     Table 4‐7; The ClientMessage event’s format to send
                        Atom of property

     -----------------------+------------------------------------------------
     SSttrruuccttuurree MMeemmbbeerr       | CCoonntteennttss
     -----------------------+------------------------------------------------
     int       type         | ClientMessage
     u_long    serial       | Set by the X Window System
     Bool      send_event   | Set by the X Window System
     Display   *display     | The display to which connects
     Window    window       | IMS communication window ID
     Atom      message_type | XInternAtom(display, ‘‘_XIM_PROTOCOL’’, False)
     int       format       | 32
     long      data.l[0]    | length of read/write property Atom
     long      data.l[1]    | read/write property Atom
     -----------------------+------------------------------------------------



44..11..22..22..  FFoorrmmaatt ffoorr tthhee ddaattaa ffrroomm tthhee IIMM SSeerrvveerr ttoo tthhee
CClliieenntt

CClliieennttMMeessssaaggee

     The format of the ClientMessage is as follows:

     Table 4‐8; The ClientMessage event’s format (first or middle)

     -----------------------+------------------------------------------------
     SSttrruuccttuurree MMeemmbbeerr       | CCoonntteennttss
     -----------------------+------------------------------------------------
     int       type         | ClientMessage
     u_long    serial       | Set by the X Window System
     Bool      send_event   | Set by the X Window System
     Display   *display     | The display to which connects
     Window    window       | client communication window ID
     Atom      message_type | XInternAtom(display, ‘‘_XIM_MOREDATA’’, False)
     int       format       | 8
     char      data.b[20]   | (read/write DATA : 20 byte)
     -----------------------+------------------------------------------------






                             1144





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


     Table 4‐9; The ClientMessage event’s format (only or last)

     -----------------------+------------------------------------------------
     SSttrruuccttuurree MMeemmbbeerr       | CCoonntteennttss
     -----------------------+------------------------------------------------
     int       type         | ClientMessage
     u_long    serial       | Set by the X Window System
     Bool      send_event   | Set by the X Window System
     Display   *display     | The display to which connects
     Window    window       | client communication window ID
     Atom      message_type | XInternAtom(display, ‘‘_XIM_PROTOCOL’’, False)
     int       format       | 8
     char      data.b[20]   | (read/write DATA : MAX 20 byte) (*1)
     -----------------------+------------------------------------------------



     (*1) If the data size is smaller than 20 bytes, all
          data other than available data must be 0.

PPrrooppeerrttyy

     In the case of large data, data will be sent via the
     Window Property for the efficiency. There are the fol­
     lowing two methods to notify Property, and transport‐
     version is decided which method is used.


     (1)  The XChangeProperty function is used to store data
          in the IMS communication window, and Atom of the
          property is sent via the ClientMessage event.

     (2)  The XChangeProperty function is used to store data
          in the IMS communication window, and Atom of the
          property is sent via PropertyNotify event.

     The arguments of the XChangeProperty are as follows:

         Table 4‐10; The XChangeProperty event’s format

     --------------------+----------------------------------
     AArrgguummeenntt            | CCoonntteennttss
     --------------------+----------------------------------
     Display   *display  | The display which to connects
     Window    window    | client communication window ID
     Atom      property  | read/write property Atom (*1)
     Atom      type      | XA_STRING
     int       format    | 8
     int       mode      | PropModeAppend
     u_char    *data     | read/write DATA
     int       nelements | length of DATA
     --------------------+----------------------------------





                             1155





XXIIMM TTrraannssppoorrtt SSppeecciiffiiccaattiioonn                     lliibbXX1111 11..33..22


     (*1) The read/write property ATOM allocates some
          strings, which are not allocated by the client, by
          XXIInntteerrnnAAttoomm.

     The IM Server changes the property with the mode of
     PropModeAppend and the client reads it with the delete
     mode, i.e. (delete = True).

     If Atom is notified via ClientMessage event, the format
     of the ClientMessage is as follows:

     Table 4‐11; The ClientMessage event’s format to send
                        Atom of property

     -----------------------+------------------------------------------------
     SSttrruuccttuurree MMeemmbbeerr       | CCoonntteennttss
     -----------------------+------------------------------------------------
     int       type         | ClientMessage
     u_long    serial       | Set by the X Window System
     Bool      send_event   | Set by the X Window System
     Display   *display     | The display to which connects
     Window    window       | client communication window ID
     Atom      message_type | XInternAtom(display, ‘‘_XIM_PROTOCOL’’, False)
     int       format       | 32
     long      data.l[0]    | length of read/write property ATOM
     long      data.l[1]    | read/write property ATOM
     -----------------------+------------------------------------------------



44..11..33..  CClloossiinngg CCoonnnneeccttiioonn

If the client disconnect with the IM Server, shutdown func­
tion should free the communication window properties and
etc..


55..  RReeffeerreenncceess

[1] Masahiko Narita and Hideki Hiura, _‘_‘_T_h_e _I_n_p_u_t _M_e_t_h_o_d
_P_r_o_t_o_c_o_l_’_’
















                             1166


