Exemplo n.º 1
0
int SendEventStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                        unsigned int size, int bigEndian) const
{
  SendEventMessage *sendEvent = (SendEventMessage *) message;

  //
  // Fill all the message's fields.
  //

  *(buffer + 1) = sendEvent -> propagate;

  PutULONG(sendEvent -> window, buffer + 4,  bigEndian);
  PutULONG(sendEvent -> mask,   buffer + 8,  bigEndian);

  *(buffer + 12) = sendEvent -> code;
  *(buffer + 13) = sendEvent -> byte_data;

  PutUINT(sendEvent -> sequence, buffer + 14, bigEndian);

  PutULONG(sendEvent -> int_data, buffer + 16, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at "
          << this << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 2
0
int FillPolyStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                       unsigned int size, int bigEndian) const
{
  FillPolyMessage *fillPoly = (FillPolyMessage *) message;

  //
  // Fill all the message's fields.
  //

  PutULONG(fillPoly -> drawable, buffer + 4, bigEndian);
  PutULONG(fillPoly -> gcontext, buffer + 8, bigEndian);

  *(buffer + 12) = fillPoly -> shape;
  *(buffer + 13) = fillPoly -> mode;

  if (control -> isProtoStep8() == 1 &&
          size >= (unsigned int) dataOffset)
  {
    PutUINT(fillPoly -> x_origin, buffer + 16, bigEndian);
    PutUINT(fillPoly -> y_origin, buffer + 18, bigEndian);
  }

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 3
0
int GetImageStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                       unsigned int size, int bigEndian) const
{
  GetImageMessage *getImage = (GetImageMessage *) message;

  //
  // Fill all the message's fields.
  //

  *(buffer + 1) = getImage -> format;

  PutULONG(getImage -> drawable, buffer + 4,  bigEndian);

  PutUINT(getImage -> x,      buffer + 8,  bigEndian);
  PutUINT(getImage -> y,      buffer + 10, bigEndian);
  PutUINT(getImage -> width,  buffer + 12, bigEndian);
  PutUINT(getImage -> height, buffer + 14, bigEndian);

  PutULONG(getImage -> plane_mask, buffer + 16,  bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 4
0
int CopyAreaStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                       unsigned int size, int bigEndian) const
{
  CopyAreaMessage *copyArea = (CopyAreaMessage *) message;

  //
  // Fill all the message's fields.
  //

  PutULONG(copyArea -> src_drawable, buffer + 4, bigEndian);
  PutULONG(copyArea -> dst_drawable, buffer + 8, bigEndian);
  PutULONG(copyArea -> gcontext,     buffer + 12, bigEndian);

  PutUINT(copyArea -> src_x, buffer + 16, bigEndian);
  PutUINT(copyArea -> src_y, buffer + 18, bigEndian);
  PutUINT(copyArea -> dst_x, buffer + 20, bigEndian);
  PutUINT(copyArea -> dst_y, buffer + 22, bigEndian);

  PutUINT(copyArea -> width,  buffer + 24, bigEndian);
  PutUINT(copyArea -> height, buffer + 26, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 5
0
int GetPropertyReplyStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
                                              unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
                                                  ChannelCache *channelCache) const
{
  ServerCache *serverCache = (ServerCache *) channelCache;

  #ifdef DEBUG
  *logofs << name() << ": Decoding full message identity.\n"
          << logofs_flush;
  #endif

  unsigned char format;

  decodeBuffer.decodeCachedValue(format, 8,
                     serverCache -> getPropertyFormatCache);

  unsigned int length;

  decodeBuffer.decodeValue(length, 32, 9);

  unsigned int numBytes = length;

  if (format == 16)
  {
    numBytes <<= 1;
  }
  else if (format == 32)
  {
    numBytes <<= 2;
  }

  size = 32 + RoundUp4(numBytes);

  buffer = writeBuffer -> addMessage(size);

  *(buffer + 1) = format;

  PutULONG(length, buffer + 16, bigEndian);

  unsigned int value;

  decodeBuffer.decodeCachedValue(value, 29,
                     serverCache -> getPropertyTypeCache, 9);

  PutULONG(value, buffer + 8, bigEndian);

  decodeBuffer.decodeValue(value, 32, 9);

  PutULONG(value, buffer + 12, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Decoded full message identity.\n"
          << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 6
0
int SetUnpackColormapCompatStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
                                                     unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
                                                         ChannelCache *channelCache) const
{
  ClientCache *clientCache = (ClientCache *) channelCache;

  #ifdef DEBUG
  *logofs << name() << ": Decoding full message identity.\n" << logofs_flush;
  #endif

  unsigned int  value;
  unsigned char cValue;

  // Client.
  decodeBuffer.decodeCachedValue(cValue, 8,
                     clientCache -> resourceCache);
  // Entries.
  decodeBuffer.decodeValue(value, 32, 9);

  size = (value << 2) + 8;

  buffer = writeBuffer -> addMessage(size);

  *(buffer + 1) = cValue;

  PutULONG(value, buffer + 4, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Decoded full message identity.\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 7
0
int CreatePixmapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
                                          unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
                                              ChannelCache *channelCache) const
{
  ClientCache *clientCache = (ClientCache *) channelCache;

  unsigned char cValue;
  unsigned int  value;

  size = 16;

  buffer = writeBuffer -> addMessage(size);

  decodeBuffer.decodeCachedValue(cValue, 8,
                     clientCache -> depthCache);

  *(buffer + 1) = cValue;

  decodeBuffer.decodeNewXidValue(value,
                     clientCache -> lastId, clientCache -> lastIdCache,
                         clientCache -> drawableCache,
                             clientCache -> freeDrawableCache);

  PutULONG(value, buffer + 4, bigEndian);

  decodeBuffer.decodeXidValue(value,
                     clientCache -> windowCache);

  PutULONG(value, buffer + 8, bigEndian);

  decodeBuffer.decodeCachedValue(value, 16,
                     clientCache -> createPixmapXCache, 8);

  PutUINT(value, buffer + 12, bigEndian);

  decodeBuffer.decodeCachedValue(value, 16,
                     clientCache -> createPixmapYCache, 8);

  PutUINT(value, buffer + 14, bigEndian);

  #ifdef TEST
  *logofs << name() << ": Decoded message. Size is "
          << size << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 8
0
int SetUnpackColormapStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                                unsigned int size, int bigEndian) const
{
  SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message;

  *(buffer + 1) = setUnpackColormap -> client;
  *(buffer + 4) = setUnpackColormap -> method;

  PutULONG(setUnpackColormap -> src_length, buffer + 8,  bigEndian);
  PutULONG(setUnpackColormap -> dst_length, buffer + 12, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 9
0
int SetUnpackColormapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
                                               unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
                                                   ChannelCache *channelCache) const
{
  ClientCache *clientCache = (ClientCache *) channelCache;

  #ifdef DEBUG
  *logofs << name() << ": Decoding full message identity.\n" << logofs_flush;
  #endif

  unsigned int  value;
  unsigned char cValue;

  // SrcLength.
  decodeBuffer.decodeValue(value, 32, 9);

  size = RoundUp4(value) + 16;

  buffer = writeBuffer -> addMessage(size);

  PutULONG(value, buffer + 8, bigEndian);

  // Client.
  decodeBuffer.decodeCachedValue(cValue, 8,
                     clientCache -> resourceCache);

  *(buffer + 1) = cValue;

  // Method.
  decodeBuffer.decodeCachedValue(cValue, 8,
                     clientCache -> methodCache);

  *(buffer + 4) = cValue;

  // DstLength.
  decodeBuffer.decodeValue(value, 32, 9);

  PutULONG(value, buffer + 12, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Decoded full message identity.\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 10
0
int GetPropertyReplyStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                               unsigned int size, int bigEndian) const
{
  GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message;

  *(buffer + 1) = getPropertyReply -> format;

  PutULONG(getPropertyReply -> type,  buffer + 8,  bigEndian);
  PutULONG(getPropertyReply -> after, buffer + 12, bigEndian);
  PutULONG(getPropertyReply -> items, buffer + 16, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at "
          << message << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 11
0
int ChangePropertyStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                             unsigned int size, int bigEndian) const
{
  ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message;

  *(buffer + 1)  = changeProperty -> mode;
  *(buffer + 16) = changeProperty -> format;

  PutULONG(changeProperty -> window,   buffer + 4,  bigEndian);
  PutULONG(changeProperty -> property, buffer + 8,  bigEndian);
  PutULONG(changeProperty -> type,     buffer + 12, bigEndian);
  PutULONG(changeProperty -> length,   buffer + 20, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at "
          << this << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 12
0
int CreatePixmapStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                           unsigned int size, int bigEndian) const
{
  CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message;

  *(buffer + 1) = createPixmap -> depth;

  PutULONG(createPixmap -> id,       buffer + 4, bigEndian);
  PutULONG(createPixmap -> drawable, buffer + 8, bigEndian);

  PutUINT(createPixmap -> width,  buffer + 12, bigEndian);
  PutUINT(createPixmap -> height, buffer + 14, bigEndian);

  #ifdef TEST
  *logofs << name() << ": Unparsed identity. Size is "
          << createPixmap -> size_ << " identity is "
          << createPixmap -> i_size_ << ".\n"
          << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 13
0
int ImageText16Store::unparseIdentity(const Message *message, unsigned char *buffer,
                                         unsigned int size, int bigEndian) const
{
  ImageText16Message *imageText16 = (ImageText16Message *) message;

  //
  // Fill all the message's fields.
  //

  *(buffer + 1) = imageText16 -> len;

  PutULONG(imageText16 -> drawable, buffer + 4, bigEndian);
  PutULONG(imageText16 -> gcontext, buffer + 8, bigEndian);

  PutUINT(imageText16 -> x, buffer + 12, bigEndian);
  PutUINT(imageText16 -> y, buffer + 14, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 14
0
int GetPropertyStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                          unsigned int size, int bigEndian) const
{

  GetPropertyMessage *getProperty = (GetPropertyMessage *) message;

  //
  // Fill all the message's fields.
  //

  *(buffer + 1) = getProperty -> property_delete;

  PutULONG(getProperty -> window,      buffer + 4,  bigEndian);
  PutULONG(getProperty -> property,    buffer + 8,  bigEndian);
  PutULONG(getProperty -> type,        buffer + 12, bigEndian);
  PutULONG(getProperty -> long_offset, buffer + 16, bigEndian);
  PutULONG(getProperty -> long_length, buffer + 20, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 15
0
int SetUnpackColormapCompatStore::unparseIdentity(const Message *message, unsigned char *buffer,
                                                      unsigned int size, int bigEndian) const
{
  SetUnpackColormapCompatMessage *setUnpackColormap = (SetUnpackColormapCompatMessage *) message;

  *(buffer + 1) = setUnpackColormap -> client;

  PutULONG(setUnpackColormap -> entries, buffer + 4, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush;
  #endif

  return 1;
}
Exemplo n.º 16
0
int ChangeGCCompatStore::parseIdentity(Message *message, const unsigned char *buffer,
                                           unsigned int size, int bigEndian) const
{
  ChangeGCCompatMessage *changeGC = (ChangeGCCompatMessage *) message;

  //
  // Here is the fingerprint.
  //

  changeGC -> gcontext   = GetULONG(buffer + 4, bigEndian);
  changeGC -> value_mask = GetULONG(buffer + 8, bigEndian);

  //
  // Clear the unused bytes carried in the
  // payload to increase the effectiveness
  // of the caching algorithm.
  //

  if ((int) size > dataOffset)
  {
    #ifdef DEBUG
    *logofs << name() << ": Removing unused bytes from the "
            << "data payload.\n" << logofs_flush;
    #endif

    changeGC -> value_mask &= (1 << 23) - 1;

    unsigned int mask = 0x1;
    unsigned char *source = (unsigned char *) buffer + CHANGEGC_DATA_OFFSET;
    unsigned long value = 0;

    for (unsigned int i = 0; i < 23; i++)
    {
      if (changeGC -> value_mask & mask)
      {
        value = GetULONG(source, bigEndian);

        value &= (0xffffffff >> (32 - CREATEGC_FIELD_WIDTH[i]));

        PutULONG(value, source, bigEndian);

        source += 4;
      }

      mask <<= 1;
    }
Exemplo n.º 17
0
int SetClipRectanglesStore::unparseIdentity(const Message *message, unsigned char *buffer,
        unsigned int size, int bigEndian) const
{
    SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message;

    //
    // Fill all the message's fields.
    //

    *(buffer + 1) = setClipRectangles -> ordering;

    PutULONG(setClipRectangles -> gcontext, buffer + 4, bigEndian);

    PutUINT(setClipRectangles -> x_origin, buffer + 8, bigEndian);
    PutUINT(setClipRectangles -> y_origin, buffer + 10, bigEndian);

#ifdef DEBUG
    *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush;
#endif

    return 1;
}