Exemplo n.º 1
0
/*
 *	struct nlm_res {
 *		netobj cookie;
 *		nlm_stat stat;
 *	};
 */
static int nlm_xdr_dec_res(struct rpc_rqst *req,
			   struct xdr_stream *xdr,
			   struct nlm_res *result)
{
	int error;

	error = decode_cookie(xdr, &result->cookie);
	if (unlikely(error))
		goto out;
	error = decode_nlm_stat(xdr, &result->status);
out:
	return error;
}
Exemplo n.º 2
0
void
decode_event(DBusMessageIter *iter, int *err, alarm_event_t *eve)
{
  size_t action_cnt     = 0;
  size_t recurrence_cnt = 0;

  alarm_event_del_actions(eve);
  alarm_event_del_recurrences(eve);

  decode_cookie   (iter, err, &eve->ALARMD_PRIVATE(cookie));
  decode_time     (iter, err, &eve->ALARMD_PRIVATE(trigger));
  decode_dstring  (iter, err, &eve->title);
  decode_dstring  (iter, err, &eve->message);
  decode_dstring  (iter, err, &eve->sound);
  decode_dstring  (iter, err, &eve->icon);
  decode_unsigned (iter, err, &eve->flags);
  decode_dstring  (iter, err, &eve->alarm_appid);
  decode_time     (iter, err, &eve->alarm_time);
  decode_tm       (iter, err, &eve->alarm_tm);
  decode_dstring  (iter, err, &eve->alarm_tz);
  decode_time     (iter, err, &eve->recur_secs);
  decode_int      (iter, err, &eve->recur_count);
  decode_time     (iter, err, &eve->snooze_secs);
  decode_time     (iter, err, &eve->snooze_total);

  decode_size     (iter, err, &action_cnt);
  decode_int      (iter, err, &eve->response);

  /* - - - - - - - - - - - - - - - - - - - *
   * action table
   * - - - - - - - - - - - - - - - - - - - */

  alarm_action_t *act = alarm_event_add_actions(eve, action_cnt);
  for( size_t i = 0; i < action_cnt; ++i )
  {
    decode_action(iter, err, &act[i]);
  }

  /* - - - - - - - - - - - - - - - - - - - *
   * recurrence table
   * - - - - - - - - - - - - - - - - - - - */

  decode_size     (iter, err, &recurrence_cnt);
  alarm_recur_t *rec = alarm_event_add_recurrences(eve, recurrence_cnt);
  for( size_t i = 0; i < recurrence_cnt; ++i )
  {
    decode_recur(iter, err, &rec[i]);
  }
  /* - - - - - - - - - - - - - - - - - - - *
   * attribute table sent by libalarm >= 1.0.4
   * - - - - - - - - - - - - - - - - - - - */

  if( !decode_eom_p(iter, err) )
  {
    size_t count = 0;
    decode_size     (iter, err, &count);
    for( size_t i = 0; i < count; ++i )
    {
      alarm_attr_t *att = alarm_event_add_attr(eve, "\x7f");
      decode_attr(iter, err, att);
    }
  }
}