Annotation of libelwix/inc/elwix/apack.h, revision 1.1.2.2

1.1.2.1   misho       1: #ifndef __APACK_H
                      2: #define __APACK_H
                      3: 
                      4: 
1.1.2.2 ! misho       5: typedef struct tagRawPacket {
        !             6:        size_t  r_len;
        !             7:        uint8_t *r_buf;
        !             8:        uint8_t *r_next;
        !             9: } rpack_t;
        !            10: 
        !            11: #define RPACK_FREE(x)          (assert((x)), memset((x), 0, sizeof(rpack_t)))
        !            12: #define RPACK_INIT(x, b, l)    do { assert((x)); RPACK_FREE(x); \
        !            13:                                        (x)->r_buf = (b); \
        !            14:                                                (x)->r_len = (l); \
        !            15:                                        (x)->r_next = (x)->r_buf; \
        !            16:                                } while (0)
        !            17: #define RPACK_SANITY(x)                ((x) && (x)->r_buf && (x)->r_next && (x)->r_next >= (x)->r_buf)
        !            18: 
        !            19: 
        !            20: /*
        !            21:  * rpack_align_and_reserve() - Align & reserve space
        !            22:  *
        !            23:  * @rp = raw buffer
        !            24:  * @siz = need size
        !            25:  * return: NULL error or not enough space, !=NULL next position
        !            26:  */
        !            27: uint8_t *rpack_align_and_reserve(rpack_t * __restrict rp, size_t siz);
        !            28: 
        !            29: /*
        !            30:  * rpack_create() - Allocate & init raw packet structure
        !            31:  *
        !            32:  * @buf = buffer
        !            33:  * @buflen = length of buffer
        !            34:  * return: NULL error or !=NULL raw packet, should be freed by rpack_destroy()
        !            35:  */
        !            36: rpack_t *rpack_create(void * __restrict buf, size_t buflen);
        !            37: /*
        !            38:  * rpack_destroy() - Release & free raw packet structure
        !            39:  *
        !            40:  * @rp = raw packet
        !            41:  * return: none
        !            42:  */
        !            43: void rpack_destroy(rpack_t ** __restrict rp);
        !            44: 
        !            45: /*
        !            46:  * rpack_uint8() - Pack/Unpack 8bit value
        !            47:  *
        !            48:  * @rp = raw buffer
        !            49:  * @n = set value if !=NULL
        !            50:  * return: -1 error or get value
        !            51:  */
        !            52: uint8_t rpack_uint8(rpack_t * __restrict rp, uint8_t * __restrict n);
        !            53: 
1.1.2.1   misho      54: 
                     55: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>