doi.h revision 1.8
1/*	$OpenBSD: doi.h,v 1.8 2000/02/25 17:23:39 niklas Exp $	*/
2/*	$EOM: doi.h,v 1.28 2000/02/20 19:58:37 niklas 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 * 3. All advertising materials mentioning features or use of this software
16 *    must display the following acknowledgement:
17 *	This product includes software developed by Ericsson Radio Systems.
18 * 4. The name of the author may not be used to endorse or promote products
19 *    derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * This code was written under funding by Ericsson Radio Systems.
35 */
36
37#ifndef _DOI_H_
38#define _DOI_H_
39
40#include <sys/types.h>
41#include <sys/queue.h>
42
43struct exchange;
44struct keystate;
45struct message;
46struct payload;
47struct proto;
48struct sa;
49
50/* XXX This structure needs per-field commenting.  */
51struct doi {
52  LIST_ENTRY (doi) link;
53  u_int8_t id;
54
55  /* Size of DOI-specific exchange data.  */
56  size_t exchange_size;
57
58  /* Size of DOI-specific security association data.  */
59  size_t sa_size;
60
61  /* Size of DOI-specific protocol data.  */
62  size_t proto_size;
63
64#ifdef USE_DEBUG
65  int (*debug_attribute) (u_int16_t, u_int8_t *, u_int16_t, void *);
66#endif
67  void (*delete_spi) (struct sa *, struct proto *, int);
68  u_int16_t *(*exchange_script) (u_int8_t);
69  void (*finalize_exchange) (struct message *);
70  void (*free_exchange_data) (void *);
71  void (*free_proto_data) (void *);
72  void (*free_sa_data) (void *);
73  struct keystate *(*get_keystate) (struct message *);
74  u_int8_t *(*get_spi) (size_t *, u_int8_t, struct message *);
75  int (*handle_leftover_payload) (struct message *, u_int8_t,
76				  struct payload *);
77  int (*informational_post_hook) (struct message *);
78  int (*informational_pre_hook) (struct message *);
79  int (*is_attribute_incompatible) (u_int16_t, u_int8_t *, u_int16_t, void *);
80  void (*proto_init) (struct proto *, char *);
81  void (*setup_situation) (u_int8_t *);
82  size_t (*situation_size) (void);
83  u_int8_t (*spi_size) (u_int8_t);
84  int (*validate_attribute) (u_int16_t, u_int8_t *, u_int16_t, void *);
85  int (*validate_exchange) (u_int8_t);
86  int (*validate_id_information) (u_int8_t, u_int8_t *, u_int8_t *, size_t,
87				  struct exchange *);
88  int (*validate_key_information) (u_int8_t *, size_t);
89  int (*validate_notification) (u_int16_t);
90  int (*validate_proto) (u_int8_t);
91  int (*validate_situation) (u_int8_t *, size_t *);
92  int (*validate_transform_id) (u_int8_t, u_int8_t);
93  int (*initiator) (struct message *msg);
94  int (*responder) (struct message *msg);
95};
96
97extern void doi_init (void);
98extern struct doi *doi_lookup (u_int8_t);
99extern void doi_register (struct doi *);
100
101#endif /* _DOI_H_ */
102