/*  libfreenet
 *  Copyright 2001 Steven Hazel <sah@thalassocracy.org>
 *
 *  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; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  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 __FN_MESSAGE_H__
#define __FN_MESSAGE_H__

#include <sys/types.h>

#define FN_MAX_FIELDS 1024
#define FN_MAX_FIELD_LEN 512

typedef struct {
  char *name;
  char *value;
} freenet_field;

typedef struct {
  int current_line;
  int type;
  u_int64_t uniqueid;

  /* don't touch these: */
  int numfields;
  freenet_field *fields;
} freenet_message;


int freenet_message_create(freenet_message *message);

int freenet_message_get_field(freenet_message *message, const char *name,
                              char *value);

int freenet_message_set_field(freenet_message *message, const char *name,
                              const char *value);

int freenet_message_get_next_line(freenet_message *message,
                                  const char *separator, char *line);

int freenet_message_destroy(freenet_message *message);

#endif /* __FN_MESSAGE_H__ */
