OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / pluto / db_ops.h
1 /*      $Id: db_ops.h,v 1.1 2002-07-15 05:55:21 danield Exp $   */
2 #ifndef _DB_OPS_H
3 #define _DB_OPS_H
4 /*
5  *      Main db object, (quite proposal "oriented")
6  */
7 #ifndef NO_DB_CONTEXT
8 struct db_context {
9         struct db_prop prop;            /* proposal buffer (not pointer) */
10         struct db_trans *trans0;        /* transf. list, dynamically sized */
11         struct db_trans *trans_cur;     /* current transform ptr */
12         struct db_attr *attrs0;         /* attr. list, dynamically sized */
13         struct db_attr *attrs_cur;      /* current attribute ptr */
14         int max_trans;                  /* size of trans list */
15         int max_attrs;                  /* size of attrs list */
16 };
17 /*
18  *      Allocate a new db object
19  */
20 struct db_context * db_prop_new(u_int8_t protoid, int max_trans, int max_attrs);
21 /*      Initialize object for proposal building  */
22 int db_prop_init(struct db_context *ctx, u_int8_t protoid, int max_trans, int max_attrs);
23 /*      Free all resourses for this db */
24 void db_destroy(struct db_context *ctx);
25
26 /*      Start a new transform */
27 int db_trans_add(struct db_context *ctx, u_int8_t transid);
28 /*      Add a new attribute by copying db_attr content */
29 int db_attr_add(struct db_context *db_ctx, const struct db_attr *attr);
30 /*      Add a new attribute by value */
31 int db_attr_add_values(struct db_context *ctx,  u_int16_t type, u_int16_t val);
32
33 /*      Get proposal from db object */
34 static __inline__ struct db_prop *db_prop_get(struct db_context *ctx) {
35         return &ctx->prop;
36 }
37 #endif /* NO_DB_CONTEXT */
38 int db_ops_show_status(void);
39 #endif /* _DB_OPS_H */