#ifdef __cplusplus
extern "C" {
#endif

extern int MCODErrorHandler (int nr, char * txt);


//
// ---------------- Host messages (SDTMTUI<->SDTMT<->SDTGATE) -----------------
//
class ClassHostMessage
{

  public:

    void StartEncode           ( char * buffer, int buffersize );
    int  Encode_CSTRING        ( char * src );
    #ifndef SDTGATE
      int  Encode_CLIST          ( xmk_T_LINKED_LIST * src );
    #endif
    int  Encode_CINT           ( int src );
    int  Encode_CRAWBUFFER     ( int srclen, char * src );
    int  EndEncode             ( void );
    int  EncodedLength         ( void );

    void StartDecode           ( char * buffer, int buffersize );
    int  Decode_CSTRING        ( char ** dest );
    #ifndef SDTGATE
      int  Decode_CLIST          ( xmk_T_LINKED_LIST ** dest );
    #endif
    int  Decode_CINT           ( int * dest );
    int  Decode_CRAWBUFFER     ( int * destlen, char ** dest );
    int  EndDecode             ( void );

    //
    // Help function used for deallocating memory
    //
    #ifndef SDTGATE
      xmk_T_LINKED_LIST *  FreeCList      ( xmk_T_LINKED_LIST * dest );
    #endif
    char *               FreeCRAWBuffer ( char * dest );


  private:
    char * BufferBegin;
    char * CurrentBufferAddress;
    int    CurrentOffset;
    int    BufferLength ;

};     // end class HostMessage */



#ifdef __cplusplus
}
#endif

