cpack.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 2003, 2004 David Young.  All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  * 1. Redistributions of source code must retain the above copyright
00008  *    notice, this list of conditions and the following disclaimer.
00009  * 2. Redistributions in binary form must reproduce the above copyright
00010  *    notice, this list of conditions and the following disclaimer in the
00011  *    documentation and/or other materials provided with the distribution.
00012  * 3. The name of David Young may not be used to endorse or promote
00013  *    products derived from this software without specific prior
00014  *    written permission.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
00017  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00018  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00019  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DAVID
00020  * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00021  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00022  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00025  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00027  * OF SUCH DAMAGE.
00028  */
00029 
00030 #ifndef _CPACK_H
00031 #define _CPACK_H
00032 
00033 struct cpack_state {
00034   u_int8_t          *c_buf;
00035   u_int8_t          *c_next;
00036   size_t             c_len;
00037 };
00038 
00039 int cpack_init(struct cpack_state *, u_int8_t *, size_t);
00040 
00041 int cpack_uint8(struct cpack_state *, u_int8_t *);
00042 int cpack_uint16(struct cpack_state *, u_int16_t *);
00043 int cpack_uint32(struct cpack_state *, u_int32_t *);
00044 int cpack_uint64(struct cpack_state *, u_int64_t *);
00045 
00046 #define cpack_int8(__s, __p)  cpack_uint8((__s),  (u_int8_t*)(__p))
00047 #define cpack_int16(__s, __p) cpack_uint16((__s), (u_int16_t*)(__p))
00048 #define cpack_int32(__s, __p) cpack_uint32((__s), (u_int32_t*)(__p))
00049 #define cpack_int64(__s, __p) cpack_uint64((__s), (u_int64_t*)(__p))
00050 
00051 #endif /* _CPACK_H */

Generated on Fri Jul 25 17:10:33 2008 for WifiScanner by  doxygen 1.5.5