Example #1
0
static int recv_SECTION_PEER_SET_ATTR(struct mwPlace *place,
				      struct mwGetBuffer *b) {
  struct mwServicePlace *srvc;
  int ret = 0;
  guint32 id, attr;
  struct mwOpaque o = {0,0};
  struct place_member *pm;
  
  srvc = place->service;

  guint32_get(b, &id);
  mwGetBuffer_advance(b, 4);
  mwOpaque_get(b, &o);
  mwGetBuffer_advance(b, 4);
  guint32_get(b, &attr);

  pm = GET_MEMBER(place, id);
  g_return_val_if_fail(pm != NULL, -1);

  if(srvc->handler && srvc->handler->peerSetAttribute)
    srvc->handler->peerSetAttribute(place, &pm->idb, attr, &o);

  mwOpaque_clear(&o);

  return ret;
}
Example #2
0
static void LOGIN_get(struct mwGetBuffer *b, struct mwMsgLogin *msg) {
  if(mwGetBuffer_error(b)) return;

  guint16_get(b, &msg->login_type);
  mwString_get(b, &msg->name);
  mwOpaque_get(b, &msg->auth_data);
  guint16_get(b, &msg->auth_type);
}
Example #3
0
static void mwMessageHead_get(struct mwGetBuffer *b, struct mwMessage *msg) {

  if(mwGetBuffer_error(b)) return;

  guint16_get(b, &msg->type);
  guint16_get(b, &msg->options);
  guint32_get(b, &msg->channel);

  if(msg->options & mwMessageOption_HAS_ATTRIBS)
    mwOpaque_get(b, &msg->attribs);
}
Example #4
0
static void HANDSHAKE_ACK_get(struct mwGetBuffer *b,
			      struct mwMsgHandshakeAck *msg) {

  if(mwGetBuffer_error(b)) return;

  guint16_get(b, &msg->major);
  guint16_get(b, &msg->minor);
  guint32_get(b, &msg->srvrcalc_addr);

  /** @todo: get a better handle on what versions support what parts
      of this message. eg: minor version 0x0018 doesn't send the
      following */
  if(msg->major >= 0x1e && msg->minor > 0x18) {
    guint32_get(b, &msg->magic);
    mwOpaque_get(b, &msg->data);
  }
}
Example #5
0
static void request_get(struct mwGetBuffer *b, struct mwStorageReq *req) {
  guint32 id, count, junk;

  if(mwGetBuffer_error(b)) return;

  guint32_get(b, &id);
  guint32_get(b, &req->result_code);

  if(req->action == action_loaded) {
    guint32_get(b, &count);

    if(count > 0) {
      guint32_get(b, &junk);
      guint32_get(b, &req->item->key);

      mwOpaque_clear(&req->item->data);
      mwOpaque_get(b, &req->item->data);
    }
  }
}