doi.h revision 1.12
1/*	$OpenBSD: doi.h,v 1.12 2004/03/10 23:08:48 hshoexer Exp $	*/
2/*	$EOM: doi.h,v 1.29 2000/07/02 18:47:15 provos Exp $	*/
3
4/*
5 * Copyright (c) 1998, 1999 Niklas Hallqvist.  All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/*
29 * This code was written under funding by Ericsson Radio Systems.
30 */
31
32#ifndef _DOI_H_
33#define _DOI_H_
34
35#include <sys/types.h>
36#include <sys/queue.h>
37
38struct exchange;
39struct keystate;
40struct message;
41struct payload;
42struct proto;
43struct sa;
44
45/* XXX This structure needs per-field commenting.  */
46struct doi {
47  LIST_ENTRY (doi) link;
48  u_int8_t id;
49
50  /* Size of DOI-specific exchange data.  */
51  size_t exchange_size;
52
53  /* Size of DOI-specific security association data.  */
54  size_t sa_size;
55
56  /* Size of DOI-specific protocol data.  */
57  size_t proto_size;
58
59#ifdef USE_DEBUG
60  int (*debug_attribute) (u_int16_t, u_int8_t *, u_int16_t, void *);
61#endif
62  void (*delete_spi) (struct sa *, struct proto *, int);
63  int16_t *(*exchange_script) (u_int8_t);
64  void (*finalize_exchange) (struct message *);
65  void (*free_exchange_data) (void *);
66  void (*free_proto_data) (void *);
67  void (*free_sa_data) (void *);
68  struct keystate *(*get_keystate) (struct message *);
69  u_int8_t *(*get_spi) (size_t *, u_int8_t, struct message *);
70  int (*handle_leftover_payload) (struct message *, u_int8_t,
71				  struct payload *);
72  int (*informational_post_hook) (struct message *);
73  int (*informational_pre_hook) (struct message *);
74  int (*is_attribute_incompatible) (u_int16_t, u_int8_t *, u_int16_t, void *);
75  void (*proto_init) (struct proto *, char *);
76  void (*setup_situation) (u_int8_t *);
77  size_t (*situation_size) (void);
78  u_int8_t (*spi_size) (u_int8_t);
79  int (*validate_attribute) (u_int16_t, u_int8_t *, u_int16_t, void *);
80  int (*validate_exchange) (u_int8_t);
81  int (*validate_id_information) (u_int8_t, u_int8_t *, u_int8_t *, size_t,
82				  struct exchange *);
83  int (*validate_key_information) (u_int8_t *, size_t);
84  int (*validate_notification) (u_int16_t);
85  int (*validate_proto) (u_int8_t);
86  int (*validate_situation) (u_int8_t *, size_t *, size_t);
87  int (*validate_transform_id) (u_int8_t, u_int8_t);
88  int (*initiator) (struct message *msg);
89  int (*responder) (struct message *msg);
90  char *(*decode_ids) (char *, u_int8_t *, size_t, u_int8_t *, size_t, int);
91};
92
93extern void doi_init (void);
94extern struct doi *doi_lookup (u_int8_t);
95extern void doi_register (struct doi *);
96
97#endif /* _DOI_H_ */
98