Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

buffers.h

00001 /***
00002  * This file is part of OpenHome, an open source home automation system.
00003  * Copyright (C) 2003 Jan Klötzke
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef __BUFFERS_H
00021 #define __BUFFERS_H
00022 
00023 #include <inttypes.h>
00024 
00025 typedef struct {
00026                 uint8_t len;
00027                 uint8_t *data;
00028         } net_buf_t;
00029 
00030 #define buf_init(a, b, c)               \
00031         {                               \
00032                 a.len = c;              \
00033                 a.data = (uint8_t*)b;   \
00034         }
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 // prepend data
00041 void buf_prep_char(net_buf_t *obj, uint8_t value);
00042 void buf_prep_int(net_buf_t *obj, uint16_t value);
00043 void buf_prep_long(net_buf_t *obj, uint32_t value);
00044 
00045 // append data
00046 void buf_app_int(net_buf_t *obj, uint16_t value);
00047 
00048 #ifdef __cplusplus
00049 }
00050 #endif
00051 
00052 #define buf_len(a) a->len
00053 
00054 #endif

Generated on Fri Oct 17 16:45:53 2003 for OpenHome by doxygen 1.3.3