00001 /* 00002 * Copyright (c) 2005, 2006 by KoanLogic s.r.l. <http://www.koanlogic.com> 00003 * All rights reserved. 00004 * 00005 * This file is part of KLone, and as such it is subject to the license stated 00006 * in the LICENSE file which you have received as part of this distribution. 00007 * 00008 * $Id: field.h,v 1.6 2006/01/09 12:38:37 tat Exp $ 00009 */ 00010 00011 #ifndef _KLONE_FIELD_H_ 00012 #define _KLONE_FIELD_H_ 00013 00014 #include <sys/types.h> 00015 #include <u/libu.h> 00016 00017 #ifdef __cplusplus 00018 extern "C" { 00019 #endif 00020 00021 TAILQ_HEAD(param_list_s, param_s); 00022 typedef struct param_s 00023 { 00024 TAILQ_ENTRY(param_s) np; /* next & prev pointers */ 00025 char *name; /* param name */ 00026 char *value; /* param value */ 00027 } param_t; 00028 00029 typedef struct param_list_s params_t; /* param list */ 00030 00031 TAILQ_HEAD(field_list_s, field_s); 00032 typedef struct field_s 00033 { 00034 TAILQ_ENTRY(field_s) np; /* next & prev pointers */ 00035 char *name; /* field name */ 00036 char *value; /* field value */ 00037 params_t *params; /* param list */ 00038 } field_t; 00039 00040 /* field list */ 00041 typedef struct field_list_s fields_t; /* field list */ 00042 00043 int field_create(const char* name, const char *value, field_t**); 00044 int field_set(field_t*, const char *name, const char *value); 00045 int field_set_from_line(field_t*, const char *line); 00046 int field_free(field_t*); 00047 const char* field_get_name(field_t *f); 00048 const char* field_get_value(field_t *f); 00049 00050 #ifdef __cplusplus 00051 } 00052 #endif 00053 00054 #endif