1*14bba3c6Sderaadt /* $OpenBSD: doi.h,v 1.15 2005/04/08 19:40:02 deraadt Exp $ */ 29796240cSniklas /* $EOM: doi.h,v 1.29 2000/07/02 18:47:15 provos Exp $ */ 32040585eSniklas 42040585eSniklas /* 5eb840acdSniklas * Copyright (c) 1998, 1999 Niklas Hallqvist. All rights reserved. 62040585eSniklas * 72040585eSniklas * Redistribution and use in source and binary forms, with or without 82040585eSniklas * modification, are permitted provided that the following conditions 92040585eSniklas * are met: 102040585eSniklas * 1. Redistributions of source code must retain the above copyright 112040585eSniklas * notice, this list of conditions and the following disclaimer. 122040585eSniklas * 2. Redistributions in binary form must reproduce the above copyright 132040585eSniklas * notice, this list of conditions and the following disclaimer in the 142040585eSniklas * documentation and/or other materials provided with the distribution. 152040585eSniklas * 162040585eSniklas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 172040585eSniklas * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 182040585eSniklas * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 192040585eSniklas * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 202040585eSniklas * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 212040585eSniklas * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222040585eSniklas * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232040585eSniklas * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242040585eSniklas * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 252040585eSniklas * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262040585eSniklas */ 272040585eSniklas 282040585eSniklas /* 292040585eSniklas * This code was written under funding by Ericsson Radio Systems. 302040585eSniklas */ 312040585eSniklas 322040585eSniklas #ifndef _DOI_H_ 332040585eSniklas #define _DOI_H_ 342040585eSniklas 352040585eSniklas #include <sys/types.h> 362040585eSniklas #include <sys/queue.h> 372040585eSniklas 382040585eSniklas struct exchange; 392040585eSniklas struct keystate; 402040585eSniklas struct message; 414013cc22Sniklas struct payload; 422040585eSniklas struct proto; 432040585eSniklas struct sa; 442040585eSniklas 452040585eSniklas /* XXX This structure needs per-field commenting. */ 462040585eSniklas struct doi { 472040585eSniklas LIST_ENTRY(doi) link; 482040585eSniklas u_int8_t id; 492040585eSniklas 502040585eSniklas /* Size of DOI-specific exchange data. */ 512040585eSniklas size_t exchange_size; 522040585eSniklas 532040585eSniklas /* Size of DOI-specific security association data. */ 542040585eSniklas size_t sa_size; 552040585eSniklas 562040585eSniklas /* Size of DOI-specific protocol data. */ 572040585eSniklas size_t proto_size; 582040585eSniklas 59df915834Shshoexer int (*debug_attribute)(u_int16_t, u_int8_t *, u_int16_t, 60df915834Shshoexer void *); 612040585eSniklas void (*delete_spi)(struct sa *, struct proto *, int); 62b26670e8Sho int16_t *(*exchange_script)(u_int8_t); 632040585eSniklas void (*finalize_exchange)(struct message *); 642040585eSniklas void (*free_exchange_data)(void *); 652040585eSniklas void (*free_proto_data)(void *); 662040585eSniklas void (*free_sa_data)(void *); 672040585eSniklas struct keystate *(*get_keystate)(struct message *); 682040585eSniklas u_int8_t *(*get_spi)(size_t *, u_int8_t, struct message *); 694013cc22Sniklas int (*handle_leftover_payload)(struct message *, u_int8_t, 704013cc22Sniklas struct payload *); 71ad336730Sniklas int (*informational_post_hook)(struct message *); 72ad336730Sniklas int (*informational_pre_hook)(struct message *); 73df915834Shshoexer int (*is_attribute_incompatible)(u_int16_t, u_int8_t *, 74df915834Shshoexer u_int16_t, void *); 751ae42e56Sniklas void (*proto_init)(struct proto *, char *); 762040585eSniklas void (*setup_situation)(u_int8_t *); 772040585eSniklas size_t (*situation_size)(void); 782040585eSniklas u_int8_t (*spi_size)(u_int8_t); 79df915834Shshoexer int (*validate_attribute)(u_int16_t, u_int8_t *, 80df915834Shshoexer u_int16_t, void *); 812040585eSniklas int (*validate_exchange)(u_int8_t); 82df915834Shshoexer int (*validate_id_information)(u_int8_t, u_int8_t *, 83df915834Shshoexer u_int8_t *, size_t, struct exchange *); 842040585eSniklas int (*validate_key_information)(u_int8_t *, size_t); 852040585eSniklas int (*validate_notification)(u_int16_t); 862040585eSniklas int (*validate_proto)(u_int8_t); 876153a28bShshoexer int (*validate_situation)(u_int8_t *, size_t *, size_t); 882040585eSniklas int (*validate_transform_id)(u_int8_t, u_int8_t); 892040585eSniklas int (*initiator)(struct message * msg); 902040585eSniklas int (*responder)(struct message * msg); 91df915834Shshoexer char *(*decode_ids)(char *, u_int8_t *, size_t, u_int8_t *, 92df915834Shshoexer size_t, int); 932040585eSniklas }; 942040585eSniklas 952040585eSniklas extern void doi_init(void); 962040585eSniklas extern struct doi *doi_lookup(u_int8_t); 972040585eSniklas extern void doi_register(struct doi *); 982040585eSniklas 992040585eSniklas #endif /* _DOI_H_ */ 100