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

buffers.c

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 #include <inttypes.h>
00021 #include "net/buffers.h"
00022 
00023 void buf_prep_char(net_buf_t *obj, uint8_t value)
00024 {
00025         obj->len++;
00026         *--obj->data = value;
00027 }
00028 
00029 void buf_prep_int(net_buf_t *obj, uint16_t value)
00030 {
00031         obj->len+=2;
00032         obj->data-=2;
00033         *((uint16_t*)obj->data) = value;
00034 }
00035 
00036 void buf_prep_long(net_buf_t *obj, uint32_t value)
00037 {
00038         obj->len+=4;
00039         obj->data-=4;
00040         *((uint32_t*)obj->data) = value;
00041 }
00042 
00043 void buf_app_int(net_buf_t *obj, uint16_t value)
00044 {
00045         *((uint16_t*)(obj->data+obj->len)) = value;
00046         obj->len += 2;
00047 }

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