xref: /netbsd-src/lib/libisns/isns_util.h (revision e0ab0cdfdc1e19879357e23979c550cc42bffedd)
1*e0ab0cdfSchristos /*	$NetBSD: isns_util.h,v 1.2 2011/08/17 10:08:43 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_util.h
34dc2ecebeSagc  */
35dc2ecebeSagc 
36dc2ecebeSagc #ifndef _ISNS_UTIL_H_
37dc2ecebeSagc #define _ISNS_UTIL_H_
38dc2ecebeSagc 
39dc2ecebeSagc #define isns_ntohs	ntohs
40dc2ecebeSagc #define isns_htons	htons
41dc2ecebeSagc #define isns_ntohl	ntohl
42dc2ecebeSagc #define isns_htonl	htonl
43dc2ecebeSagc 
44dc2ecebeSagc #define isns_malloc	malloc
45dc2ecebeSagc #define isns_free	free
46dc2ecebeSagc 
47dc2ecebeSagc 
48dc2ecebeSagc #define ARRAY_ELEMS(a)	(sizeof(a)/sizeof((a)[0]))
49dc2ecebeSagc 
50dc2ecebeSagc 
51*e0ab0cdfSchristos struct isns_config_s;
52dc2ecebeSagc int isns_issue_cmd(struct isns_config_s *, uint8_t);
53dc2ecebeSagc int isns_issue_cmd_with_data(struct isns_config_s *, uint8_t,
54dc2ecebeSagc     uint8_t *, int);
55dc2ecebeSagc 
56dc2ecebeSagc int isns_change_kevent_list(struct isns_config_s *,
57dc2ecebeSagc     uintptr_t, uint32_t, uint32_t, int64_t,
58dc2ecebeSagc     intptr_t);
59dc2ecebeSagc 
60dc2ecebeSagc struct isns_config_s *isns_new_config(void);
61dc2ecebeSagc void isns_destroy_config(struct isns_config_s *);
62dc2ecebeSagc 
63dc2ecebeSagc int isns_thread_create(struct isns_config_s *);
64dc2ecebeSagc void isns_thread_destroy(struct isns_config_s *);
65dc2ecebeSagc 
66dc2ecebeSagc void isns_process_connection_loss(struct isns_config_s *);
67dc2ecebeSagc 
68dc2ecebeSagc #endif /* !_ISNS_UTIL_H_ */
69