xref: /netbsd-src/lib/libisns/isns.h (revision 86343a2b663b93f1bd176af72dec24909a20a056)
1*86343a2bSchristos /*	$NetBSD: isns.h,v 1.2 2011/10/25 00:02:30 christos Exp $	*/
2dc2ecebeSagc 
3dc2ecebeSagc /*-
4dc2ecebeSagc  * Copyright (c) 2004,2009 The NetBSD Foundation, Inc.
5dc2ecebeSagc  * All rights reserved.
6dc2ecebeSagc  *
7dc2ecebeSagc  * This code is derived from software contributed to The NetBSD Foundation
8dc2ecebeSagc  * by Wasabi Systems, Inc.
9dc2ecebeSagc  *
10dc2ecebeSagc  * Redistribution and use in source and binary forms, with or without
11dc2ecebeSagc  * modification, are permitted provided that the following conditions
12dc2ecebeSagc  * are met:
13dc2ecebeSagc  * 1. Redistributions of source code must retain the above copyright
14dc2ecebeSagc  *    notice, this list of conditions and the following disclaimer.
15dc2ecebeSagc  * 2. Redistributions in binary form must reproduce the above copyright
16dc2ecebeSagc  *    notice, this list of conditions and the following disclaimer in the
17dc2ecebeSagc  *    documentation and/or other materials provided with the distribution.
18dc2ecebeSagc  *
19dc2ecebeSagc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20dc2ecebeSagc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21dc2ecebeSagc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22dc2ecebeSagc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23dc2ecebeSagc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24dc2ecebeSagc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25dc2ecebeSagc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26dc2ecebeSagc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27dc2ecebeSagc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28dc2ecebeSagc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29dc2ecebeSagc  * POSSIBILITY OF SUCH DAMAGE.
30dc2ecebeSagc  */
31dc2ecebeSagc 
32dc2ecebeSagc /*
33dc2ecebeSagc  * isns.h
34dc2ecebeSagc  */
35dc2ecebeSagc 
36dc2ecebeSagc #ifndef _ISNS_H_
37dc2ecebeSagc #define _ISNS_H_
38dc2ecebeSagc 
39dc2ecebeSagc #include <sys/types.h>
40dc2ecebeSagc #include <sys/time.h>
41dc2ecebeSagc 
42dc2ecebeSagc #include <netdb.h>
43dc2ecebeSagc #include <stdlib.h>
44dc2ecebeSagc 
45dc2ecebeSagc typedef void (*ISNS_HANDLE);
46dc2ecebeSagc typedef void (*ISNS_TRANS);
47dc2ecebeSagc 
48dc2ecebeSagc #define ISNS_INVALID_HANDLE	(ISNS_HANDLE)NULL
49dc2ecebeSagc #define ISNS_INVALID_TRANS	(ISNS_TRANS)NULL
50dc2ecebeSagc 
51dc2ecebeSagc #define ISNS_TLV_FIRST		0
52dc2ecebeSagc #define ISNS_TLV_NEXT		1
53dc2ecebeSagc 
54dc2ecebeSagc int isns_init(ISNS_HANDLE *, int);
55dc2ecebeSagc int isns_add_servercon(ISNS_HANDLE, int, struct addrinfo *);
56dc2ecebeSagc int isns_init_reg_refresh(ISNS_HANDLE, const char *, int);
57dc2ecebeSagc void isns_stop(ISNS_HANDLE);
58dc2ecebeSagc 
59dc2ecebeSagc ISNS_TRANS isns_new_trans(ISNS_HANDLE, uint16_t, uint16_t);
60dc2ecebeSagc void isns_free_trans(ISNS_TRANS);
61dc2ecebeSagc int isns_send_trans(ISNS_TRANS, const struct timespec *, uint32_t *);
62*86343a2bSchristos int isns_add_tlv(ISNS_TRANS, uint32_t, uint32_t, const void *);
63*86343a2bSchristos int isns_get_tlv(ISNS_TRANS, int, uint32_t *, uint32_t *, void **);
64dc2ecebeSagc 
65dc2ecebeSagc int	isns_add_string(ISNS_TRANS, uint32_t, const char *);
66dc2ecebeSagc 
67dc2ecebeSagc #endif /* !_ISNS_H_ */
68