Main Page | Class List | File List | Class Members | File Members | Related Pages

interface.h

Go to the documentation of this file.
00001 /* 00002 * $Id: interface.h,v 1.16 2003/10/16 18:50:54 jasta Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __INTERFACE_H 00018 #define __INTERFACE_H 00019 00020 /*****************************************************************************/ 00021 00028 /*****************************************************************************/ 00029 00030 EXTERN_C_BEGIN 00031 00032 /*****************************************************************************/ 00033 00038 typedef struct 00039 { 00043 char *command; 00044 char *value; 00050 Tree *tree; 00052 } Interface; 00053 00058 typedef struct 00059 { 00060 TreeNode *node; 00062 char *key; 00065 char *keydisp; 00066 char *value; 00067 } InterfaceNode; 00068 00076 typedef void (*InterfaceForeach) (Interface *p, InterfaceNode *inode, 00077 void *udata); 00078 00079 /*****************************************************************************/ 00080 00088 LIBGIFT_EXPORT 00089 Interface *interface_new (char *command, char *value); 00090 00094 LIBGIFT_EXPORT 00095 void interface_free (Interface *p); 00096 00100 LIBGIFT_EXPORT 00101 void interface_set_command (Interface *p, char *command); 00102 00106 LIBGIFT_EXPORT 00107 void interface_set_value (Interface *p, char *value); 00108 00126 LIBGIFT_EXPORT 00127 char *interface_get (Interface *p, char *key); 00128 #define INTERFACE_GETLU(p,k) ((unsigned long)ATOUL(interface_get(p,k))) 00129 #define INTERFACE_GETLI(p,k) ((signed long)ATOUL(interface_get(p,k))) 00130 #define INTERFACE_GETL(p,k) INTERFACE_GETLI(p,k) 00131 #define INTERFACE_GETI(p,k) ((int)(ATOI(interface_get(p,k)))) 00132 #define INTERFACE_GETU(p,k) ((unsigned int)(ATOI(interface_get(p,k)))) 00133 00145 LIBGIFT_EXPORT 00146 BOOL interface_put (Interface *p, char *key, char *value); 00147 #define INTERFACE_PUTLU(p,k,v) interface_put(p, k, stringf ("%lu", (unsigned long)v)) 00148 #define INTERFACE_PUTLI(p,k,v) interface_put(p, k, stringf ("%li", (long)v)) 00149 #define INTERFACE_PUTL(p,k,v) INTERFACE_PUTLI(p,k,v) 00150 #define INTERFACE_PUTI(p,k,v) interface_put(p, k, stringf ("%i", (int)v)) 00151 #define INTERFACE_PUTU(p,k,v) interface_put(p, k, stringf ("%u", (unsigned int)v)) 00152 00163 LIBGIFT_EXPORT 00164 void interface_foreach (Interface *p, char *key, InterfaceForeach func, 00165 void *udata); 00166 00178 LIBGIFT_EXPORT 00179 void interface_foreach_ex (Interface *p, InterfaceNode *node, 00180 InterfaceForeach func, void *udata); 00181 00191 LIBGIFT_EXPORT 00192 String *interface_serialize (Interface *p); 00193 00206 LIBGIFT_EXPORT 00207 Interface *interface_unserialize (char *data, size_t len); 00208 00220 LIBGIFT_EXPORT 00221 int interface_send (Interface *p, TCPC *c); 00222 00223 /*****************************************************************************/ 00224 00225 EXTERN_C_END 00226 00227 /*****************************************************************************/ 00228 00229 #endif /* __INTERFACE_H */

Generated on Sun Aug 22 08:07:10 2004 by doxygen 1.3.7