IXPMSG(3)

NAME

IxpMsg, IxpMsgMode, ixp_message

SYNOPSIS
  #include <ixp.h>

  typedef struct IxpMsg IxpMsg;
  struct IxpMsg {
          char*   data; /* Begining of buffer. */
          char*   pos;  /* Current position in buffer. */
          char*   end;  /* End of message. */
          uint    size; /* Size of buffer. */
          uint    mode; /* MsgPack or MsgUnpack. */
  }

  enum IxpMsgMode {
          MsgPack,
          MsgUnpack,
  }

  IxpMsg ixp_message(char *data, uint length, uint mode);

DESCRIPTION

The IxpMsg struct represents a binary message, and is used extensively by libixp for converting messages to and from wire format. The location and size of a buffer are stored in IdataR and IsizeR, respectively. IposR points to the location in the message currently being packed or unpacked, while IendR points to the end of the message. The packing functions advance IposR as they go, always ensuring that they don't read or write past IendR. When a message is entirely packed or unpacked, IposR whould be less than or equal to IendR. Any other state indicates error.

ixp_message is a convenience function to pack a construct an IxpMsg from a buffer of a given IlengthR and a given ImodeR. IposR and IdataR are set to IdataR and IendR is set to IdataR + IlengthR.

SEE ALSO

ixp_pu8(3), ixp_pu16(3), ixp_pu32(3), ixp_pu64(3), ixp_pstring(3), ixp_pstrings(3)