pair.h #1

  • //
  • guest/
  • sandy_currier/
  • p4filter/
  • pair.h
  • View
  • Commits
  • Open Download .zip Download (786 B)
/*
 * pair.h: Linked lists of key/value pairs.
 * $Header$
 */

#ifndef __PAIR_H
#define __PAIR_H

#include <sys/types.h> /* For size_t */

/* A pair has a null-terminated string key and arbitrary data.  It also
 * has a pointer to the next pair in a list. */
typedef struct pair
{
  char *key;
  size_t len;
  void *data;
  struct pair *next;
} pair;

/* Create a new pair, given the key, the data length, and a pointer to the
 * data. */
pair *new_pair(const char *key, size_t len, const void *data);

/* Free a pair (or a list of pairs). */
void free_pair(pair *p);

/* Search a pair chain for a particular key. */
pair *pair_with_key(pair *p, const char *key);

/* Change the data part of a pair. */
void set_pair_data(pair *p, size_t len, const void *data);

#endif /* __PAIR_H */
# Change User Description Committed
#1 450 sandy_currier Initial import of p4filter code.
 This contains a solaris2.6 binary but
no others.