Exemplo n.º 1
0
/**
   \details Pull a int32_t

   int32_t is a signed long which values goes from -2147483647 to 2147483647

   \param pull Pointer to the mapirops_pull structure
   \param v Pointer to the int32_t value to return

   \return MAPIROPS_ERR_SUCCESS on success, otherwise MAPIROPS error
 */
enum mapirops_err_code mapirops_pull_int32(struct mapirops_pull *pull, int32_t *v)
{
	MAPIROPS_PULL_NEED_BYTES(pull, 4);
	*v = IVALS(pull->data.data, pull->offset);
	pull->offset += 4;
	return MAPIROPS_ERR_SUCCESS;
}
Exemplo n.º 2
0
 int buffer_next_int32(xrtp_buffer_t * buf, int32 * ret){

    if(buf->pos + sizeof(int32) > buf->len){

       return 0;
    }

    if(HOST_BYTEORDER == BIGEND_ORDER)
       *ret = RIVALS(&(buf->data), buf->pos);
    else
       *ret = IVALS(&(buf->data), buf->pos);

    buffer_log(("buffer_next_int32: (%d) at buf[%d]@%d\n", *ret, buf->pos, (int)buf->data));

    buf->pos += sizeof(int32);

    return sizeof(int32);
 }
Exemplo n.º 3
0
static WERROR dsdb_syntax_INT32_drsuapi_to_ldb(struct ldb_context *ldb, 
					       const struct dsdb_schema *schema,
					       const struct dsdb_attribute *attr,
					       const struct drsuapi_DsReplicaAttribute *in,
					       TALLOC_CTX *mem_ctx,
					       struct ldb_message_element *out)
{
	uint32_t i;

	out->flags	= 0;
	out->name	= talloc_strdup(mem_ctx, attr->lDAPDisplayName);
	W_ERROR_HAVE_NO_MEMORY(out->name);

	out->num_values	= in->value_ctr.num_values;
	out->values	= talloc_array(mem_ctx, struct ldb_val, out->num_values);
	W_ERROR_HAVE_NO_MEMORY(out->values);

	for (i=0; i < out->num_values; i++) {
		int32_t v;
		char *str;

		if (in->value_ctr.values[i].blob == NULL) {
			return WERR_FOOBAR;
		}

		if (in->value_ctr.values[i].blob->length != 4) {
			return WERR_FOOBAR;
		}

		v = IVALS(in->value_ctr.values[i].blob->data, 0);

		str = talloc_asprintf(out->values, "%d", v);
		W_ERROR_HAVE_NO_MEMORY(str);

		out->values[i] = data_blob_string_const(str);
	}

	return WERR_OK;
}
Exemplo n.º 4
0
bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32)
{
	char *q = prs_mem_get(ps, sizeof(int32));
	if (q == NULL)
		return False;

	if (UNMARSHALLING(ps)) {
		if (ps->bigendian_data)
			*data32 = RIVALS(q,0);
		else
			*data32 = IVALS(q,0);
	} else {
		if (ps->bigendian_data)
			RSIVALS(q,0,*data32);
		else
			SIVALS(q,0,*data32);
	}

	DEBUGADD(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32));

	ps->data_offset += sizeof(int32);

	return True;
}