GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / include / bcm_xdr.h
blobe3f951c44813068ba05744d0f7060445ad60848d
1 /*
2 * Utilites for XDR encode and decode of data
4 * Copyright (C) 2012, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied
9 * or duplicated in any form, in whole or in part, without the prior
10 * written permission of Broadcom Corporation.
12 * $Id: bcm_xdr.h 318785 2012-03-05 19:15:48Z $
15 #ifndef _BCM_XDR_H
16 #define _BCM_XDR_H
18 #define XDR_PACK_OPAQUE_VAR_SZ(len) (sizeof(uint32) + ROUNDUP(len, sizeof(uint32)))
21 * bcm_xdr_buf_t
22 * Structure used for bookkeeping of a buffer being packed or unpacked.
23 * Keeps a current read/write pointer and size as well as
24 * the original buffer pointer and size.
27 typedef struct {
28 uint8 *buf; /* pointer to current position in origbuf */
29 uint size; /* current (residual) size in bytes */
30 uint8 *origbuf; /* unmodified pointer to orignal buffer */
31 uint origsize; /* unmodified orignal buffer size in bytes */
32 } bcm_xdr_buf_t;
35 void bcm_xdr_buf_init(bcm_xdr_buf_t *b, void *buf, size_t len);
37 int bcm_xdr_pack_uint32(bcm_xdr_buf_t *b, uint32 val);
38 int bcm_xdr_unpack_uint32(bcm_xdr_buf_t *b, uint32 *pval);
39 int bcm_xdr_pack_int32(bcm_xdr_buf_t *b, int32 val);
40 int bcm_xdr_unpack_int32(bcm_xdr_buf_t *b, int32 *pval);
41 int bcm_xdr_pack_int8(bcm_xdr_buf_t *b, int8 val);
42 int bcm_xdr_unpack_int8(bcm_xdr_buf_t *b, int8 *pval);
43 int bcm_xdr_pack_opaque(bcm_xdr_buf_t *b, uint len, const void *data);
44 int bcm_xdr_unpack_opaque(bcm_xdr_buf_t *b, uint len, void **pdata);
45 int bcm_xdr_unpack_opaque_cpy(bcm_xdr_buf_t *b, uint len, void *data);
46 int bcm_xdr_pack_opaque_varlen(bcm_xdr_buf_t *b, uint len, const void *data);
47 int bcm_xdr_unpack_opaque_varlen(bcm_xdr_buf_t *b, uint *plen, void **pdata);
48 int bcm_xdr_pack_string(bcm_xdr_buf_t *b, char *str);
49 int bcm_xdr_unpack_string(bcm_xdr_buf_t *b, uint *plen, char **pstr);
51 int bcm_xdr_pack_uint8_vec(bcm_xdr_buf_t *, uint8 *vec, uint32 elems);
52 int bcm_xdr_unpack_uint8_vec(bcm_xdr_buf_t *, uint8 *vec, uint32 elems);
53 int bcm_xdr_pack_uint16_vec(bcm_xdr_buf_t *b, uint len, void *vec);
54 int bcm_xdr_unpack_uint16_vec(bcm_xdr_buf_t *b, uint len, void *vec);
55 int bcm_xdr_pack_uint32_vec(bcm_xdr_buf_t *b, uint len, void *vec);
56 int bcm_xdr_unpack_uint32_vec(bcm_xdr_buf_t *b, uint len, void *vec);
58 int bcm_xdr_pack_opaque_raw(bcm_xdr_buf_t *b, uint len, void *data);
59 int bcm_xdr_pack_opaque_pad(bcm_xdr_buf_t *b);
61 int bcm_xdr_opaque_resrv(bcm_xdr_buf_t *b, uint len, void **pdata);
62 int bcm_xdr_opaque_resrv_varlen(bcm_xdr_buf_t *b, uint len, void **pdata);
64 #endif /* _BCM_XDR_H */