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