Resync with broadcom drivers 5.100.138.20 and utilities.
[tomato.git] / release / src-rt / include / bcm_xdr.h
blobd787af3f475c99472951844aa7b327bb44bccd28
1 /*
2 * Utilites for XDR encode and decode of data
4 * Copyright (C) 2010, 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,v 13.4 2008-11-07 20:27:02 Exp $
15 #ifndef _BCM_XDR_H
16 #define _BCM_XDR_H
19 * bcm_xdr_buf_t
20 * Structure used for bookkeeping of a buffer being packed or unpacked.
21 * Keeps a current read/write pointer and size as well as
22 * the original buffer pointer and size.
25 typedef struct {
26 uint8 *buf; /* pointer to current position in origbuf */
27 uint size; /* current (residual) size in bytes */
28 uint8 *origbuf; /* unmodified pointer to orignal buffer */
29 uint origsize; /* unmodified orignal buffer size in bytes */
30 } bcm_xdr_buf_t;
33 void bcm_xdr_buf_init(bcm_xdr_buf_t *b, void *buf, size_t len);
35 int bcm_xdr_pack_uint32(bcm_xdr_buf_t *b, uint32 val);
36 int bcm_xdr_unpack_uint32(bcm_xdr_buf_t *b, uint32 *pval);
37 int bcm_xdr_pack_int32(bcm_xdr_buf_t *b, int32 val);
38 int bcm_xdr_unpack_int32(bcm_xdr_buf_t *b, int32 *pval);
39 int bcm_xdr_pack_int8(bcm_xdr_buf_t *b, int8 val);
40 int bcm_xdr_unpack_int8(bcm_xdr_buf_t *b, int8 *pval);
41 int bcm_xdr_pack_opaque(bcm_xdr_buf_t *b, uint len, void *data);
42 int bcm_xdr_unpack_opaque(bcm_xdr_buf_t *b, uint len, void **pdata);
43 int bcm_xdr_unpack_opaque_cpy(bcm_xdr_buf_t *b, uint len, void *data);
44 int bcm_xdr_pack_opaque_varlen(bcm_xdr_buf_t *b, uint len, void *data);
45 int bcm_xdr_unpack_opaque_varlen(bcm_xdr_buf_t *b, uint *plen, void **pdata);
46 int bcm_xdr_pack_string(bcm_xdr_buf_t *b, char *str);
47 int bcm_xdr_unpack_string(bcm_xdr_buf_t *b, uint *plen, char **pstr);
49 int bcm_xdr_pack_uint8_vec(bcm_xdr_buf_t *, uint8 *vec, uint32 elems);
50 int bcm_xdr_unpack_uint8_vec(bcm_xdr_buf_t *, uint8 *vec, uint32 elems);
51 int bcm_xdr_pack_uint16_vec(bcm_xdr_buf_t *b, uint len, void *vec);
52 int bcm_xdr_unpack_uint16_vec(bcm_xdr_buf_t *b, uint len, void *vec);
53 int bcm_xdr_pack_uint32_vec(bcm_xdr_buf_t *b, uint len, void *vec);
54 int bcm_xdr_unpack_uint32_vec(bcm_xdr_buf_t *b, uint len, void *vec);
56 int bcm_xdr_pack_opaque_raw(bcm_xdr_buf_t *b, uint len, void *data);
57 int bcm_xdr_pack_opaque_pad(bcm_xdr_buf_t *b);
59 #endif /* _BCM_XDR_H */