// XXX: update when JVMP_ShmRequest changed
static int JVMP_MarshallShmReq(JVMP_ShmRequest* req, 
			       char* *res, int *plen)
{
#define ADD_VAL(val) \
    size = sizeof(val); \
    if (pos+size >= len) { len = pos+size+step; buf = realloc(buf, len); } \
    memcpy(buf+pos, &val, size); \
    pos += size; argc++;
#define ADD_REF(ref, size) \
    if (pos+size >= len) { len = pos+size+step; buf = realloc(buf, len); } \
    memcpy(buf+pos, ref, size); \
    pos += size; argc++;
  int len=0, pos=0, size, step=20, argc=0;
  char* buf = NULL;
  if (!req) return 0;
  
  ADD_VAL(req->rid);
  ADD_VAL(req->msg_id);
  ADD_VAL(req->func_no);
  ADD_VAL(req->retval);
  ADD_VAL(req->argc);
  ADD_REF(req->argt, strlen(req->argt)+1);
  ADD_VAL(req->nullmask);
  ADD_VAL(req->length);
  ADD_REF(req->data, req->length);
  ADD_VAL(req->shmlen);
  ADD_VAL(req->shmid);
  ADD_VAL(req->caps);
  // there's no ADD_REF(req->shmdata, req->length); as it's SHARED
  *res = buf;
  *plen = pos;
  return 1;
}
Beispiel #2
0
void planMAMsgAddDTGReqReachable(plan_ma_msg_t *msg, int val)
{
    plan_ma_msg_dtg_req_t *dr;
    msg->header |= M_dtg_req;
    dr = &msg->dtg_req;
    ADD_VAL(dr, reachable, val);
}
Beispiel #3
0
void planMAMsgAddHeurRequestedAgent(plan_ma_msg_t *msg, int agent_id)
{
    ADD_VAL(msg, heur_requested_agent, agent_id);
}