/* $Id$ * Include file for the packet assembly and disassembly layer * Copyright (C) 2004 Jan Kratochvil * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; exactly version 2 of June 1991 is required * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _UDPGATE_PACKET_H #define _UDPGATE_PACKET_H 1 #include #include G_BEGIN_DECLS #define PACKET_HEADER "UDPGate0" #define PACKET_ELEM_ATTR_MANDATORY (0x80000000) #define PACKET_ELEM_ATTR_OPTIONAL (0x00000000) enum packet_elem_type { PACKET_ELEM_TYPE_PROGRAM_VERSION=(0x01|PACKET_ELEM_ATTR_MANDATORY), /* 'VERSION' string */ PACKET_ELEM_TYPE_CLIENT_INADDR =(0x02|PACKET_ELEM_ATTR_MANDATORY), /* host order */ PACKET_ELEM_TYPE_CLIENT_PORT =(0x03|PACKET_ELEM_ATTR_MANDATORY), /* host order */ PACKET_ELEM_TYPE_DATA_GUINT32 =(0x04|PACKET_ELEM_ATTR_MANDATORY), /* user data (e.g. unique id) */ }; gpointer packet_assembly(size_t *packet_length_pointer,GHashTable *values); GHashTable *packet_disassembly(gconstpointer packet,size_t packet_length); void packet_disassembly_destroy(GHashTable *hash); G_END_DECLS #endif /* _UDPGATE_PACKET_H */