[PATCH 0/3] open-isns: prepare for external use by open-iscsi

14 views
Skip to first unread message

leeman...@gmail.com

unread,
Jul 13, 2015, 5:57:45 PM7/13/15
to open-...@googlegroups.com, Lee Duncan
From: Lee Duncan <ldu...@suse.com>

This group of patches is for open-isns, and the current procedure for
changes to open-isns is to share them on the open-iscsi mailing list.

The goal of these patches is to make open-isns a stand-alone package
that can be used by other (like open-iscsi). This way clients don't
have to have their own (possibly stale) copies of these files.

NOTE: there are NO FUNCTIONAL CHANGES here, just:
* moving some inclue files locally to include/libisns directory
* changing all users of include files to know new location
* Adding "install_lib" and "install_hdrs" Makefile targets

This has been tested with open-iscsn and seems to work.

Lee Duncan (3):
Move public inlcude files to <libisns/*.h>
Make one more include file public.
Add test binaries as 'make clean' targets.

Makefile.in | 27 +-
attrs.c | 6 +-
attrs.h | 262 -----------------
authblock.c | 8 +-
bitvector.c | 4 +-
buffer.c | 4 +-
buffer.h | 141 ---------
callback.c | 6 +-
client.c | 4 +-
config.c | 6 +-
db-file.c | 6 +-
db-policy.c | 4 +-
db.c | 4 +-
db.h | 2 +-
dd.c | 8 +-
deregister.c | 8 +-
domain.c | 4 +-
entity.c | 4 +-
error.c | 2 +-
esi.c | 8 +-
export.c | 8 +-
getnext.c | 8 +-
include/libisns/attrs.h | 262 +++++++++++++++++
include/libisns/buffer.h | 141 +++++++++
include/libisns/isns-proto.h | 259 +++++++++++++++++
include/libisns/isns.h | 676 +++++++++++++++++++++++++++++++++++++++++++
include/libisns/message.h | 196 +++++++++++++
include/libisns/paths.h | 24 ++
include/libisns/source.h | 32 ++
include/libisns/types.h | 57 ++++
include/libisns/util.h | 288 ++++++++++++++++++
isns-proto.h | 259 -----------------
isns.h | 676 -------------------------------------------
isnsadm.c | 8 +-
isnsd.c | 6 +-
isnsdd.c | 10 +-
local.c | 12 +-
logging.c | 2 +-
mdebug.c | 2 +-
message.c | 8 +-
message.h | 196 -------------
objects.c | 8 +-
objects.h | 4 +-
parser.c | 2 +-
paths.h | 24 --
pidfile.c | 2 +-
pki.c | 4 +-
policy.c | 6 +-
portal-group.c | 6 +-
query.c | 8 +-
register.c | 8 +-
relation.c | 4 +-
scn.c | 8 +-
scope.c | 8 +-
security.c | 6 +-
security.h | 4 +-
server.c | 6 +-
simple.c | 8 +-
slp.c | 4 +-
socket.c | 6 +-
socket.h | 6 +-
source.h | 32 --
storage-node.c | 4 +-
sysdep-unix.c | 4 +-
tags.c | 6 +-
tests/pauw1.c | 8 +-
tests/pauw2.c | 8 +-
tests/pauw3.c | 8 +-
tests/pauw4.c | 8 +-
timer.c | 4 +-
types.h | 57 ----
util.c | 2 +-
util.h | 288 ------------------
vendor.c | 6 +-
vendor.h | 2 +-
75 files changed, 2121 insertions(+), 2096 deletions(-)
delete mode 100644 attrs.h
delete mode 100644 buffer.h
create mode 100644 include/libisns/attrs.h
create mode 100644 include/libisns/buffer.h
create mode 100644 include/libisns/isns-proto.h
create mode 100644 include/libisns/isns.h
create mode 100644 include/libisns/message.h
create mode 100644 include/libisns/paths.h
create mode 100644 include/libisns/source.h
create mode 100644 include/libisns/types.h
create mode 100644 include/libisns/util.h
delete mode 100644 isns-proto.h
delete mode 100644 isns.h
delete mode 100644 message.h
delete mode 100644 paths.h
delete mode 100644 source.h
delete mode 100644 types.h
delete mode 100644 util.h

--
2.1.4

leeman...@gmail.com

unread,
Jul 13, 2015, 5:57:45 PM7/13/15
to open-...@googlegroups.com, Lee Duncan
From: Lee Duncan <ldu...@suse.com>

---
Makefile.in | 1 +
1 file changed, 1 insertion(+)

diff --git a/Makefile.in b/Makefile.in
index 8ccb96e4b4f7..91f55c2832e4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -114,6 +114,7 @@ install_lib: $(LIB)

clean distclean::
rm -f *.o $(LIB) isnsd isnsadm isnsdd bitvector *~
+ $(RM) $(TESTS)

distclean::
rm -f config.h Makefile config.status config.log
--
2.1.4

leeman...@gmail.com

unread,
Jul 13, 2015, 5:57:45 PM7/13/15
to open-...@googlegroups.com, Lee Duncan
From: Lee Duncan <ldu...@suse.com>

Missed include file buffer.h on the first round.
These changes will support other clients, like
open-iscsi, using include files from isns rather
than their own copies.
---
Makefile.in | 24 ++++++++
buffer.c | 2 +-
buffer.h | 141 -----------------------------------------------
include/libisns/attrs.h | 2 +-
include/libisns/buffer.h | 141 +++++++++++++++++++++++++++++++++++++++++++++++
security.h | 2 +-
socket.c | 2 +-
socket.h | 2 +-
8 files changed, 170 insertions(+), 146 deletions(-)
delete mode 100644 buffer.h
create mode 100644 include/libisns/buffer.h

diff --git a/Makefile.in b/Makefile.in
index 674ff55204dc..8ccb96e4b4f7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2,16 +2,20 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
mandir = @mandir@
+libdir = @libdir@
etcdir = /etc
vardir = /var/lib/isns
systemddir = $(prefix)/lib/systemd/system
datarootdir = @datarootdir@
+includedir = @includedir@

SBINDIR = $(DESTDIR)$(sbindir)
CFGDIR = $(DESTDIR)$(etcdir)/isns
MANDIR = $(DESTDIR)$(mandir)
VARDIR = $(DESTDIR)$(vardir)
SYSTEMDDIR = $(DESTDIR)$(systemddir)
+LIBDIR = $(DESTDIR)$(libdir)
+INCDIR = $(DESTDIR)$(includedir)/libisns

CC = @CC@
CPPFLAGS= @CPPFLAGS@
@@ -63,6 +67,16 @@ LIBOBJS = server.o \
util.o \
bitvector.o \
mdebug.o
+HDRS = include/libisns/attrs.h \
+ include/libisns/buffer.h \
+ include/libisns/isns.h \
+ include/libisns/isns-proto.h \
+ include/libisns/message.h \
+ include/libisns/paths.h \
+ include/libisns/source.h \
+ include/libisns/types.h \
+ include/libisns/util.h
+
SECLINK = @SECLIBS@
SLPLINK = @SLPLIBS@
SLPLIN = @SLPLIBS@
@@ -88,6 +102,16 @@ install:
$(INSTALL) -m 644 isnsd.service $(SYSTEMDDIR)
$(INSTALL) -m 644 isnsd.socket $(SYSTEMDDIR)

+install_hdrs:
+ @echo '*** Installing Open-iSNS header files ***'
+ $(INSTALL) -m 755 -d $(INCDIR)
+ $(INSTALL) -m 644 $(HDRS) $(INCDIR)
+
+install_lib: $(LIB)
+ @echo '*** Installing Open-iSNS developer files ***'
+ $(INSTALL) -m 755 -d $(LIBDIR)
+ $(INSTALL) -m 644 $(LIB) $(LIBDIR)
+
clean distclean::
rm -f *.o $(LIB) isnsd isnsadm isnsdd bitvector *~

diff --git a/buffer.c b/buffer.c
index 503d4ce48839..8e8e5af06746 100644
--- a/buffer.c
+++ b/buffer.c
@@ -11,7 +11,7 @@
#include <err.h>
#include <unistd.h>
#include <netinet/in.h> /* ntohl&htonl */
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/util.h> /* htonll */

static int buf_drain(buf_t *bp);
diff --git a/buffer.h b/buffer.h
deleted file mode 100644
index 75ba9108d066..000000000000
--- a/buffer.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Buffer handling functions
- *
- * Copyright (C) 2003-2006, Olaf Kirch <olaf....@oracle.com>
- */
-
-#ifndef BUFFER_H
-#define BUFFER_H
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdint.h>
-
-typedef struct isns_buf {
- struct isns_buf * next;
- unsigned char * base;
- unsigned int head, tail, size, max_size;
- unsigned int write_mode : 1,
- allocated : 1;
- int fd;
-
- /* Anonymous union for misc stuff */
- union {
- struct {
- struct sockaddr_storage addr;
- socklen_t addrlen;
- };
- };
-} buf_t;
-
-extern buf_t * buf_open(const char *, int);
-extern buf_t * buf_alloc(size_t);
-extern buf_t * buf_dup(const buf_t *);
-extern void buf_init(buf_t *, void *, size_t);
-extern void buf_init_empty(buf_t *, size_t);
-extern void buf_set(buf_t *, void *, size_t);
-
-extern void buf_clear(buf_t *);
-extern void buf_close(buf_t *);
-extern void buf_destroy(buf_t *);
-extern void buf_free(buf_t *);
-extern void buf_list_free(buf_t *);
-
-extern int buf_get(buf_t *, void *, size_t);
-extern int buf_get32(buf_t *, uint32_t *);
-extern int buf_get64(buf_t *, uint64_t *);
-extern int buf_gets(buf_t *, char *, size_t);
-extern int buf_put(buf_t *, const void *, size_t);
-extern int buf_put32(buf_t *, uint32_t);
-extern int buf_put64(buf_t *, uint64_t);
-extern int buf_puts(buf_t *, const char *);
-extern int buf_putc(buf_t *, int);
-extern int buf_read(buf_t *, int);
-extern int buf_seek(buf_t *bp, off_t offset);
-extern int buf_truncate(buf_t *, size_t);
-extern void buf_compact(buf_t *);
-extern buf_t * buf_split(buf_t **to_split, size_t len);
-extern int __buf_resize(buf_t *, size_t);
-
-extern void buf_list_append(buf_t **, buf_t *);
-
-static inline size_t
-buf_avail(const buf_t *bp)
-{
- return bp->tail - bp->head;
-}
-
-static inline size_t
-buf_tailroom(const buf_t *bp)
-{
- return bp->max_size - bp->tail;
-}
-
-static inline size_t
-buf_size(const buf_t *bp)
-{
- return bp->size;
-}
-
-static inline void *
-buf_head(const buf_t *bp)
-{
- return bp->base + bp->head;
-}
-
-static inline void *
-buf_tail(const buf_t *bp)
-{
- return bp->base + bp->tail;
-}
-
-static inline int
-buf_reserve(buf_t *bp, size_t len)
-{
- if (bp->head != bp->tail)
- return 0;
- if (bp->max_size - bp->head < len)
- return 0;
- bp->head += len;
- bp->tail += len;
- return 1;
-}
-
-static inline int
-buf_pull(buf_t *bp, size_t len)
-{
- if (len > buf_avail(bp))
- return 0;
- bp->head += len;
- return 1;
-}
-
-static inline void *
-buf_push(buf_t *bp, size_t len)
-{
- if (bp->max_size - bp->tail < len)
- return NULL;
-
- if (bp->tail + len > bp->size
- && !__buf_resize(bp, bp->tail + len))
- return NULL;
-
- bp->tail += len;
- return bp->base + bp->tail - len;
-}
-
-static inline void *
-buf_push_head(buf_t *bp, size_t len)
-{
- if (bp->head < len)
- return NULL;
-
- if (bp->tail > bp->size
- && !__buf_resize(bp, bp->tail))
- return NULL;
-
- bp->head -= len;
- return bp->base + bp->head;
-}
-
-#endif /* BUFFER_H */
diff --git a/include/libisns/attrs.h b/include/libisns/attrs.h
index d137886cf2de..e10f1d839915 100644
--- a/include/libisns/attrs.h
+++ b/include/libisns/attrs.h
@@ -8,7 +8,7 @@
#define ISNS_ATTRS_H

#include <netinet/in.h>
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/isns.h>

/*
diff --git a/include/libisns/buffer.h b/include/libisns/buffer.h
new file mode 100644
index 000000000000..75ba9108d066
--- /dev/null
+++ b/include/libisns/buffer.h
@@ -0,0 +1,141 @@
+/*
+ * Buffer handling functions
+ *
+ * Copyright (C) 2003-2006, Olaf Kirch <olaf....@oracle.com>
+ */
+
+#ifndef BUFFER_H
+#define BUFFER_H
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdint.h>
+
+typedef struct isns_buf {
+ struct isns_buf * next;
+ unsigned char * base;
+ unsigned int head, tail, size, max_size;
+ unsigned int write_mode : 1,
+ allocated : 1;
+ int fd;
+
+ /* Anonymous union for misc stuff */
+ union {
+ struct {
+ struct sockaddr_storage addr;
+ socklen_t addrlen;
+ };
+ };
+} buf_t;
+
+extern buf_t * buf_open(const char *, int);
+extern buf_t * buf_alloc(size_t);
+extern buf_t * buf_dup(const buf_t *);
+extern void buf_init(buf_t *, void *, size_t);
+extern void buf_init_empty(buf_t *, size_t);
+extern void buf_set(buf_t *, void *, size_t);
+
+extern void buf_clear(buf_t *);
+extern void buf_close(buf_t *);
+extern void buf_destroy(buf_t *);
+extern void buf_free(buf_t *);
+extern void buf_list_free(buf_t *);
+
+extern int buf_get(buf_t *, void *, size_t);
+extern int buf_get32(buf_t *, uint32_t *);
+extern int buf_get64(buf_t *, uint64_t *);
+extern int buf_gets(buf_t *, char *, size_t);
+extern int buf_put(buf_t *, const void *, size_t);
+extern int buf_put32(buf_t *, uint32_t);
+extern int buf_put64(buf_t *, uint64_t);
+extern int buf_puts(buf_t *, const char *);
+extern int buf_putc(buf_t *, int);
+extern int buf_read(buf_t *, int);
+extern int buf_seek(buf_t *bp, off_t offset);
+extern int buf_truncate(buf_t *, size_t);
+extern void buf_compact(buf_t *);
+extern buf_t * buf_split(buf_t **to_split, size_t len);
+extern int __buf_resize(buf_t *, size_t);
+
+extern void buf_list_append(buf_t **, buf_t *);
+
+static inline size_t
+buf_avail(const buf_t *bp)
+{
+ return bp->tail - bp->head;
+}
+
+static inline size_t
+buf_tailroom(const buf_t *bp)
+{
+ return bp->max_size - bp->tail;
+}
+
+static inline size_t
+buf_size(const buf_t *bp)
+{
+ return bp->size;
+}
+
+static inline void *
+buf_head(const buf_t *bp)
+{
+ return bp->base + bp->head;
+}
+
+static inline void *
+buf_tail(const buf_t *bp)
+{
+ return bp->base + bp->tail;
+}
+
+static inline int
+buf_reserve(buf_t *bp, size_t len)
+{
+ if (bp->head != bp->tail)
+ return 0;
+ if (bp->max_size - bp->head < len)
+ return 0;
+ bp->head += len;
+ bp->tail += len;
+ return 1;
+}
+
+static inline int
+buf_pull(buf_t *bp, size_t len)
+{
+ if (len > buf_avail(bp))
+ return 0;
+ bp->head += len;
+ return 1;
+}
+
+static inline void *
+buf_push(buf_t *bp, size_t len)
+{
+ if (bp->max_size - bp->tail < len)
+ return NULL;
+
+ if (bp->tail + len > bp->size
+ && !__buf_resize(bp, bp->tail + len))
+ return NULL;
+
+ bp->tail += len;
+ return bp->base + bp->tail - len;
+}
+
+static inline void *
+buf_push_head(buf_t *bp, size_t len)
+{
+ if (bp->head < len)
+ return NULL;
+
+ if (bp->tail > bp->size
+ && !__buf_resize(bp, bp->tail))
+ return NULL;
+
+ bp->head -= len;
+ return bp->base + bp->head;
+}
+
+#endif /* BUFFER_H */
diff --git a/security.h b/security.h
index bbab3fe73631..b55800351493 100644
--- a/security.h
+++ b/security.h
@@ -8,7 +8,7 @@
#define ISNS_SECURITY_H

#include <openssl/evp.h>
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/util.h>

/*
diff --git a/socket.c b/socket.c
index bd6d6b441077..4f16fe68b7b5 100644
--- a/socket.c
+++ b/socket.c
@@ -20,7 +20,7 @@
#include <fcntl.h>

#include "config.h"
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/isns.h>
#include "socket.h"
#include "security.h"
diff --git a/socket.h b/socket.h
index a721a3b3c81f..364fa659ad3c 100644
--- a/socket.h
+++ b/socket.h
@@ -8,7 +8,7 @@
#define ISNS_SOCKET_H

#include <libisns/isns.h>
-#include "buffer.h"
+#include <libisns/buffer.h>
#include <libisns/message.h>

struct isns_partial_msg {
--
2.1.4

leeman...@gmail.com

unread,
Jul 13, 2015, 5:57:46 PM7/13/15
to open-...@googlegroups.com, Lee Duncan
From: Lee Duncan <ldu...@suse.com>

This move allows other clients (like open-iscsi) to
access the include files they need to use libisns.a.
---
Makefile.in | 2 +-
attrs.c | 6 +-
attrs.h | 262 -----------------
authblock.c | 8 +-
bitvector.c | 4 +-
buffer.c | 2 +-
callback.c | 6 +-
client.c | 4 +-
config.c | 6 +-
db-file.c | 6 +-
db-policy.c | 4 +-
db.c | 4 +-
db.h | 2 +-
dd.c | 8 +-
deregister.c | 8 +-
domain.c | 4 +-
entity.c | 4 +-
error.c | 2 +-
esi.c | 8 +-
export.c | 8 +-
getnext.c | 8 +-
include/libisns/attrs.h | 262 +++++++++++++++++
security.h | 2 +-
server.c | 6 +-
simple.c | 8 +-
slp.c | 4 +-
socket.c | 4 +-
socket.h | 4 +-
source.h | 32 --
storage-node.c | 4 +-
sysdep-unix.c | 4 +-
tags.c | 6 +-
tests/pauw1.c | 8 +-
tests/pauw2.c | 8 +-
tests/pauw3.c | 8 +-
tests/pauw4.c | 8 +-
timer.c | 4 +-
types.h | 57 ----
util.c | 2 +-
util.h | 288 ------------------
vendor.c | 6 +-
vendor.h | 2 +-
73 files changed, 1951 insertions(+), 1951 deletions(-)
delete mode 100644 attrs.h
create mode 100644 include/libisns/attrs.h
create mode 100644 include/libisns/isns-proto.h
create mode 100644 include/libisns/isns.h
create mode 100644 include/libisns/message.h
create mode 100644 include/libisns/paths.h
create mode 100644 include/libisns/source.h
create mode 100644 include/libisns/types.h
create mode 100644 include/libisns/util.h
delete mode 100644 isns-proto.h
delete mode 100644 isns.h
delete mode 100644 message.h
delete mode 100644 paths.h
delete mode 100644 source.h
delete mode 100644 types.h
delete mode 100644 util.h

diff --git a/Makefile.in b/Makefile.in
index 270c67fc2316..674ff55204dc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -15,7 +15,7 @@ SYSTEMDDIR = $(DESTDIR)$(systemddir)

CC = @CC@
CPPFLAGS= @CPPFLAGS@
-CFLAGS = @CFLAGS@ -I.
+CFLAGS = @CFLAGS@ -I. -Iinclude
LDFLAGS = @LDFLAGS@
INSTALL = @INSTALL@

diff --git a/attrs.c b/attrs.c
index 12517c11bfed..ac9b5249a25d 100644
--- a/attrs.c
+++ b/attrs.c
@@ -7,10 +7,10 @@
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
-#include "util.h"
+#include <libisns/util.h>
#include "vendor.h"
-#include "attrs.h"
-#include "isns.h"
+#include <libisns/attrs.h>
+#include <libisns/isns.h>

/* Implementation limit - sanity checking */
#define ISNS_ATTR_MAX_LEN 8192
diff --git a/attrs.h b/attrs.h
deleted file mode 100644
index 1d3667efb2dc..000000000000
--- a/attrs.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * iSNS object attributes
- *
- * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
- */
-
-#ifndef ISNS_ATTRS_H
-#define ISNS_ATTRS_H
-
-#include <netinet/in.h>
-#include "buffer.h"
-#include "isns.h"
-
-/*
- * Type identifier
- */
-enum {
- ISNS_ATTR_TYPE_NIL = 0,
- ISNS_ATTR_TYPE_OPAQUE,
- ISNS_ATTR_TYPE_STRING,
- ISNS_ATTR_TYPE_INT32,
- ISNS_ATTR_TYPE_UINT32,
- ISNS_ATTR_TYPE_UINT64,
- ISNS_ATTR_TYPE_IPADDR,
- ISNS_ATTR_TYPE_RANGE16,
-
- __ISNS_ATTR_TYPE_BUILTIN_MAX
-};
-
-/*
- * Union holding an attribute value
- */
-typedef struct isns_value {
- const struct isns_attr_type * iv_type;
-
- /* Data is stuffed into an anonymous union */
- union {
- uint32_t iv_nil;
- struct __isns_opaque {
- void * ptr;
- size_t len;
- } iv_opaque;
- char * iv_string;
- int32_t iv_int32;
- uint32_t iv_uint32;
- uint64_t iv_uint64;
- struct in6_addr iv_ipaddr;
- struct {
- uint16_t min, max;
- } iv_range;
- };
-} isns_value_t;
-
-#define __ISNS_ATTRTYPE(type) isns_attr_type_##type
-#define __ISNS_MEMBER(type) iv_##type
-#define ISNS_VALUE_INIT(type, value) \
- (isns_value_t) { .iv_type = &__ISNS_ATTRTYPE(type), \
- { .__ISNS_MEMBER(type) = (value) } }
-
-#define isns_attr_initialize(attrp, tag, type, value) do { \
- isns_attr_t *__attr = (attrp); \
- uint32_t __tag = (tag); \
- __attr->ia_users = 1; \
- __attr->ia_tag_id = (__tag); \
- __attr->ia_tag = isns_tag_type_by_id(__tag); \
- __attr->ia_value = ISNS_VALUE_INIT(type, value); \
- } while (0)
-#define ISNS_ATTR_INIT(tag, type, value) (isns_attr_t) { \
- .ia_users = 1, \
- .ia_tag_id = (tag), \
- .ia_tag = isns_tag_type_by_id(tag), \
- .ia_value = ISNS_VALUE_INIT(type, value) \
- }
-
-/*
- * Attribute type
- */
-typedef struct isns_attr_type {
- uint32_t it_id;
- const char * it_name;
-
- void (*it_assign)(isns_value_t *, const isns_value_t *);
- int (*it_set)(isns_value_t *, const void *);
- int (*it_get)(isns_value_t *, void *);
- int (*it_match)(const isns_value_t *, const isns_value_t *);
- int (*it_compare)(const isns_value_t *, const isns_value_t *);
- int (*it_encode)(buf_t *, const isns_value_t *);
- int (*it_decode)(buf_t *, size_t, isns_value_t *);
- void (*it_destroy)(isns_value_t *);
- void (*it_print)(const isns_value_t *, char *, size_t);
- int (*it_parse)(isns_value_t *, const char *);
-} isns_attr_type_t;
-
-/*
- * Tag info: for each tag, provides a printable name,
- * and the attribute type associated with it.
- */
-struct isns_tag_type {
- uint32_t it_id;
- const char * it_name;
- unsigned int it_multiple : 1,
- it_readonly : 1;
- isns_attr_type_t *it_type;
-
- int (*it_validate)(const isns_value_t *,
- const isns_policy_t *);
- void (*it_print)(const isns_value_t *, char *, size_t);
- int (*it_parse)(isns_value_t *, const char *);
- const char * (*it_help)(void);
-};
-
-/*
- * Attribute
- */
-struct isns_attr {
- unsigned int ia_users;
- uint32_t ia_tag_id;
- const isns_tag_type_t * ia_tag;
- isns_value_t ia_value;
-};
-
-extern isns_attr_type_t isns_attr_type_nil;
-extern isns_attr_type_t isns_attr_type_opaque;
-extern isns_attr_type_t isns_attr_type_string;
-extern isns_attr_type_t isns_attr_type_int32;
-extern isns_attr_type_t isns_attr_type_uint32;
-extern isns_attr_type_t isns_attr_type_uint64;
-extern isns_attr_type_t isns_attr_type_ipaddr;
-extern isns_attr_type_t isns_attr_type_range16;
-
-extern isns_attr_t * isns_attr_alloc(uint32_t, const isns_tag_type_t *,
- const isns_value_t *);
-
-extern void isns_attr_list_append_value(isns_attr_list_t *,
- uint32_t tag, const isns_tag_type_t *,
- const isns_value_t *);
-extern void isns_attr_list_update_value(isns_attr_list_t *,
- uint32_t tag, const isns_tag_type_t *,
- const isns_value_t *);
-extern int isns_attr_list_get_value(const isns_attr_list_t *,
- uint32_t tag,
- isns_value_t *);
-extern int isns_attr_list_get_uint32(const isns_attr_list_t *,
- uint32_t tag,
- uint32_t *);
-extern int isns_attr_list_get_string(const isns_attr_list_t *,
- uint32_t tag,
- const char **);
-
-extern int isns_attr_list_validate(const isns_attr_list_t *,
- const isns_policy_t *,
- unsigned int function);
-extern int isns_attr_validate(const isns_attr_t *,
- const isns_policy_t *);
-
-extern void isns_attr_list_prune(isns_attr_list_t *,
- const uint32_t *,
- unsigned int);
-extern int isns_attr_list_remove_member(isns_attr_list_t *,
- const isns_attr_t *,
- const uint32_t *);
-extern void isns_attr_list_update_attr(isns_attr_list_t *,
- const isns_attr_t *);
-
-extern int isns_attr_decode(buf_t *, isns_attr_t **);
-extern int isns_attr_encode(buf_t *, const isns_attr_t *);
-
-extern int isns_attr_list_decode(buf_t *, isns_attr_list_t *);
-extern int isns_attr_list_decode_delimited(buf_t *, isns_attr_list_t *);
-extern int isns_attr_list_encode(buf_t *, const isns_attr_list_t *);
-extern int isns_encode_delimiter(buf_t *);
-
-extern const isns_tag_type_t *isns_tag_type_by_id(unsigned int);
-extern const isns_attr_type_t *isns_attr_type_by_id(unsigned int);
-
-typedef struct isns_quick_attr_list isns_quick_attr_list_t;
-struct isns_quick_attr_list {
- isns_attr_list_t iqa_list;
- isns_attr_t * iqa_attrs[1];
- isns_attr_t iqa_attr;
-};
-#define ISNS_QUICK_ATTR_LIST_DECLARE(qlist, tag, type, value) \
- isns_quick_attr_list_t qlist = { \
- .iqa_list = (isns_attr_list_t) { \
- .ial_data = qlist.iqa_attrs, \
- .ial_count = 1 \
- }, \
- .iqa_attrs = { &qlist.iqa_attr }, \
- .iqa_attr = ISNS_ATTR_INIT(tag, type, value), \
- }
-
-/*
- * The following is used to chop up an incoming attr list as
- * given in eg. a DevAttrReg message into separate chunks,
- * following the ordering constraints laid out in the RFC.
- *
- * isns_attr_list_scanner_init initializes the scanner state.
- *
- * isns_attr_list_scanner_next advances to the next object in
- * the list, returning the keys and attrs for one object.
- *
- * The isns_attr_list_scanner struct should really be opaque, but
- * we put it here so you can declare a scanner variable on the
- * stack.
- */
-struct isns_attr_list_scanner {
- isns_source_t * source;
- isns_policy_t * policy;
- isns_object_t * key_obj;
- isns_attr_list_t orig_attrs;
- unsigned int pos;
-
- isns_attr_list_t keys;
- isns_attr_list_t attrs;
- isns_object_template_t *tmpl;
- unsigned int num_key_attrs;
-
- unsigned int entities;
-
- uint32_t pgt_next_attr;
- uint32_t pgt_value;
- const char * pgt_iscsi_name;
- isns_portal_info_t pgt_portal_info;
- isns_object_t * pgt_base_object;
-
- unsigned int index_acceptable : 1;
-};
-
-extern void isns_attr_list_scanner_init(struct isns_attr_list_scanner *,
- isns_object_t *key_obj,
- const isns_attr_list_t *attrs);
-extern int isns_attr_list_scanner_next(struct isns_attr_list_scanner *);
-extern void isns_attr_list_scanner_destroy(struct isns_attr_list_scanner *);
-
-/*
- * The following is used to parse attribute lists given as
- * a bunch of strings.
- */
-struct isns_attr_list_parser {
- struct isns_tag_prefix *prefix;
- const char * default_port;
-
- unsigned int multi_type_permitted : 1,
- nil_permitted : 1;
-
- isns_attr_t * (*load_key)(const char *);
- isns_attr_t * (*generate_key)(void);
-};
-
-extern int isns_attr_list_split(char *line, char **argv, unsigned int argc_max);
-extern void isns_attr_list_parser_init(struct isns_attr_list_parser *,
- isns_object_template_t *);
-extern int isns_parse_attrs(unsigned int, char **,
- isns_attr_list_t *, struct isns_attr_list_parser *);
-extern int isns_parse_query_attrs(unsigned int, char **,
- isns_attr_list_t *, isns_attr_list_t *,
- struct isns_attr_list_parser *);
-extern void isns_attr_list_parser_help(struct isns_attr_list_parser *);
-extern isns_object_template_t *isns_attr_list_parser_context(const struct isns_attr_list_parser *);
-extern int isns_print_attrs(isns_object_t *, char **, unsigned int);
-
-#endif /* ISNS_ATTRS_H */
diff --git a/authblock.c b/authblock.c
index 76d35b4bfe11..df9e21c5c0ee 100644
--- a/authblock.c
+++ b/authblock.c
@@ -6,10 +6,10 @@

#include <stdlib.h>
#include <string.h>
-#include "isns.h"
-#include "attrs.h"
-#include "message.h"
-#include "util.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
+#include <libisns/message.h>
+#include <libisns/util.h>

/* We impose an artificial limit on the size of
* the size of the authenticator
diff --git a/bitvector.c b/bitvector.c
index 9d66276d9ac8..00ef44a41b54 100644
--- a/bitvector.c
+++ b/bitvector.c
@@ -7,8 +7,8 @@

#include <stdlib.h>
#include <string.h>
-#include "isns.h"
-#include "util.h"
+#include <libisns/isns.h>
+#include <libisns/util.h>

struct isns_bitvector {
unsigned int ib_count;
diff --git a/buffer.c b/buffer.c
index 279ab7617590..503d4ce48839 100644
--- a/buffer.c
+++ b/buffer.c
@@ -12,7 +12,7 @@
#include <unistd.h>
#include <netinet/in.h> /* ntohl&htonl */
#include "buffer.h"
-#include "util.h" /* htonll */
+#include <libisns/util.h> /* htonll */

static int buf_drain(buf_t *bp);

diff --git a/callback.c b/callback.c
index ecdabd7de3b1..979834366147 100644
--- a/callback.c
+++ b/callback.c
@@ -6,11 +6,11 @@

#include <stdlib.h>
#include <string.h>
-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
#include "vendor.h"
-#include "attrs.h"
-#include "util.h"
+#include <libisns/attrs.h>
+#include <libisns/util.h>

typedef struct isns_object_notifier isns_object_notifier_t;
struct isns_object_notifier {
diff --git a/client.c b/client.c
index 501f716eca8a..e0f75c959257 100644
--- a/client.c
+++ b/client.c
@@ -12,9 +12,9 @@
#include <unistd.h>

#include "config.h"
-#include "isns.h"
+#include <libisns/isns.h>
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>
#include "internal.h"

static isns_client_t *
diff --git a/config.c b/config.c
index 745d8ac5ceaf..9ad71cf7a047 100644
--- a/config.c
+++ b/config.c
@@ -8,9 +8,9 @@
#include <unistd.h>
#include <ctype.h>

-#include "isns.h"
-#include "util.h"
-#include "paths.h"
+#include <libisns/isns.h>
+#include <libisns/util.h>
+#include <libisns/paths.h>

/*
* iSNS configuration
diff --git a/db-file.c b/db-file.c
index 98c08dbeb416..27e2b5acdb00 100644
--- a/db-file.c
+++ b/db-file.c
@@ -13,10 +13,10 @@
#include <errno.h>
#include <limits.h>

-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
-#include "message.h"
-#include "util.h"
+#include <libisns/message.h>
+#include <libisns/util.h>
#include "db.h"

#define DBE_FILE_VERSION 1
diff --git a/db-policy.c b/db-policy.c
index 1095cf612681..bf30a18874ea 100644
--- a/db-policy.c
+++ b/db-policy.c
@@ -10,11 +10,11 @@
#include "config.h"
#include <openssl/pem.h>
#include <openssl/err.h>
-#include "isns.h"
+#include <libisns/isns.h>
#include "security.h"
#include "objects.h"
#include "vendor.h"
-#include "util.h"
+#include <libisns/util.h>

/*
* DB keystore
diff --git a/db.c b/db.c
index c66dfbb232e4..04b7882821ba 100644
--- a/db.c
+++ b/db.c
@@ -9,10 +9,10 @@
#include <time.h>
#include <stdarg.h>

-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
#include "db.h"
-#include "util.h"
+#include <libisns/util.h>

enum {
IDT_INSERT,
diff --git a/db.h b/db.h
index 148d93052f94..e0fe4778b9bb 100644
--- a/db.h
+++ b/db.h
@@ -7,7 +7,7 @@
#ifndef ISNS_DB_H
#define ISNS_DB_H

-#include "attrs.h"
+#include <libisns/attrs.h>

typedef struct isns_db_backend isns_db_backend_t;

diff --git a/dd.c b/dd.c
index b88d1e7638b4..d15b277ab8e5 100644
--- a/dd.c
+++ b/dd.c
@@ -13,12 +13,12 @@
#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
#include "objects.h"
-#include "message.h"
+#include <libisns/message.h>
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>
#include "db.h"

#define DD_DEBUG
diff --git a/deregister.c b/deregister.c
index 29c0f43e87ed..7fe1dd061ee4 100644
--- a/deregister.c
+++ b/deregister.c
@@ -7,12 +7,12 @@
#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
#include "objects.h"
-#include "message.h"
+#include <libisns/message.h>
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>
#include "db.h"

extern isns_source_t * isns_server_source;
diff --git a/domain.c b/domain.c
index 3b848ac8f229..fbacb2faab49 100644
--- a/domain.c
+++ b/domain.c
@@ -7,9 +7,9 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
-#include "util.h"
+#include <libisns/util.h>

static int
__isns_default_dd_rebuild(isns_object_t *obj, isns_db_t *db)
diff --git a/entity.c b/entity.c
index cd45e1f2969a..b97394ab933b 100644
--- a/entity.c
+++ b/entity.c
@@ -7,9 +7,9 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
-#include "util.h"
+#include <libisns/util.h>

/*
* Create a network entity
diff --git a/error.c b/error.c
index 0d365e8ac33b..f36cd18b253c 100644
--- a/error.c
+++ b/error.c
@@ -4,7 +4,7 @@
* Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
*/

-#include "isns.h"
+#include <libisns/isns.h>

const char *
isns_strerror(enum isns_status status)
diff --git a/esi.c b/esi.c
index d1e04415a24e..f94831cb0367 100644
--- a/esi.c
+++ b/esi.c
@@ -8,12 +8,12 @@
#include <string.h>
#include <time.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
#include "objects.h"
-#include "message.h"
+#include <libisns/message.h>
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>
#include "db.h"

#define ESI_RETRANS_TIMEOUT 60
diff --git a/export.c b/export.c
index 4a9d776cd2b1..507f9af7ef70 100644
--- a/export.c
+++ b/export.c
@@ -15,13 +15,13 @@
#include <ctype.h>

#include "config.h"
-#include "isns.h"
-#include "util.h"
+#include <libisns/isns.h>
+#include <libisns/util.h>
#include "vendor.h"
-#include "attrs.h"
+#include <libisns/attrs.h>
#include "security.h"
#include "objects.h"
-#include "paths.h"
+#include <libisns/paths.h>

#define MAX_ALIASES 4

diff --git a/getnext.c b/getnext.c
index 4969f7aa6d72..2b3b3fe5f959 100644
--- a/getnext.c
+++ b/getnext.c
@@ -7,13 +7,13 @@
#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
-#include "message.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
+#include <libisns/message.h>
#include "security.h"
#include "objects.h"
#include "db.h"
-#include "util.h"
+#include <libisns/util.h>

/*
* Create a GetNext query, and set the source name
diff --git a/include/libisns/attrs.h b/include/libisns/attrs.h
new file mode 100644
index 000000000000..d137886cf2de
--- /dev/null
+++ b/include/libisns/attrs.h
@@ -0,0 +1,262 @@
+/*
+ * iSNS object attributes
+ *
+ * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
+ */
+
+#ifndef ISNS_ATTRS_H
+#define ISNS_ATTRS_H
+
+#include <netinet/in.h>
+#include "buffer.h"
+#include <libisns/isns.h>
+
+/*
+ * Type identifier
+ */
+enum {
+ ISNS_ATTR_TYPE_NIL = 0,
+ ISNS_ATTR_TYPE_OPAQUE,
+ ISNS_ATTR_TYPE_STRING,
+ ISNS_ATTR_TYPE_INT32,
+ ISNS_ATTR_TYPE_UINT32,
+ ISNS_ATTR_TYPE_UINT64,
+ ISNS_ATTR_TYPE_IPADDR,
+ ISNS_ATTR_TYPE_RANGE16,
+
+ __ISNS_ATTR_TYPE_BUILTIN_MAX
+};
+
+/*
+ * Union holding an attribute value
+ */
+typedef struct isns_value {
+ const struct isns_attr_type * iv_type;
+
+ /* Data is stuffed into an anonymous union */
+ union {
+ uint32_t iv_nil;
+ struct __isns_opaque {
+ void * ptr;
+ size_t len;
+ } iv_opaque;
+ char * iv_string;
+ int32_t iv_int32;
+ uint32_t iv_uint32;
+ uint64_t iv_uint64;
+ struct in6_addr iv_ipaddr;
+ struct {
+ uint16_t min, max;
+ } iv_range;
+ };
+} isns_value_t;
+
+#define __ISNS_ATTRTYPE(type) isns_attr_type_##type
+#define __ISNS_MEMBER(type) iv_##type
+#define ISNS_VALUE_INIT(type, value) \
+ (isns_value_t) { .iv_type = &__ISNS_ATTRTYPE(type), \
+ { .__ISNS_MEMBER(type) = (value) } }
+
+#define isns_attr_initialize(attrp, tag, type, value) do { \
+ isns_attr_t *__attr = (attrp); \
+ uint32_t __tag = (tag); \
+ __attr->ia_users = 1; \
+ __attr->ia_tag_id = (__tag); \
+ __attr->ia_tag = isns_tag_type_by_id(__tag); \
+ __attr->ia_value = ISNS_VALUE_INIT(type, value); \
+ } while (0)
+#define ISNS_ATTR_INIT(tag, type, value) (isns_attr_t) { \
+ .ia_users = 1, \
+ .ia_tag_id = (tag), \
+ .ia_tag = isns_tag_type_by_id(tag), \
+ .ia_value = ISNS_VALUE_INIT(type, value) \
+ }
+
+/*
+ * Attribute type
+ */
+typedef struct isns_attr_type {
+ uint32_t it_id;
+ const char * it_name;
+
+ void (*it_assign)(isns_value_t *, const isns_value_t *);
+ int (*it_set)(isns_value_t *, const void *);
+ int (*it_get)(isns_value_t *, void *);
+ int (*it_match)(const isns_value_t *, const isns_value_t *);
+ int (*it_compare)(const isns_value_t *, const isns_value_t *);
+ int (*it_encode)(buf_t *, const isns_value_t *);
+ int (*it_decode)(buf_t *, size_t, isns_value_t *);
+ void (*it_destroy)(isns_value_t *);
+ void (*it_print)(const isns_value_t *, char *, size_t);
+ int (*it_parse)(isns_value_t *, const char *);
+} isns_attr_type_t;
+
+/*
+ * Tag info: for each tag, provides a printable name,
+ * and the attribute type associated with it.
+ */
+struct isns_tag_type {
+ uint32_t it_id;
+ const char * it_name;
+ unsigned int it_multiple : 1,
+ it_readonly : 1;
+ isns_attr_type_t *it_type;
+
+ int (*it_validate)(const isns_value_t *,
+ const isns_policy_t *);
+ void (*it_print)(const isns_value_t *, char *, size_t);
+ int (*it_parse)(isns_value_t *, const char *);
+ const char * (*it_help)(void);
+};
+
+/*
+ * Attribute
+ */
+struct isns_attr {
+ unsigned int ia_users;
+ uint32_t ia_tag_id;
+ const isns_tag_type_t * ia_tag;
+ isns_value_t ia_value;
+};
+
+extern isns_attr_type_t isns_attr_type_nil;
+extern isns_attr_type_t isns_attr_type_opaque;
+extern isns_attr_type_t isns_attr_type_string;
+extern isns_attr_type_t isns_attr_type_int32;
+extern isns_attr_type_t isns_attr_type_uint32;
+extern isns_attr_type_t isns_attr_type_uint64;
+extern isns_attr_type_t isns_attr_type_ipaddr;
+extern isns_attr_type_t isns_attr_type_range16;
+
+extern isns_attr_t * isns_attr_alloc(uint32_t, const isns_tag_type_t *,
+ const isns_value_t *);
+
+extern void isns_attr_list_append_value(isns_attr_list_t *,
+ uint32_t tag, const isns_tag_type_t *,
+ const isns_value_t *);
+extern void isns_attr_list_update_value(isns_attr_list_t *,
+ uint32_t tag, const isns_tag_type_t *,
+ const isns_value_t *);
+extern int isns_attr_list_get_value(const isns_attr_list_t *,
+ uint32_t tag,
+ isns_value_t *);
+extern int isns_attr_list_get_uint32(const isns_attr_list_t *,
+ uint32_t tag,
+ uint32_t *);
+extern int isns_attr_list_get_string(const isns_attr_list_t *,
+ uint32_t tag,
+ const char **);
+
+extern int isns_attr_list_validate(const isns_attr_list_t *,
+ const isns_policy_t *,
+ unsigned int function);
+extern int isns_attr_validate(const isns_attr_t *,
+ const isns_policy_t *);
+
+extern void isns_attr_list_prune(isns_attr_list_t *,
+ const uint32_t *,
+ unsigned int);
+extern int isns_attr_list_remove_member(isns_attr_list_t *,
+ const isns_attr_t *,
+ const uint32_t *);
+extern void isns_attr_list_update_attr(isns_attr_list_t *,
+ const isns_attr_t *);
+
+extern int isns_attr_decode(buf_t *, isns_attr_t **);
+extern int isns_attr_encode(buf_t *, const isns_attr_t *);
+
+extern int isns_attr_list_decode(buf_t *, isns_attr_list_t *);
+extern int isns_attr_list_decode_delimited(buf_t *, isns_attr_list_t *);
+extern int isns_attr_list_encode(buf_t *, const isns_attr_list_t *);
+extern int isns_encode_delimiter(buf_t *);
+
+extern const isns_tag_type_t *isns_tag_type_by_id(unsigned int);
+extern const isns_attr_type_t *isns_attr_type_by_id(unsigned int);
+
+typedef struct isns_quick_attr_list isns_quick_attr_list_t;
+struct isns_quick_attr_list {
+ isns_attr_list_t iqa_list;
+ isns_attr_t * iqa_attrs[1];
+ isns_attr_t iqa_attr;
+};
+#define ISNS_QUICK_ATTR_LIST_DECLARE(qlist, tag, type, value) \
+ isns_quick_attr_list_t qlist = { \
+ .iqa_list = (isns_attr_list_t) { \
+ .ial_data = qlist.iqa_attrs, \
+ .ial_count = 1 \
+ }, \
+ .iqa_attrs = { &qlist.iqa_attr }, \
+ .iqa_attr = ISNS_ATTR_INIT(tag, type, value), \
+ }
+
+/*
+ * The following is used to chop up an incoming attr list as
+ * given in eg. a DevAttrReg message into separate chunks,
+ * following the ordering constraints laid out in the RFC.
+ *
+ * isns_attr_list_scanner_init initializes the scanner state.
+ *
+ * isns_attr_list_scanner_next advances to the next object in
+ * the list, returning the keys and attrs for one object.
+ *
+ * The isns_attr_list_scanner struct should really be opaque, but
+ * we put it here so you can declare a scanner variable on the
+ * stack.
+ */
+struct isns_attr_list_scanner {
+ isns_source_t * source;
+ isns_policy_t * policy;
+ isns_object_t * key_obj;
+ isns_attr_list_t orig_attrs;
+ unsigned int pos;
+
+ isns_attr_list_t keys;
+ isns_attr_list_t attrs;
+ isns_object_template_t *tmpl;
+ unsigned int num_key_attrs;
+
+ unsigned int entities;
+
+ uint32_t pgt_next_attr;
+ uint32_t pgt_value;
+ const char * pgt_iscsi_name;
+ isns_portal_info_t pgt_portal_info;
+ isns_object_t * pgt_base_object;
+
+ unsigned int index_acceptable : 1;
+};
+
+extern void isns_attr_list_scanner_init(struct isns_attr_list_scanner *,
+ isns_object_t *key_obj,
+ const isns_attr_list_t *attrs);
+extern int isns_attr_list_scanner_next(struct isns_attr_list_scanner *);
+extern void isns_attr_list_scanner_destroy(struct isns_attr_list_scanner *);
+
+/*
+ * The following is used to parse attribute lists given as
+ * a bunch of strings.
+ */
+struct isns_attr_list_parser {
+ struct isns_tag_prefix *prefix;
+ const char * default_port;
+
+ unsigned int multi_type_permitted : 1,
+ nil_permitted : 1;
+
+ isns_attr_t * (*load_key)(const char *);
+ isns_attr_t * (*generate_key)(void);
+};
+
+extern int isns_attr_list_split(char *line, char **argv, unsigned int argc_max);
+extern void isns_attr_list_parser_init(struct isns_attr_list_parser *,
+ isns_object_template_t *);
+extern int isns_parse_attrs(unsigned int, char **,
+ isns_attr_list_t *, struct isns_attr_list_parser *);
+extern int isns_parse_query_attrs(unsigned int, char **,
+ isns_attr_list_t *, isns_attr_list_t *,
+ struct isns_attr_list_parser *);
+extern void isns_attr_list_parser_help(struct isns_attr_list_parser *);
+extern isns_object_template_t *isns_attr_list_parser_context(const struct isns_attr_list_parser *);
+extern int isns_print_attrs(isns_object_t *, char **, unsigned int);
+
+#endif /* ISNS_ATTRS_H */
diff --git a/include/libisns/isns-proto.h b/include/libisns/isns-proto.h
new file mode 100644
index 000000000000..fbc33767ca65
--- /dev/null
+++ b/include/libisns/isns-proto.h
@@ -0,0 +1,259 @@
+/*
+ * iSNS protocol definitions
+ *
+ * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
+ */
+
+#ifndef ISNS_PROTO_H
+#define ISNS_PROTO_H
+
+#include <stdint.h>
+
+struct isns_hdr {
+ uint16_t i_version;
+ uint16_t i_function;
+ uint16_t i_length;
+ uint16_t i_flags;
+ uint16_t i_xid;
+ uint16_t i_seq;
+};
+
+#define ISNS_VERSION 0x0001
+#define ISNS_MAX_PDU_SIZE 65535
+#define ISNS_DEFAULT_PORT 3205
+
+/*
+ * Values for the i_flags field:
+ */
+#define ISNS_F_CLIENT 0x8000
+#define ISNS_F_SERVER 0x4000
+#define ISNS_F_AUTHBLK_PRESENT 0x2000
+#define ISNS_F_REPLACE 0x1000
+#define ISNS_F_LAST_PDU 0x0800
+#define ISNS_F_FIRST_PDU 0x0400
+
+/*
+ * Function values
+ */
+enum isns_function {
+ ISNS_DEVICE_ATTRIBUTE_REGISTER = 1,
+ ISNS_DEVICE_ATTRIBUTE_QUERY = 2,
+ ISNS_DEVICE_GET_NEXT = 3,
+ ISNS_DEVICE_DEREGISTER = 4,
+ ISNS_SCN_REGISTER = 5,
+ ISNS_SCN_DEREGISTER = 6,
+ ISNS_SCN_EVENT = 7,
+ ISNS_STATE_CHANGE_NOTIFICATION = 8,
+ ISNS_DD_REGISTER = 9,
+ ISNS_DD_DEREGISTER = 10,
+ ISNS_DDS_REGISTER = 11,
+ ISNS_DDS_DEREGISTER = 12,
+ ISNS_ENTITY_STATUS_INQUIRY = 13,
+ ISNS_HEARTBEAT = 14,
+};
+
+/*
+ * iSNS status codes:
+ */
+enum isns_status {
+ ISNS_SUCCESS = 0,
+ ISNS_UNKNOWN_ERROR,
+ ISNS_MESSAGE_FORMAT_ERROR,
+ ISNS_INVALID_REGISTRATION,
+ __ISNS_RESERVED_STATUS,
+ ISNS_INVALID_QUERY,
+ ISNS_SOURCE_UNKNOWN,
+ ISNS_SOURCE_ABSENT,
+ ISNS_SOURCE_UNAUTHORIZED,
+ ISNS_NO_SUCH_ENTRY,
+ ISNS_VERSION_NOT_SUPPORTED,
+ ISNS_INTERNAL_ERROR,
+ ISNS_BUSY,
+ ISNS_OPTION_NOT_UNDERSTOOD,
+ ISNS_INVALID_UPDATE,
+ ISNS_MESSAGE_NOT_SUPPORTED,
+ ISNS_SCN_EVENT_REJECTED,
+ ISNS_SCN_REGISTRATION_REJECTED,
+ ISNS_ATTRIBUTE_NOT_IMPLEMENTED,
+ ISNS_FC_DOMAIN_ID_NOT_AVAILABLE,
+ ISNS_FC_DOMAIN_ID_NOT_ALLOCATED,
+ ISNS_ESI_NOT_AVAILABLE,
+ ISNS_INVALID_DEREGISTRATION,
+ ISNS_REGISTRATION_FEATURE_NOT_SUPPORTED,
+};
+
+enum isns_tag {
+ ISNS_TAG_DELIMITER = 0,
+ ISNS_TAG_ENTITY_IDENTIFIER = 1,
+ ISNS_TAG_ENTITY_PROTOCOL = 2,
+ ISNS_TAG_MGMT_IP_ADDRESS = 3,
+ ISNS_TAG_TIMESTAMP = 4,
+ ISNS_TAG_PROTOCOL_VERSION_RANGE = 5,
+ ISNS_TAG_REGISTRATION_PERIOD = 6,
+ ISNS_TAG_ENTITY_INDEX = 7,
+ ISNS_TAG_ENTITY_NEXT_INDEX = 8,
+ ISNS_TAG_ENTITY_ISAKMP_PHASE_1 = 11,
+ ISNS_TAG_ENTITY_CERTIFICATE = 12,
+ ISNS_TAG_PORTAL_IP_ADDRESS = 16,
+ ISNS_TAG_PORTAL_TCP_UDP_PORT = 17,
+ ISNS_TAG_PORTAL_SYMBOLIC_NAME = 18,
+ ISNS_TAG_ESI_INTERVAL = 19,
+ ISNS_TAG_ESI_PORT = 20,
+ ISNS_TAG_PORTAL_INDEX = 22,
+ ISNS_TAG_SCN_PORT = 23,
+ ISNS_TAG_PORTAL_NEXT_INDEX = 24,
+ ISNS_TAG_PORTAL_SECURITY_BITMAP = 27,
+ ISNS_TAG_PORTAL_ISAKMP_PHASE_1 = 28,
+ ISNS_TAG_PORTAL_ISAKMP_PHASE_2 = 29,
+ ISNS_TAG_PORTAL_CERTIFICATE = 31,
+ ISNS_TAG_ISCSI_NAME = 32,
+ ISNS_TAG_ISCSI_NODE_TYPE = 33,
+ ISNS_TAG_ISCSI_ALIAS = 34,
+ ISNS_TAG_ISCSI_SCN_BITMAP = 35,
+ ISNS_TAG_ISCSI_NODE_INDEX = 36,
+ ISNS_TAG_WWNN_TOKEN = 37,
+ ISNS_TAG_ISCSI_NODE_NEXT_INDEX = 38,
+ ISNS_TAG_ISCSI_AUTHMETHOD = 42,
+ ISNS_TAG_PG_ISCSI_NAME = 48,
+ ISNS_TAG_PG_PORTAL_IP_ADDR = 49,
+ ISNS_TAG_PG_PORTAL_TCP_UDP_PORT = 50,
+ ISNS_TAG_PG_TAG = 51,
+ ISNS_TAG_PG_INDEX = 52,
+ ISNS_TAG_PG_NEXT_INDEX = 53,
+ ISNS_TAG_FC_PORT_NAME_WWPN = 64,
+ ISNS_TAG_PORT_ID = 65,
+ ISNS_TAG_FC_PORT_TYPE = 66,
+ ISNS_TAG_SYMBOLIC_PORT_NAME = 67,
+ ISNS_TAG_FABRIC_PORT_NAME = 68,
+ ISNS_TAG_HARD_ADDRESS = 69,
+ ISNS_TAG_PORT_IP_ADDRESS = 70,
+ ISNS_TAG_CLASS_OF_SERVICE = 71,
+ ISNS_TAG_FC4_TYPES = 72,
+ ISNS_TAG_FC4_DESCRIPTOR = 73,
+ ISNS_TAG_FC4_FEATURES = 74,
+ ISNS_TAG_IFCP_SCN_BITMAP = 75,
+ ISNS_TAG_PORT_ROLE = 76,
+ ISNS_TAG_PERMANENT_PORT_NAME = 77,
+ ISNS_TAG_FC4_TYPE_CODE = 95,
+ ISNS_TAG_FC_NODE_NAME_WWNN = 96,
+ ISNS_TAG_SYMBOLIC_NODE_NAME = 97,
+ ISNS_TAG_NODE_IP_ADDRESS = 98,
+ ISNS_TAG_NODE_IPA = 99,
+ ISNS_TAG_PROXY_ISCSI_NAME = 101,
+ ISNS_TAG_SWITCH_NAME = 128,
+ ISNS_TAG_PREFERRED_ID = 129,
+ ISNS_TAG_ASSIGNED_ID = 130,
+ ISNS_TAG_VIRTUAL_FABRIC_ID = 131,
+ ISNS_TAG_SERVER_VENDOR_OUI = 256,
+ ISNS_TAG_DD_SET_ID = 2049,
+ ISNS_TAG_DD_SET_SYMBOLIC_NAME = 2050,
+ ISNS_TAG_DD_SET_STATUS = 2051,
+ ISNS_TAG_DD_SET_NEXT_ID = 2052,
+ ISNS_TAG_DD_ID = 2065,
+ ISNS_TAG_DD_SYMBOLIC_NAME = 2066,
+ ISNS_TAG_DD_MEMBER_ISCSI_INDEX = 2067,
+ ISNS_TAG_DD_MEMBER_ISCSI_NAME = 2068,
+ ISNS_TAG_DD_MEMBER_FC_PORT_NAME = 2069,
+ ISNS_TAG_DD_MEMBER_PORTAL_INDEX = 2070,
+ ISNS_TAG_DD_MEMBER_PORTAL_IP_ADDR = 2071,
+ ISNS_TAG_DD_MEMBER_PORTAL_TCP_UDP_PORT = 2072,
+ ISNS_TAG_DD_FEATURES = 2078,
+ ISNS_TAG_DD_NEXT_ID = 2079,
+
+ __ISNS_TAG_MAX,
+
+ ISNS_VENDOR_SPECIFIC_SERVER_BASE = 257, /* end 384 */
+ ISNS_VENDOR_SPECIFIC_ENTITY_BASE = 385, /* end 512 */
+ ISNS_VENDOR_SPECIFIC_PORTAL_BASE = 513, /* end 640 */
+ ISNS_VENDOR_SPECIFIC_NODE_BASE = 641, /* end 768 */
+ ISNS_VENDOR_SPECIFIC_DD_BASE = 1024, /* end 1280 */
+ ISNS_VENDOR_SPECIFIC_DDSET_BASE = 1281, /* end 1536 */
+ ISNS_VENDOR_SPECIFIC_OTHER_BASE = 1537, /* end 2048 */
+};
+
+typedef enum isns_entity_protocol {
+ ISNS_ENTITY_PROTOCOL_NONE = 1,
+ ISNS_ENTITY_PROTOCOL_ISCSI = 2,
+ ISNS_ENTITY_PROTOCOL_IFCP = 3,
+} isns_entity_protocol_t;
+
+enum isns_iscsi_node_type_bits {
+ ISNS_ISCSI_NODE_TYPE_TARGET = 0,
+ ISNS_ISCSI_NODE_TYPE_INITIATOR = 1,
+ ISNS_ISCSI_NODE_TYPE_CONTROL = 2,
+};
+#define ISNS_ISCSI_INITIATOR_MASK (1 << ISNS_ISCSI_NODE_TYPE_INITIATOR)
+#define ISNS_ISCSI_TARGET_MASK (1 << ISNS_ISCSI_NODE_TYPE_TARGET)
+#define ISNS_ISCSI_CONTROL_MASK (1 << ISNS_ISCSI_NODE_TYPE_CONTROL)
+
+enum isns_portal_port_bits {
+ ISNS_PORTAL_PORT_UDP = 16,
+};
+#define ISNS_PORTAL_PORT_UDP_MASK (1 << ISNS_PORTAL_PORT_UDP)
+
+enum isns_portal_security_bits {
+ ISNS_PORTAL_SEC_BITMAP_VALID = 0,
+ ISNS_PORTAL_SEC_IPSEC_ENABLED = 1,
+ ISNS_PORTAL_SEC_MAIN_MODE_ENABLED = 2,
+ ISNS_PORTAL_SEC_AGGR_MODE_ENABLED = 3,
+ ISNS_PORTAL_SEC_PFS_ENABLED = 4,
+ ISNS_PORTAL_SEC_TRANSPORT_MODE_PREFERRED = 5,
+ ISNS_PORTAL_SEC_TUNNEL_MODE_PREFERRED = 6,
+};
+#define ISNS_PORTAL_SEC_BITMAP_VALID_MASK (1 << ISNS_PORTAL_SEC_BITMAP_VALID)
+#define ISNS_PORTAL_SEC_IPSEC_ENABLED_MASK (1 << ISNS_PORTAL_SEC_IPSEC_ENABLED)
+#define ISNS_PORTAL_SEC_MAIN_MODE_ENABLED_MASK (1 << ISNS_PORTAL_SEC_MAIN_MODE_ENABLED)
+#define ISNS_PORTAL_SEC_AGGR_MODE_ENABLED_MASK (1 << ISNS_PORTAL_SEC_AGGR_MODE_ENABLED)
+#define ISNS_PORTAL_SEC_PFS_ENABLED_MASK (1 << ISNS_PORTAL_SEC_PFS_ENABLED)
+#define ISNS_PORTAL_SEC_TRANSPORT_MODE_PREFERRED_MASK (1 << ISNS_PORTAL_SEC_TRANSPORT_MODE_PREFERRED)
+#define ISNS_PORTAL_SEC_TUNNEL_MODE_PREFERRED_MASK (1 << ISNS_PORTAL_SEC_TUNNEL_MODE_PREFERRED)
+
+enum isns_scn_bits {
+ ISNS_SCN_DD_MEMBER_ADDED = 0,
+ ISNS_SCN_DD_MEMBER_REMOVED = 1,
+ ISNS_SCN_OBJECT_UPDATED = 2,
+ ISNS_SCN_OBJECT_ADDED = 3,
+ ISNS_SCN_OBJECT_REMOVED = 4,
+ ISNS_SCN_MANAGEMENT_REGISTRATION = 5,
+ ISNS_SCN_TARGET_AND_SELF_ONLY = 6,
+ ISNS_SCN_INITIATOR_AND_SELF_ONLY = 7,
+};
+#define ISNS_SCN_DD_MEMBER_ADDED_MASK (1 << ISNS_SCN_DD_MEMBER_ADDED)
+#define ISNS_SCN_DD_MEMBER_REMOVED_MASK (1 << ISNS_SCN_DD_MEMBER_REMOVED)
+#define ISNS_SCN_OBJECT_UPDATED_MASK (1 << ISNS_SCN_OBJECT_UPDATED)
+#define ISNS_SCN_OBJECT_ADDED_MASK (1 << ISNS_SCN_OBJECT_ADDED)
+#define ISNS_SCN_OBJECT_REMOVED_MASK (1 << ISNS_SCN_OBJECT_REMOVED)
+#define ISNS_SCN_MANAGEMENT_REGISTRATION_MASK (1 << ISNS_SCN_MANAGEMENT_REGISTRATION)
+#define ISNS_SCN_TARGET_AND_SELF_ONLY_MASK (1 << ISNS_SCN_TARGET_AND_SELF_ONLY)
+#define ISNS_SCN_INITIATOR_AND_SELF_ONLY_MASK (1 << ISNS_SCN_INITIATOR_AND_SELF_ONLY)
+
+enum isns_dds_status_bits {
+ ISNS_DDS_ENABLED = 0,
+};
+#define ISNS_DDS_ENABLED_MASK (1 << ISNS_DDS_ENABLED)
+
+enum isns_dd_feature_bits {
+ ISNS_DD_BOOT_LIST_ENABLED = 0,
+};
+#define ISNS_DD_BOOT_LIST_ENABLED_MASK (1 << ISN_BOOT_LIST_DDS_ENABLED)
+
+#define ISNS_PAD(len) (((len) + 3) & ~3UL)
+
+/*
+ * iSNS auth block
+ */
+#define ISNS_AUTHBLK_SIZE 20
+struct isns_authblk {
+ uint32_t iab_bsd; /* 16bit in SLP */
+ uint32_t iab_length; /* 16bit in SLP */
+ uint64_t iab_timestamp; /* 32bit in SLP */
+ uint32_t iab_spi_len; /* 16bit in SLP */
+
+ char * iab_spi;
+ void * iab_sig;
+ uint32_t iab_sig_len;
+} __attribute__((packed));
+
+#define ISNS_AUTH_TYPE_SHA1_DSA 0x0002
+
+#endif /* ISNS_PROTO_H */
diff --git a/include/libisns/isns.h b/include/libisns/isns.h
new file mode 100644
index 000000000000..e0a2fa8016f1
--- /dev/null
+++ b/include/libisns/isns.h
@@ -0,0 +1,676 @@
+/*
+ * iSNS implementation - library header file.
+ *
+ * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
+ *
+ * This file contains all declarations and definitions
+ * commonly required by users of libisns.
+ */
+
+#ifndef ISNS_H
+#define ISNS_H
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <stdio.h>
+
+#include <libisns/isns-proto.h>
+#include <libisns/types.h>
+
+#define ISNS_MAX_BUFFER 8192
+#define ISNS_MAX_MESSAGE 8192
+
+
+/*
+ * Client handle
+ */
+typedef struct isns_client isns_client_t;
+struct isns_client {
+ isns_source_t * ic_source;
+ isns_socket_t * ic_socket;
+};
+
+/*
+ * Server operations
+ */
+typedef int isns_service_fn_t(isns_server_t *, isns_simple_t *, isns_simple_t **);
+typedef void isns_scn_callback_fn_t(isns_db_t *, uint32_t scn_bits,
+ isns_object_template_t *node_type,
+ const char *node_name,
+ const char *recipient);
+struct isns_service_ops {
+ isns_service_fn_t * process_registration;
+ isns_service_fn_t * process_query;
+ isns_service_fn_t * process_getnext;
+ isns_service_fn_t * process_deregistration;
+ isns_service_fn_t * process_scn_registration;
+ isns_service_fn_t * process_scn_deregistration;
+ isns_service_fn_t * process_scn_event;
+ isns_service_fn_t * process_scn;
+ isns_service_fn_t * process_dd_registration;
+ isns_service_fn_t * process_dd_deregistration;
+ isns_service_fn_t * process_esi;
+ isns_service_fn_t * process_heartbeat;
+};
+
+extern struct isns_service_ops isns_default_service_ops;
+extern struct isns_service_ops isns_callback_service_ops;
+
+/*
+ * Output function
+ */
+void isns_print_stdout(const char *, ...);
+
+/*
+ * Database events
+ */
+struct isns_db_event {
+ isns_object_t * ie_recipient; /* Recipient node or NULL */
+ isns_object_t * ie_object; /* Affected object */
+ isns_object_t * ie_trigger; /* Triggering object */
+ unsigned int ie_bits; /* SCN bitmask */
+};
+typedef void isns_db_callback_t(const isns_db_event_t *,
+ void *user_data);
+
+/*
+ * Handling of client objects
+ */
+extern isns_client_t * isns_create_default_client(isns_security_t *);
+extern isns_client_t * isns_create_client(isns_security_t *,
+ const char *source_name);
+extern isns_client_t * isns_create_local_client(isns_security_t *,
+ const char *source_name);
+extern int isns_client_call(isns_client_t *,
+ isns_simple_t **inout);
+extern void isns_client_destroy(isns_client_t *);
+extern int isns_client_get_local_address(const isns_client_t *,
+ isns_portal_info_t *);
+
+/*
+ * Handling of server objects
+ */
+extern isns_server_t * isns_create_server(isns_source_t *,
+ isns_db_t *,
+ struct isns_service_ops *);
+extern void isns_server_set_scn_callback(isns_server_t *,
+ isns_scn_callback_fn_t *);
+
+
+/*
+ * Handling of source names
+ */
+extern int isns_init_names(void);
+extern const char * isns_default_source_name(void);
+extern isns_source_t * isns_source_create(isns_attr_t *);
+extern isns_source_t * isns_source_create_iscsi(const char *name);
+extern isns_source_t * isns_source_create_ifcp(const char *name);
+extern uint32_t isns_source_type(const isns_source_t *);
+extern const char * isns_source_name(const isns_source_t *);
+extern isns_attr_t * isns_source_attr(const isns_source_t *);
+extern isns_source_t * isns_source_get(isns_source_t *);
+extern isns_source_t * isns_source_from_object(const isns_object_t *);
+extern void isns_source_release(isns_source_t *);
+extern int isns_source_match(const isns_source_t *,
+ const isns_source_t *);
+
+extern void isns_server_set_source(isns_source_t *);
+extern isns_message_t * isns_process_message(isns_server_t *, isns_message_t *);
+
+extern void isns_simple_print(isns_simple_t *,
+ isns_print_fn_t *);
+extern int isns_simple_call(isns_socket_t *,
+ isns_simple_t **);
+extern int isns_simple_transmit(isns_socket_t *,
+ isns_simple_t *,
+ const isns_portal_info_t *,
+ unsigned int,
+ void (*callback)(uint32_t, int,
+ isns_simple_t *));
+extern void isns_simple_free(isns_simple_t *);
+extern const isns_attr_list_t *isns_simple_get_attrs(isns_simple_t *);
+
+extern isns_simple_t * isns_create_query(isns_client_t *clnt,
+ const isns_attr_list_t *query_key);
+extern isns_simple_t * isns_create_query2(isns_client_t *clnt,
+ const isns_attr_list_t *query_key,
+ isns_source_t *source);
+extern int isns_query_request_attr_tag(isns_simple_t *,
+ uint32_t);
+extern int isns_query_request_attr(isns_simple_t *,
+ isns_attr_t *);
+extern int isns_query_response_get_objects(isns_simple_t *qry,
+ isns_object_list_t *result);
+
+extern isns_simple_t * isns_create_registration(isns_client_t *clnt,
+ isns_object_t *key_object);
+extern isns_simple_t * isns_create_registration2(isns_client_t *clnt,
+ isns_object_t *key_object,
+ isns_source_t *source);
+extern void isns_registration_set_replace(isns_simple_t *, int);
+extern void isns_registration_add_object(isns_simple_t *,
+ isns_object_t *object);
+extern void isns_registration_add_object_list(isns_simple_t *,
+ isns_object_list_t *);
+extern int isns_registration_response_get_objects(isns_simple_t *,
+ isns_object_list_t *);
+
+extern isns_simple_t * isns_create_getnext(isns_client_t *,
+ isns_object_template_t *,
+ const isns_attr_list_t *);
+extern int isns_getnext_response_get_object(isns_simple_t *,
+ isns_object_t **);
+extern isns_simple_t * isns_create_getnext_followup(isns_client_t *,
+ const isns_simple_t *,
+ const isns_attr_list_t *);
+
+extern isns_simple_t * isns_create_deregistration(isns_client_t *clnt,
+ const isns_attr_list_t *);
+
+extern isns_simple_t * isns_create_scn_registration(isns_client_t *clnt,
+ unsigned int);
+extern isns_simple_t * isns_create_scn_registration2(isns_client_t *clnt,
+ unsigned int,
+ isns_source_t *);
+
+extern int isns_dd_load_all(isns_db_t *);
+extern void isns_dd_get_members(uint32_t, isns_object_list_t *, int);
+extern isns_simple_t * isns_create_dd_registration(isns_client_t *,
+ const isns_attr_list_t *);
+extern isns_simple_t * isns_create_dd_deregistration(isns_client_t *,
+ uint32_t, const isns_attr_list_t *);
+
+extern isns_object_t * isns_create_object(isns_object_template_t *,
+ const isns_attr_list_t *,
+ isns_object_t *);
+extern isns_object_t * isns_create_entity(int, const char *);
+extern isns_object_t * isns_create_entity_for_source(const isns_source_t *,
+ const char *);
+extern const char * isns_entity_name(const isns_object_t *);
+extern isns_object_t * isns_create_portal(const isns_portal_info_t *,
+ isns_object_t *parent);
+extern isns_object_t * isns_create_storage_node(const char *name,
+ uint32_t type_mask,
+ isns_object_t *parent);
+extern isns_object_t * isns_create_storage_node2(const isns_source_t *,
+ uint32_t type_mask,
+ isns_object_t *parent);
+extern isns_object_t * isns_create_iscsi_initiator(const char *name,
+ isns_object_t *parent);
+extern isns_object_t * isns_create_iscsi_target(const char *name,
+ isns_object_t *parent);
+extern const char * isns_storage_node_name(const isns_object_t *);
+extern isns_attr_t * isns_storage_node_key_attr(const isns_object_t *);
+extern isns_object_t * isns_create_portal_group(isns_object_t *portal,
+ isns_object_t *iscsi_node, uint32_t pg_tag);
+extern isns_object_t * isns_create_default_portal_group(isns_db_t *,
+ isns_object_t *portal,
+ isns_object_t *node);
+extern void isns_get_portal_groups(isns_object_t *portal,
+ isns_object_t *node,
+ isns_object_list_t *result);
+
+extern const char * isns_object_template_name(isns_object_template_t *);
+extern int isns_object_set_attr(isns_object_t *, isns_attr_t *);
+extern int isns_object_set_attrlist(isns_object_t *, const isns_attr_list_t *);
+extern isns_object_t * isns_object_get(isns_object_t *);
+extern int isns_object_get_attrlist(isns_object_t *obj,
+ isns_attr_list_t *result,
+ const isns_attr_list_t *requested_attrs);
+extern int isns_object_get_key_attrs(isns_object_t *,
+ isns_attr_list_t *);
+extern int isns_object_get_attr(const isns_object_t *, uint32_t,
+ isns_attr_t **);
+extern void isns_object_get_related(isns_db_t *,
+ isns_object_t *, isns_object_list_t *);
+extern void isns_object_get_descendants(const isns_object_t *,
+ isns_object_template_t *,
+ isns_object_list_t *);
+extern void isns_object_release(isns_object_t *);
+extern int isns_object_match(const isns_object_t *,
+ const isns_attr_list_t *);
+extern isns_object_t * isns_object_get_entity(isns_object_t *);
+extern int isns_object_attr_valid(isns_object_template_t *, uint32_t);
+extern int isns_object_contains(const isns_object_t *, const isns_object_t *);
+extern int isns_object_delete_attr(isns_object_t *, uint32_t);
+extern int isns_object_is(const isns_object_t *,
+ isns_object_template_t *);
+extern int isns_object_is_entity(const isns_object_t *);
+extern int isns_object_is_iscsi_node(const isns_object_t *);
+extern int isns_object_is_fc_port(const isns_object_t *);
+extern int isns_object_is_fc_node(const isns_object_t *);
+extern int isns_object_is_portal(const isns_object_t *);
+extern int isns_object_is_pg(const isns_object_t *);
+extern int isns_object_is_policy(const isns_object_t *);
+extern int isns_object_is_dd(const isns_object_t *);
+extern int isns_object_is_ddset(const isns_object_t *);
+extern void isns_object_print(isns_object_t *,
+ isns_print_fn_t *);
+extern time_t isns_object_last_modified(const isns_object_t *);
+extern int isns_object_mark_membership(isns_object_t *, uint32_t);
+extern int isns_object_clear_membership(isns_object_t *, uint32_t);
+extern int isns_object_test_membership(const isns_object_t *, uint32_t);
+extern int isns_object_test_visibility(const isns_object_t *,
+ const isns_object_t *);
+extern void isns_object_get_visible(const isns_object_t *,
+ isns_db_t *, isns_object_list_t *);
+extern void isns_entity_touch(isns_object_t *);
+extern int isns_object_extract_keys(const isns_object_t *,
+ isns_attr_list_t *);
+extern int isns_object_extract_all(const isns_object_t *,
+ isns_attr_list_t *);
+extern int isns_object_extract_writable(const isns_object_t *,
+ isns_attr_list_t *);
+
+
+extern int isns_object_set_nil(isns_object_t *obj,
+ uint32_t tag);
+extern int isns_object_set_string(isns_object_t *obj,
+ uint32_t tag,
+ const char *value);
+extern int isns_object_set_uint32(isns_object_t *obj,
+ uint32_t tag,
+ uint32_t value);
+extern int isns_object_set_uint64(isns_object_t *obj,
+ uint32_t tag,
+ uint64_t value);
+extern int isns_object_set_ipaddr(isns_object_t *obj,
+ uint32_t tag,
+ const struct in6_addr *value);
+
+extern int isns_object_get_string(const isns_object_t *,
+ uint32_t,
+ const char **);
+extern int isns_object_get_ipaddr(const isns_object_t *,
+ uint32_t,
+ struct in6_addr *);
+extern int isns_object_get_uint32(const isns_object_t *,
+ uint32_t,
+ uint32_t *);
+extern int isns_object_get_uint64(const isns_object_t *,
+ uint32_t,
+ uint64_t *);
+extern int isns_object_get_opaque(const isns_object_t *,
+ uint32_t,
+ const void **, size_t *);
+
+
+extern int isns_object_find_descendants(isns_object_t *obj,
+ isns_object_template_t *,
+ const isns_attr_list_t *keys,
+ isns_object_list_t *result);
+extern isns_object_t * isns_object_find_descendant(isns_object_t *obj,
+ const isns_attr_list_t *keys);
+extern int isns_object_detach(isns_object_t *);
+extern int isns_object_attach(isns_object_t *, isns_object_t *);
+extern void isns_object_prune_attrs(isns_object_t *);
+extern void isns_mark_object(isns_object_t *, unsigned int);
+
+extern int isns_get_entity_identifier(isns_object_t *, const char **);
+extern int isns_get_entity_protocol(isns_object_t *, isns_entity_protocol_t *);
+extern int isns_get_entity_index(isns_object_t *, uint32_t *);
+
+extern int isns_get_portal_ipaddr(isns_object_t *, struct in6_addr *);
+extern int isns_get_portal_tcpudp_port(isns_object_t *,
+ int *ipprotocol, uint16_t *port);
+extern int isns_get_portal_index(isns_object_t *, uint32_t *);
+
+extern int isns_get_address(struct sockaddr_storage *,
+ const char *, const char *, int, int, int);
+extern char * isns_get_canon_name(const char *);
+
+extern isns_db_t * isns_db_open(const char *location);
+extern isns_db_t * isns_db_open_shadow(isns_object_list_t *);
+extern isns_object_t * isns_db_lookup(isns_db_t *,
+ isns_object_template_t *,
+ const isns_attr_list_t *);
+extern isns_object_t * isns_db_vlookup(isns_db_t *,
+ isns_object_template_t *,
+ ...);
+extern int isns_db_gang_lookup(isns_db_t *,
+ isns_object_template_t *,
+ const isns_attr_list_t *,
+ isns_object_list_t *);
+extern isns_object_t * isns_db_get_next(isns_db_t *,
+ isns_object_template_t *,
+ const isns_attr_list_t *current,
+ const isns_attr_list_t *scope,
+ const isns_source_t *source);
+extern isns_object_t * isns_db_lookup_source_node(isns_db_t *,
+ const isns_source_t *);
+extern void isns_db_get_domainless(isns_db_t *,
+ isns_object_template_t *,
+ isns_object_list_t *);
+extern uint32_t isns_db_allocate_index(isns_db_t *);
+extern void isns_db_insert(isns_db_t *, isns_object_t *);
+extern void isns_db_insert_limbo(isns_db_t *, isns_object_t *);
+extern int isns_db_remove(isns_db_t *, isns_object_t *);
+extern time_t isns_db_expire(isns_db_t *);
+extern void isns_db_purge(isns_db_t *);
+extern void isns_db_sync(isns_db_t *);
+extern const char * isns_db_generate_eid(isns_db_t *, char *, size_t);
+extern isns_object_t * isns_db_get_control(isns_db_t *);
+extern void isns_db_print(isns_db_t *,
+ isns_print_fn_t *);
+
+extern void isns_db_begin_transaction(isns_db_t *);
+extern void isns_db_commit(isns_db_t *);
+extern void isns_db_rollback(isns_db_t *);
+
+extern void isns_object_event(isns_object_t *obj,
+ unsigned int bits,
+ isns_object_t *trigger);
+extern void isns_unicast_event(isns_object_t *dst,
+ isns_object_t *obj,
+ unsigned int bits,
+ isns_object_t *trigger);
+extern void isns_register_callback(isns_db_callback_t *,
+ void *);
+extern void isns_flush_events(void);
+extern const char * isns_event_string(unsigned int);
+
+extern void isns_add_timer(unsigned int,
+ isns_timer_callback_t *, void *);
+extern void isns_add_oneshot_timer(unsigned int,
+ isns_timer_callback_t *, void *);
+extern void isns_cancel_timer(isns_timer_callback_t *, void *);
+extern time_t isns_run_timers(void);
+
+extern void isns_object_list_init(isns_object_list_t *);
+extern void isns_object_list_destroy(isns_object_list_t *);
+extern int isns_object_list_contains(const isns_object_list_t *,
+ isns_object_t *);
+extern void isns_object_list_append(isns_object_list_t *,
+ isns_object_t *);
+extern void isns_object_list_append_list(isns_object_list_t *,
+ const isns_object_list_t *);
+extern isns_object_t * isns_object_list_lookup(const isns_object_list_t *,
+ isns_object_template_t *,
+ const isns_attr_list_t *);
+extern int isns_object_list_gang_lookup(const isns_object_list_t *,
+ isns_object_template_t *,
+ const isns_attr_list_t *,
+ isns_object_list_t *);
+extern int isns_object_list_remove(isns_object_list_t *,
+ isns_object_t *);
+extern void isns_object_list_uniq(isns_object_list_t *);
+extern void isns_object_list_print(const isns_object_list_t *,
+ isns_print_fn_t *);
+
+isns_object_template_t *isns_object_template_for_key_attrs(const isns_attr_list_t *);
+isns_object_template_t *isns_object_template_for_tag(uint32_t);
+isns_object_template_t *isns_object_template_for_index_tag(uint32_t);
+isns_object_template_t *isns_object_template_find(uint32_t);
+
+extern int isns_attr_set(isns_attr_t *, const void *);
+extern isns_attr_t * isns_attr_get(isns_attr_t *);
+extern void isns_attr_release(isns_attr_t *);
+extern void isns_attr_print(const isns_attr_t *,
+ isns_print_fn_t *);
+extern char * isns_attr_print_value(const isns_attr_t *,
+ char *, size_t);
+extern int isns_attr_match(const isns_attr_t *,
+ const isns_attr_t *);
+extern int isns_attr_compare(const isns_attr_t *,
+ const isns_attr_t *);
+extern isns_attr_t * isns_attr_from_string(uint32_t, const char *);
+
+extern void isns_attr_list_print(const isns_attr_list_t *,
+ isns_print_fn_t *);
+
+extern void isns_attr_list_init(isns_attr_list_t *);
+extern void isns_attr_list_copy(isns_attr_list_t *,
+ const isns_attr_list_t *);
+extern void isns_attr_list_destroy(isns_attr_list_t *);
+extern int isns_attr_list_remove_tag(isns_attr_list_t *,
+ uint32_t);
+
+extern void isns_attr_list_append_attr(isns_attr_list_t *,
+ isns_attr_t *);
+extern void isns_attr_list_append_list(isns_attr_list_t *,
+ const isns_attr_list_t *);
+extern int isns_attr_list_replace_attr(isns_attr_list_t *,
+ isns_attr_t *);
+/* Warning: this does *NOT* return a reference to the attribute */
+extern int isns_attr_list_get_attr(const isns_attr_list_t *,
+ uint32_t tag,
+ isns_attr_t **);
+
+extern void isns_attr_list_append_nil(isns_attr_list_t *,
+ uint32_t tag);
+extern void isns_attr_list_append_string(isns_attr_list_t *,
+ uint32_t tag, const char *value);
+extern void isns_attr_list_append_uint32(isns_attr_list_t *,
+ uint32_t tag, uint32_t value);
+extern void isns_attr_list_append_uint64(isns_attr_list_t *,
+ uint32_t, int64_t);
+extern void isns_attr_list_append_int32(isns_attr_list_t *,
+ uint32_t tag, int32_t value);
+extern void isns_attr_list_append_opaque(isns_attr_list_t *,
+ uint32_t tag, const void *ptr, size_t len);
+extern void isns_attr_list_append_ipaddr(isns_attr_list_t *,
+ uint32_t tag, const struct in6_addr *);
+
+extern int isns_attr_list_append(isns_attr_list_t *,
+ uint32_t tag, const void *);
+extern int isns_attr_list_update(isns_attr_list_t *,
+ uint32_t tag, const void *);
+
+extern int isns_attr_list_contains(const isns_attr_list_t *,
+ uint32_t tag);
+extern int isns_attr_list_compare(const isns_attr_list_t *,
+ const isns_attr_list_t *);
+
+/*
+ * Helper macros
+ */
+#define ISNS_ATTR_TYPE_CHECK(attr, type) \
+ ((attr)->ia_value.iv_type == &isns_attr_type_##type)
+#define ISNS_ATTR_IS_NIL(attr) \
+ ISNS_ATTR_TYPE_CHECK(attr, nil)
+#define ISNS_ATTR_IS_STRING(attr) \
+ ISNS_ATTR_TYPE_CHECK(attr, string)
+#define ISNS_ATTR_IS_IPADDR(attr) \
+ ISNS_ATTR_TYPE_CHECK(attr, ipaddr)
+#define ISNS_ATTR_IS_UINT32(attr) \
+ ISNS_ATTR_TYPE_CHECK(attr, uint32)
+#define ISNS_ATTR_IS_UINT64(attr) \
+ ISNS_ATTR_TYPE_CHECK(attr, uint64)
+#define ISNS_ATTR_IS_OPAQUE(attr) \
+ ISNS_ATTR_TYPE_CHECK(attr, opaque)
+
+
+
+extern isns_socket_t * isns_create_server_socket(const char *hostname, const char *portname,
+ int af_hint, int sock_type);
+extern isns_socket_t * isns_create_client_socket(const char *hostname, const char *portname,
+ int af_hint, int sock_type);
+extern isns_socket_t * isns_create_systemd_socket(int index);
+extern isns_socket_t * isns_create_bound_client_socket(const char *myaddr,
+ const char *hostname, const char *portname,
+ int af_hint, int sock_type);
+extern isns_socket_t * isns_connect_to_portal(const isns_portal_info_t *);
+extern void isns_socket_set_report_failure(isns_socket_t *);
+extern void isns_socket_set_disconnect_fatal(isns_socket_t *);
+extern int isns_socket_get_local_addr(const isns_socket_t *,
+ struct sockaddr_storage *);
+extern int isns_socket_get_portal_info(const isns_socket_t *,
+ isns_portal_info_t *);
+extern void isns_socket_set_security_ctx(isns_socket_t *,
+ isns_security_t *);
+extern isns_message_t * isns_recv_message(struct timeval *timeout);
+extern isns_message_t * isns_socket_call(isns_socket_t *, isns_message_t *, long);
+extern int isns_socket_send(isns_socket_t *, isns_message_t *);
+extern void isns_socket_free(isns_socket_t *);
+extern int isns_addr_get_port(const struct sockaddr *);
+extern void isns_addr_set_port(struct sockaddr *, unsigned int);
+extern isns_socket_t * isns_socket_find_server(const isns_portal_info_t *);
+
+extern isns_message_t * isns_create_message(uint16_t function, uint16_t flags);
+extern isns_message_t * isns_create_reply(const isns_message_t *);
+extern int isns_message_init(isns_message_t *,
+ uint16_t, uint16_t, size_t);
+extern int isns_message_status(isns_message_t *);
+extern void isns_message_release(isns_message_t *);
+extern unsigned int isns_message_function(const isns_message_t *);
+extern isns_socket_t * isns_message_socket(const isns_message_t *);
+extern void isns_message_set_error(isns_message_t *, uint32_t);
+
+extern const char * isns_strerror(enum isns_status);
+extern const char * isns_function_name(unsigned int);
+
+/*
+ * Security related functions
+ */
+extern int isns_security_init(void);
+extern isns_principal_t *isns_security_load_privkey(isns_security_t *,
+ const char *filename);
+extern isns_principal_t *isns_security_load_pubkey(isns_security_t *,
+ const char *filename);
+extern isns_security_t *isns_default_security_context(int server_only);
+extern isns_security_t *isns_control_security_context(int server_only);
+extern isns_security_t *isns_create_dsa_context(void);
+extern void isns_security_set_identity(isns_security_t *, isns_principal_t *);
+extern void isns_principal_free(isns_principal_t *);
+extern void isns_add_principal(isns_security_t *, isns_principal_t *);
+extern isns_keystore_t *isns_create_keystore(const char *);
+extern void isns_security_set_keystore(isns_security_t *,
+ isns_keystore_t *);
+extern void isns_principal_set_name(isns_principal_t *, const char *);
+extern const char * isns_principal_name(const isns_principal_t *);
+
+extern isns_object_template_t isns_entity_template;
+extern isns_object_template_t isns_portal_template;
+extern isns_object_template_t isns_iscsi_node_template;
+extern isns_object_template_t isns_fc_port_template;
+extern isns_object_template_t isns_fc_node_template;
+extern isns_object_template_t isns_iscsi_pg_template;
+extern isns_object_template_t isns_dd_template;
+extern isns_object_template_t isns_ddset_template;
+
+/*
+ * Config file parser
+ */
+struct isns_config {
+ char * ic_host_name;
+ char * ic_auth_name;
+ char * ic_source_name;
+ char * ic_source_suffix;
+ char * ic_entity_name;
+ char * ic_iqn_prefix;
+
+ char * ic_server_name;
+ char * ic_bind_address;
+ char * ic_database;
+ char * ic_auth_key_file;
+ char * ic_server_key_file;
+ char * ic_client_keystore;
+ char * ic_control_socket;
+ char * ic_pidfile;
+ char * ic_local_registry_file;
+ int ic_security;
+ int ic_slp_register;
+
+ char * ic_control_name;
+ char * ic_control_key_file;
+
+ unsigned int ic_registration_period;
+ unsigned int ic_scn_timeout;
+ unsigned int ic_scn_retries;
+ char * ic_scn_callout;
+
+ unsigned int ic_esi_max_interval;
+ unsigned int ic_esi_min_interval;
+ unsigned int ic_esi_retries;
+
+ unsigned int ic_use_default_domain;
+
+ struct {
+ unsigned int policy;
+ unsigned int replay_window;
+ unsigned int timestamp_jitter;
+ int allow_unknown_peers;
+ } ic_auth;
+ struct {
+ unsigned int max_sockets;
+ unsigned int connect_timeout;
+ unsigned int reconnect_timeout;
+ unsigned int call_timeout;
+ unsigned int udp_retrans_timeout;
+ unsigned int tcp_retrans_timeout;
+ unsigned int idle_timeout;
+ } ic_network;
+ struct {
+ char * param_file;
+ unsigned int key_bits;
+ } ic_dsa;
+
+};
+
+extern struct isns_config isns_config;
+extern int isns_read_initiatorname(const char *);
+extern int isns_read_config(const char *);
+extern int isns_config_set(const char *, char *);
+
+/*
+ * Reserved entity name for Policy information
+ */
+#define ISNS_ENTITY_CONTROL "CONTROL"
+
+
+/*
+ * Helpers to deal with portal information
+ */
+struct isns_portal_info {
+ struct sockaddr_in6 addr;
+ int proto;
+};
+
+extern void isns_portal_init(isns_portal_info_t *,
+ const struct sockaddr *, int);
+extern int isns_portal_parse(isns_portal_info_t *portal,
+ const char *addr_spec,
+ const char *default_port);
+extern int isns_portal_from_attr_list(isns_portal_info_t *,
+ uint32_t addr_tag, uint32_t port_tag,
+ const isns_attr_list_t *);
+extern int isns_portal_from_attr_pair(isns_portal_info_t *,
+ const isns_attr_t *,
+ const isns_attr_t *);
+extern int isns_portal_from_object(isns_portal_info_t *,
+ uint32_t addr_tag, uint32_t port_tag,
+ const isns_object_t *);
+extern int isns_portal_from_sockaddr(isns_portal_info_t *,
+ const struct sockaddr_storage *);
+extern int isns_portal_to_sockaddr(const isns_portal_info_t *,
+ struct sockaddr_storage *);
+extern int isns_portal_to_attr_list(const isns_portal_info_t *,
+ uint32_t addr_tag, uint32_t port_tag,
+ isns_attr_list_t *);
+extern int isns_portal_to_object(const isns_portal_info_t *,
+ uint32_t addr_tag, uint32_t port_tag,
+ isns_object_t *);
+extern int isns_portal_is_wildcard(const isns_portal_info_t *);
+extern uint32_t isns_portal_tcpudp_port(const isns_portal_info_t *);
+extern const char * isns_portal_string(const isns_portal_info_t *);
+extern int isns_portal_equal(const isns_portal_info_t *,
+ const isns_portal_info_t *);
+extern int isns_enumerate_portals(isns_portal_info_t *,
+ unsigned int);
+extern int isns_get_nr_portals(void);
+
+/* Local registry stuff */
+extern int isns_local_registry_load(const char *, pid_t, isns_object_list_t *);
+extern int isns_local_registry_store(const char *, pid_t, const isns_object_list_t *);
+extern int isns_local_registry_purge(const char *, pid_t);
+
+/* Should go somwhere else .*/
+extern int isns_esi_enabled;
+
+extern void isns_esi_init(isns_server_t *);
+extern void isns_esi_register(isns_object_t *);
+
+extern void isns_scn_init(isns_server_t *);
+extern time_t isns_scn_transmit_all(void);
+
+#endif /* ISNS_H */
diff --git a/include/libisns/message.h b/include/libisns/message.h
new file mode 100644
index 000000000000..7d0bbdb6be9f
--- /dev/null
+++ b/include/libisns/message.h
@@ -0,0 +1,196 @@
+/*
+ * iSNS message definitions and functions
+ *
+ * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
+ */
+
+#ifndef ISNS_MESSAGE_H
+#define ISNS_MESSAGE_H
+
+#include <libisns/attrs.h>
+#include <libisns/source.h>
+#include <libisns/util.h>
+
+typedef struct isns_message_queue isns_message_queue_t;
+
+struct isns_simple {
+ uint32_t is_function;
+ isns_source_t * is_source;
+ isns_policy_t * is_policy;
+ uint16_t is_xid;
+
+ unsigned int is_replace : 1;
+
+ isns_attr_list_t is_message_attrs;
+ isns_attr_list_t is_operating_attrs;
+};
+
+struct isns_message {
+ unsigned int im_users;
+ isns_list_t im_list;
+ struct sockaddr_storage im_addr;
+ socklen_t im_addrlen;
+ uint32_t im_xid;
+ struct isns_hdr im_header;
+ struct isns_buf * im_payload;
+ isns_socket_t * im_socket;
+ isns_principal_t * im_security;
+ struct ucred * im_creds;
+
+ isns_message_queue_t * im_queue;
+
+ /* When to retransmit */
+ struct timeval im_resend_timeout;
+ struct timeval im_timeout;
+
+ void (*im_destroy)(isns_message_t *);
+ void (*im_callback)(isns_message_t *,
+ isns_message_t *);
+ void * im_calldata;
+};
+
+enum {
+ ISNS_MQ_SORT_NONE,
+ ISNS_MQ_SORT_RESEND_TIMEOUT,
+};
+
+struct isns_message_queue {
+ isns_list_t imq_list;
+ size_t imq_count;
+};
+
+struct isns_server {
+ isns_source_t * is_source;
+ isns_db_t * is_db;
+
+ isns_scn_callback_fn_t *is_scn_callback;
+ struct isns_service_ops *is_ops;
+};
+
+extern isns_message_t * __isns_alloc_message(uint32_t, size_t, void (*)(isns_message_t *));
+extern isns_security_t *isns_message_security(const isns_message_t *);
+
+extern isns_message_t * isns_message_queue_find(isns_message_queue_t *, uint32_t,
+ const struct sockaddr_storage *, socklen_t);
+extern void isns_message_queue_insert_sorted(isns_message_queue_t *,
+ int, isns_message_t *);
+extern void isns_message_queue_move(isns_message_queue_t *,
+ isns_message_t *);
+extern void isns_message_queue_destroy(isns_message_queue_t *);
+
+extern isns_simple_t * isns_simple_create(uint32_t,
+ isns_source_t *,
+ const isns_attr_list_t *);
+extern void isns_simple_free(isns_simple_t *);
+extern int isns_simple_encode(isns_simple_t *,
+ isns_message_t **result);
+extern int isns_simple_decode(isns_message_t *,
+ isns_simple_t **);
+extern int isns_simple_encode_response(isns_simple_t *,
+ const isns_message_t *, isns_message_t **);
+extern int isns_simple_response_get_objects(isns_simple_t *,
+ isns_object_list_t *);
+extern const char * isns_function_name(uint32_t);
+
+extern isns_source_t * isns_simple_get_source(isns_simple_t *);
+
+extern int isns_process_registration(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_query(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_getnext(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_deregistration(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_scn_register(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_scn_deregistration(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_dd_registration(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_dd_deregistration(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_esi(isns_server_t *, isns_simple_t *, isns_simple_t **);
+extern int isns_process_scn(isns_server_t *, isns_simple_t *, isns_simple_t **);
+
+/*
+ * Inline functions for message queues.
+ */
+static inline void
+isns_message_queue_init(isns_message_queue_t *q)
+{
+ isns_list_init(&q->imq_list);
+ q->imq_count = 0;
+}
+
+static inline isns_message_t *
+isns_message_queue_head(const isns_message_queue_t *q)
+{
+ isns_list_t *pos = q->imq_list.next;
+
+ if (pos == &q->imq_list)
+ return NULL;
+ return isns_list_item(isns_message_t, im_list, pos);
+}
+
+static inline void
+isns_message_queue_append(isns_message_queue_t *q, isns_message_t *msg)
+{
+ isns_assert(msg->im_queue == NULL);
+ isns_list_append(&q->imq_list, &msg->im_list);
+ q->imq_count++;
+
+ msg->im_queue = q;
+ msg->im_users++;
+}
+
+static inline isns_message_t *
+isns_message_queue_remove(isns_message_queue_t *q, isns_message_t *msg)
+{
+ isns_assert(msg->im_queue == q);
+ isns_list_del(&msg->im_list);
+ msg->im_queue = NULL;
+ q->imq_count--;
+
+ return msg;
+}
+
+static inline isns_message_t *
+isns_message_unlink(isns_message_t *msg)
+{
+ if (msg->im_queue)
+ return isns_message_queue_remove(msg->im_queue, msg);
+ return NULL;
+}
+
+static inline isns_message_t *
+isns_message_dequeue(isns_message_queue_t *q)
+{
+ isns_message_t *msg;
+
+ if ((msg = isns_message_queue_head(q)) != NULL) {
+ isns_list_del(&msg->im_list);
+ msg->im_queue = NULL;
+ q->imq_count--;
+ }
+ return msg;
+}
+
+/*
+ * Iterator for looping over all messages in a queue
+ */
+static inline void
+isns_message_queue_begin(isns_message_queue_t *q, isns_list_t **pos)
+{
+ *pos = q->imq_list.next;
+}
+
+static inline isns_message_t *
+isns_message_queue_next(isns_message_queue_t *q, isns_list_t **pos)
+{
+ isns_list_t *next = *pos;
+
+ if (next == &q->imq_list)
+ return NULL;
+ *pos = next->next;
+ return isns_list_item(isns_message_t, im_list, next);
+}
+
+#define isns_message_queue_foreach(q, pos, item) \
+ for (isns_message_queue_begin(q, &pos); \
+ (item = isns_message_queue_next(q, &pos)) != NULL; \
+ )
+
+#endif /* ISNS_MESSAGE_H */
diff --git a/include/libisns/paths.h b/include/libisns/paths.h
new file mode 100644
index 000000000000..64cf486137ca
--- /dev/null
+++ b/include/libisns/paths.h
@@ -0,0 +1,24 @@
+/*
+ * Compile time configuration.
+ * For now, let's keep it simple and ignore autoconf...
+ *
+ * Copyright (C) 2006, 2007 Olaf Kirch <olaf....@oracle.com>
+ */
+
+#ifndef ISNS_CONFIG_H
+#define ISNS_CONFIG_H
+
+#define __OPENISNS_MKVERSION(maj, min) (((maj) << 8) + (min))
+#define OPENISNS_VERSION __OPENISNS_MKVERSION(0, 93);
+#define OPENISNS_VERSION_STRING "0.93"
+
+#define ISNS_ETCDIR "/etc/isns"
+#define ISNS_RUNDIR "/var/run"
+#define ISNS_DEFAULT_ISNSD_CONFIG ISNS_ETCDIR "/isnsd.conf"
+#define ISNS_DEFAULT_ISNSDD_CONFIG ISNS_ETCDIR "/isnsdd.conf"
+#define ISNS_DEFAULT_ISNSADM_CONFIG ISNS_ETCDIR "/isnsadm.conf"
+#define ISNS_DEFAULT_LOCAL_REGISTRY ISNS_RUNDIR "/isns.registry"
+
+#define ISCSI_DEFAULT_INITIATORNAME "/etc/iscsi/initiatorname.iscsi"
+
+#endif /* ISNS_CONFIG_H */
diff --git a/include/libisns/source.h b/include/libisns/source.h
new file mode 100644
index 000000000000..db522f6fac0d
--- /dev/null
+++ b/include/libisns/source.h
@@ -0,0 +1,32 @@
+/*
+ * iSNS source attribute handling
+ *
+ * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
+ */
+
+#ifndef ISNS_SOURCE_H
+#define ISNS_SOURCE_H
+
+#include <libisns/attrs.h>
+
+struct isns_source {
+ unsigned int is_users;
+ isns_attr_t * is_attr;
+ unsigned int is_untrusted : 1;
+
+ isns_object_t * is_node;
+ unsigned int is_node_type;
+
+ isns_object_t * is_entity;
+};
+
+extern int isns_source_encode(buf_t *, const isns_source_t *);
+extern int isns_source_decode(buf_t *, isns_source_t **);
+extern int isns_source_set_node(isns_source_t *, isns_db_t *);
+extern void isns_source_set_entity(isns_source_t *, isns_object_t *);
+extern isns_source_t * isns_source_dummy(void);
+
+extern char * isns_build_source_pattern(const char *);
+extern int isns_source_pattern_match(const char *, const char *);
+
+#endif /* ISNS_SOURCE_H */
diff --git a/include/libisns/types.h b/include/libisns/types.h
new file mode 100644
index 000000000000..ddd153f8401d
--- /dev/null
+++ b/include/libisns/types.h
@@ -0,0 +1,57 @@
+/*
+ * Open-iSNS types
+ *
+ * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
+ */
+
+#ifndef ISNS_TYPES_H
+#define ISNS_TYPES_H
+
+typedef struct isns_simple isns_simple_t;
+typedef struct isns_source isns_source_t;
+typedef struct isns_object isns_object_t;
+typedef struct isns_relation isns_relation_t;
+typedef struct isns_attr isns_attr_t;
+typedef struct isns_attr_list isns_attr_list_t;
+typedef struct isns_message isns_message_t;
+typedef struct isns_socket isns_socket_t;
+typedef struct isns_db isns_db_t;
+typedef struct isns_tag_type isns_tag_type_t;
+typedef const struct isns_object_template isns_object_template_t;
+typedef struct isns_authdata isns_authdata_t;
+typedef struct isns_security isns_security_t;
+typedef struct isns_principal isns_principal_t;
+typedef struct isns_policy isns_policy_t;
+typedef struct isns_keystore isns_keystore_t;
+typedef struct isns_scope isns_scope_t;
+typedef struct isns_portal_info isns_portal_info_t;
+typedef struct isns_server isns_server_t;
+typedef struct isns_db_event isns_db_event_t;
+typedef struct isns_bitvector isns_bitvector_t;
+
+typedef struct isns_object_list {
+ unsigned int iol_count;
+ isns_object_t ** iol_data;
+} isns_object_list_t;
+
+#define ISNS_OBJECT_LIST_INIT { .iol_count = 0, .iol_data = NULL }
+
+/*
+ * An attribute list
+ */
+struct isns_attr_list {
+ unsigned int ial_count;
+ isns_attr_t ** ial_data;
+};
+#define ISNS_ATTR_LIST_INIT { .ial_count = 0, .ial_data = NULL }
+
+/*
+ * Function types.
+ */
+typedef void isns_print_fn_t(const char *, ...);
+typedef void isns_timer_callback_t(void *);
+
+
+#endif /* ISNS_TYPES_H */
+
+
diff --git a/include/libisns/util.h b/include/libisns/util.h
new file mode 100644
index 000000000000..9b192cc188e5
--- /dev/null
+++ b/include/libisns/util.h
@@ -0,0 +1,288 @@
+/*
+ * Utility functions
+ *
+ * Copyright (C) 2006, 2007 Olaf Kirch <olaf....@oracle.com>
+ */
+
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <string.h> // for strdup
+#include <libisns/types.h>
+
+#define array_num_elements(a) (sizeof(a) / sizeof((a)[0]))
+
+const char * isns_dirname(const char *);
+int isns_mkdir_recursive(const char *);
+
+extern const char *parser_separators;
+char * parser_get_next_line(FILE *);
+char * parser_get_next_word(char **);
+char * parser_get_rest_of_line(char **);
+int parser_split_line(char *, unsigned int, char **);
+
+unsigned long parse_size(const char *);
+unsigned int parse_count(const char *);
+int parse_int(const char *);
+long long parse_longlong(const char *);
+double parse_double(const char *);
+unsigned int parse_timeout(const char *);
+
+char * print_size(unsigned long);
+
+/*
+ * Very simple and stupid string array.
+ */
+struct string_array {
+ unsigned int count;
+ char ** list;
+};
+
+void isns_string_array_append(struct string_array *, const char *);
+void isns_string_array_destroy(struct string_array *);
+
+void isns_assign_string(char **, const char *);
+
+void isns_write_pidfile(const char *);
+void isns_update_pidfile(const char *);
+void isns_remove_pidfile(const char *);
+
+extern void isns_log_background(void);
+extern void isns_assert_failed(const char *,
+ const char *, unsigned int);
+extern void isns_fatal(const char *, ...);
+extern void isns_warning(const char *, ...);
+extern void isns_error(const char *, ...);
+extern void isns_notice(const char *, ...);
+extern void isns_debug_general(const char *, ...);
+extern void isns_debug_socket(const char *, ...);
+extern void isns_debug_protocol(const char *, ...);
+extern void isns_debug_message(const char *, ...);
+extern void isns_debug_state(const char *, ...);
+extern void isns_debug_auth(const char *, ...);
+extern void isns_debug_scn(const char *, ...);
+extern void isns_debug_esi(const char *, ...);
+extern void isns_enable_debugging(const char *);
+extern int isns_debug_enabled(int);
+
+enum {
+ DBG_GENERAL = 0,
+ DBG_SOCKET,
+ DBG_PROTOCOL,
+ DBG_MESSAGE,
+ DBG_STATE,
+ DBG_AUTH,
+ DBG_SCN,
+ DBG_ESI,
+};
+
+/*
+ * There's no htonll yet
+ */
+#ifndef htonll
+# include <endian.h>
+# include <byteswap.h>
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define htonll(x) (x)
+# define ntohll(x) (x)
+# elif __BYTE_ORDER == __LITTLE_ENDIAN
+# define htonll(x) __bswap_64(x)
+# define ntohll(x) __bswap_64(x)
+# endif
+#endif
+
+/*
+ * One of the those eternal staples of C coding:
+ */
+#ifndef MIN
+# define MIN(a, b) ((a) < (b)? (a) : (b))
+# define MAX(a, b) ((a) > (b)? (a) : (b))
+#endif
+
+#define DECLARE_BITMAP(name, NBITS) \
+ uint32_t name[(NBITS+31) >> 5] = { 0 }
+
+#define __BIT_INDEX(nr) (nr >> 5)
+#define __BIT_MASK(nr) (1 << (nr & 31))
+
+static inline void
+set_bit(uint32_t *map, unsigned int nr)
+{
+ map[__BIT_INDEX(nr)] |= __BIT_MASK(nr);
+}
+
+static inline void
+clear_bit(uint32_t *map, unsigned int nr)
+{
+ map[__BIT_INDEX(nr)] &= ~__BIT_MASK(nr);
+}
+
+static inline int
+test_bit(const uint32_t *map, unsigned int nr)
+{
+ return !!(map[__BIT_INDEX(nr)] & __BIT_MASK(nr));
+}
+
+/*
+ * Dynamically sized bit vector
+ */
+extern isns_bitvector_t *isns_bitvector_alloc(void);
+extern void isns_bitvector_init(isns_bitvector_t *);
+extern void isns_bitvector_destroy(isns_bitvector_t *);
+extern void isns_bitvector_free(isns_bitvector_t *);
+extern int isns_bitvector_test_bit(const isns_bitvector_t *, unsigned int);
+extern int isns_bitvector_set_bit(isns_bitvector_t *, unsigned int);
+extern int isns_bitvector_clear_bit(isns_bitvector_t *, unsigned int);
+extern int isns_bitvector_is_empty(const isns_bitvector_t *);
+extern int isns_bitvector_intersect(const isns_bitvector_t *a,
+ const isns_bitvector_t *b,
+ isns_bitvector_t *result);
+extern void isns_bitvector_print(const isns_bitvector_t *,
+ isns_print_fn_t *);
+extern void isns_bitvector_foreach(const isns_bitvector_t *bv,
+ int (*cb)(uint32_t, void *),
+ void *user_data);
+
+/*
+ * List manipulation primites
+ */
+typedef struct isns_list isns_list_t;
+struct isns_list {
+ isns_list_t * next;
+ isns_list_t * prev;
+};
+
+#define ISNS_LIST_DECLARE(list) \
+ isns_list_t list = { &list, &list }
+
+static inline void
+isns_list_init(isns_list_t *head)
+{
+ head->next = head->prev = head;
+}
+
+static inline void
+__isns_list_insert(isns_list_t *prev, isns_list_t *item, isns_list_t *next)
+{
+ item->next = next;
+ item->prev = prev;
+ next->prev = item;
+ prev->next = item;
+}
+
+static inline void
+isns_list_append(isns_list_t *head, isns_list_t *item)
+{
+ __isns_list_insert(head->prev, item, head);
+}
+
+static inline void
+isns_list_insert(isns_list_t *head, isns_list_t *item)
+{
+ __isns_list_insert(head, item, head->next);
+}
+
+static inline void
+isns_item_insert_before(isns_list_t *where, isns_list_t *item)
+{
+ __isns_list_insert(where->prev, item, where);
+}
+
+static inline void
+isns_item_insert_after(isns_list_t *where, isns_list_t *item)
+{
+ __isns_list_insert(where, item, where->next);
+}
+
+static inline void
+isns_list_del(isns_list_t *item)
+{
+ isns_list_t *prev = item->prev;
+ isns_list_t *next = item->next;
+
+ prev->next = next;
+ next->prev = prev;
+ item->next = item->prev = item;
+}
+
+static inline int
+isns_list_empty(const isns_list_t *head)
+{
+ return head == head->next;
+}
+
+static inline void
+isns_list_move(isns_list_t *dst, isns_list_t *src)
+{
+ isns_list_t *prev, *next;
+ isns_list_t *head, *tail;
+
+ if (isns_list_empty(src))
+ return;
+
+ prev = dst->prev;
+ next = dst;
+
+ head = src->next;
+ tail = src->prev;
+
+ next->prev = tail;
+ prev->next = head;
+ head->prev = prev;
+ tail->next = next;
+
+ src->next = src->prev = src;
+}
+
+#define isns_list_item(type, member, ptr) \
+ container_of(type, member, ptr)
+
+#define isns_list_foreach(list, __pos, __next) \
+ for (__pos = (list)->next; \
+ (__pos != list) && (__next = __pos->next, 1); \
+ __pos = __next)
+
+#if 0
+/* This is defined in stddef */
+#define offsetof(type, member) ((unsigned long) &(((type *) 0)->member))
+#endif
+#define container_of(type, member, ptr) \
+ ((type *) (((unsigned char *) ptr) - offsetof(type, member)))
+
+/*
+ * Use isns_assert instead of libc's assert, so that the
+ * message can be captured and sent to syslog.
+ */
+#define isns_assert(condition) do { \
+ if (!(condition)) \
+ isns_assert_failed(#condition, \
+ __FILE__, __LINE__); \
+} while (0)
+
+#ifndef MDEBUG
+# define isns_malloc(size) malloc(size)
+# define isns_calloc(n, size) calloc(n, size)
+# define isns_realloc(p, size) realloc(p, size)
+# define isns_strdup(s) strdup(s)
+# define isns_free(p) free(p)
+#else
+# define isns_malloc(size) isns_malloc_fn(size, __FILE__, __LINE__)
+# define isns_calloc(n, size) isns_calloc_fn(n, size, __FILE__, __LINE__)
+# define isns_realloc(p, size) isns_realloc_fn(p, size, __FILE__, __LINE__)
+# define isns_strdup(s) isns_strdup_fn(s, __FILE__, __LINE__)
+# define isns_free(p) isns_free_fn(p, __FILE__, __LINE__)
+
+extern void * (*isns_malloc_fn)(size_t, const char *, unsigned int);
+extern void * (*isns_calloc_fn)(unsigned int, size_t,
+ const char *, unsigned int);
+extern void * (*isns_realloc_fn)(void *, size_t,
+ const char *, unsigned int);
+extern char * (*isns_strdup_fn)(const char *, const char *, unsigned int);
+extern void (*isns_free_fn)(void *, const char *, unsigned int);
+#endif
+
+#endif /* UTIL_H */
diff --git a/isns-proto.h b/isns-proto.h
deleted file mode 100644
index fbc33767ca65..000000000000
--- a/isns-proto.h
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * iSNS protocol definitions
- *
- * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
- */
-
-#ifndef ISNS_PROTO_H
-#define ISNS_PROTO_H
-
-#include <stdint.h>
-
-struct isns_hdr {
- uint16_t i_version;
- uint16_t i_function;
- uint16_t i_length;
- uint16_t i_flags;
- uint16_t i_xid;
- uint16_t i_seq;
-};
-
-#define ISNS_VERSION 0x0001
-#define ISNS_MAX_PDU_SIZE 65535
-#define ISNS_DEFAULT_PORT 3205
-
-/*
- * Values for the i_flags field:
- */
-#define ISNS_F_CLIENT 0x8000
-#define ISNS_F_SERVER 0x4000
-#define ISNS_F_AUTHBLK_PRESENT 0x2000
-#define ISNS_F_REPLACE 0x1000
-#define ISNS_F_LAST_PDU 0x0800
-#define ISNS_F_FIRST_PDU 0x0400
-
-/*
- * Function values
- */
-enum isns_function {
- ISNS_DEVICE_ATTRIBUTE_REGISTER = 1,
- ISNS_DEVICE_ATTRIBUTE_QUERY = 2,
- ISNS_DEVICE_GET_NEXT = 3,
- ISNS_DEVICE_DEREGISTER = 4,
- ISNS_SCN_REGISTER = 5,
- ISNS_SCN_DEREGISTER = 6,
- ISNS_SCN_EVENT = 7,
- ISNS_STATE_CHANGE_NOTIFICATION = 8,
- ISNS_DD_REGISTER = 9,
- ISNS_DD_DEREGISTER = 10,
- ISNS_DDS_REGISTER = 11,
- ISNS_DDS_DEREGISTER = 12,
- ISNS_ENTITY_STATUS_INQUIRY = 13,
- ISNS_HEARTBEAT = 14,
-};
-
-/*
- * iSNS status codes:
- */
-enum isns_status {
- ISNS_SUCCESS = 0,
- ISNS_UNKNOWN_ERROR,
- ISNS_MESSAGE_FORMAT_ERROR,
- ISNS_INVALID_REGISTRATION,
- __ISNS_RESERVED_STATUS,
- ISNS_INVALID_QUERY,
- ISNS_SOURCE_UNKNOWN,
- ISNS_SOURCE_ABSENT,
- ISNS_SOURCE_UNAUTHORIZED,
- ISNS_NO_SUCH_ENTRY,
- ISNS_VERSION_NOT_SUPPORTED,
- ISNS_INTERNAL_ERROR,
- ISNS_BUSY,
- ISNS_OPTION_NOT_UNDERSTOOD,
- ISNS_INVALID_UPDATE,
- ISNS_MESSAGE_NOT_SUPPORTED,
- ISNS_SCN_EVENT_REJECTED,
- ISNS_SCN_REGISTRATION_REJECTED,
- ISNS_ATTRIBUTE_NOT_IMPLEMENTED,
- ISNS_FC_DOMAIN_ID_NOT_AVAILABLE,
- ISNS_FC_DOMAIN_ID_NOT_ALLOCATED,
- ISNS_ESI_NOT_AVAILABLE,
- ISNS_INVALID_DEREGISTRATION,
- ISNS_REGISTRATION_FEATURE_NOT_SUPPORTED,
-};
-
-enum isns_tag {
- ISNS_TAG_DELIMITER = 0,
- ISNS_TAG_ENTITY_IDENTIFIER = 1,
- ISNS_TAG_ENTITY_PROTOCOL = 2,
- ISNS_TAG_MGMT_IP_ADDRESS = 3,
- ISNS_TAG_TIMESTAMP = 4,
- ISNS_TAG_PROTOCOL_VERSION_RANGE = 5,
- ISNS_TAG_REGISTRATION_PERIOD = 6,
- ISNS_TAG_ENTITY_INDEX = 7,
- ISNS_TAG_ENTITY_NEXT_INDEX = 8,
- ISNS_TAG_ENTITY_ISAKMP_PHASE_1 = 11,
- ISNS_TAG_ENTITY_CERTIFICATE = 12,
- ISNS_TAG_PORTAL_IP_ADDRESS = 16,
- ISNS_TAG_PORTAL_TCP_UDP_PORT = 17,
- ISNS_TAG_PORTAL_SYMBOLIC_NAME = 18,
- ISNS_TAG_ESI_INTERVAL = 19,
- ISNS_TAG_ESI_PORT = 20,
- ISNS_TAG_PORTAL_INDEX = 22,
- ISNS_TAG_SCN_PORT = 23,
- ISNS_TAG_PORTAL_NEXT_INDEX = 24,
- ISNS_TAG_PORTAL_SECURITY_BITMAP = 27,
- ISNS_TAG_PORTAL_ISAKMP_PHASE_1 = 28,
- ISNS_TAG_PORTAL_ISAKMP_PHASE_2 = 29,
- ISNS_TAG_PORTAL_CERTIFICATE = 31,
- ISNS_TAG_ISCSI_NAME = 32,
- ISNS_TAG_ISCSI_NODE_TYPE = 33,
- ISNS_TAG_ISCSI_ALIAS = 34,
- ISNS_TAG_ISCSI_SCN_BITMAP = 35,
- ISNS_TAG_ISCSI_NODE_INDEX = 36,
- ISNS_TAG_WWNN_TOKEN = 37,
- ISNS_TAG_ISCSI_NODE_NEXT_INDEX = 38,
- ISNS_TAG_ISCSI_AUTHMETHOD = 42,
- ISNS_TAG_PG_ISCSI_NAME = 48,
- ISNS_TAG_PG_PORTAL_IP_ADDR = 49,
- ISNS_TAG_PG_PORTAL_TCP_UDP_PORT = 50,
- ISNS_TAG_PG_TAG = 51,
- ISNS_TAG_PG_INDEX = 52,
- ISNS_TAG_PG_NEXT_INDEX = 53,
- ISNS_TAG_FC_PORT_NAME_WWPN = 64,
- ISNS_TAG_PORT_ID = 65,
- ISNS_TAG_FC_PORT_TYPE = 66,
- ISNS_TAG_SYMBOLIC_PORT_NAME = 67,
- ISNS_TAG_FABRIC_PORT_NAME = 68,
- ISNS_TAG_HARD_ADDRESS = 69,
- ISNS_TAG_PORT_IP_ADDRESS = 70,
- ISNS_TAG_CLASS_OF_SERVICE = 71,
- ISNS_TAG_FC4_TYPES = 72,
- ISNS_TAG_FC4_DESCRIPTOR = 73,
- ISNS_TAG_FC4_FEATURES = 74,
- ISNS_TAG_IFCP_SCN_BITMAP = 75,
- ISNS_TAG_PORT_ROLE = 76,
- ISNS_TAG_PERMANENT_PORT_NAME = 77,
- ISNS_TAG_FC4_TYPE_CODE = 95,
- ISNS_TAG_FC_NODE_NAME_WWNN = 96,
- ISNS_TAG_SYMBOLIC_NODE_NAME = 97,
- ISNS_TAG_NODE_IP_ADDRESS = 98,
- ISNS_TAG_NODE_IPA = 99,
- ISNS_TAG_PROXY_ISCSI_NAME = 101,
- ISNS_TAG_SWITCH_NAME = 128,
- ISNS_TAG_PREFERRED_ID = 129,
- ISNS_TAG_ASSIGNED_ID = 130,
- ISNS_TAG_VIRTUAL_FABRIC_ID = 131,
- ISNS_TAG_SERVER_VENDOR_OUI = 256,
- ISNS_TAG_DD_SET_ID = 2049,
- ISNS_TAG_DD_SET_SYMBOLIC_NAME = 2050,
- ISNS_TAG_DD_SET_STATUS = 2051,
- ISNS_TAG_DD_SET_NEXT_ID = 2052,
- ISNS_TAG_DD_ID = 2065,
- ISNS_TAG_DD_SYMBOLIC_NAME = 2066,
- ISNS_TAG_DD_MEMBER_ISCSI_INDEX = 2067,
- ISNS_TAG_DD_MEMBER_ISCSI_NAME = 2068,
- ISNS_TAG_DD_MEMBER_FC_PORT_NAME = 2069,
- ISNS_TAG_DD_MEMBER_PORTAL_INDEX = 2070,
- ISNS_TAG_DD_MEMBER_PORTAL_IP_ADDR = 2071,
- ISNS_TAG_DD_MEMBER_PORTAL_TCP_UDP_PORT = 2072,
- ISNS_TAG_DD_FEATURES = 2078,
- ISNS_TAG_DD_NEXT_ID = 2079,
-
- __ISNS_TAG_MAX,
-
- ISNS_VENDOR_SPECIFIC_SERVER_BASE = 257, /* end 384 */
- ISNS_VENDOR_SPECIFIC_ENTITY_BASE = 385, /* end 512 */
- ISNS_VENDOR_SPECIFIC_PORTAL_BASE = 513, /* end 640 */
- ISNS_VENDOR_SPECIFIC_NODE_BASE = 641, /* end 768 */
- ISNS_VENDOR_SPECIFIC_DD_BASE = 1024, /* end 1280 */
- ISNS_VENDOR_SPECIFIC_DDSET_BASE = 1281, /* end 1536 */
- ISNS_VENDOR_SPECIFIC_OTHER_BASE = 1537, /* end 2048 */
-};
-
-typedef enum isns_entity_protocol {
- ISNS_ENTITY_PROTOCOL_NONE = 1,
- ISNS_ENTITY_PROTOCOL_ISCSI = 2,
- ISNS_ENTITY_PROTOCOL_IFCP = 3,
-} isns_entity_protocol_t;
-
-enum isns_iscsi_node_type_bits {
- ISNS_ISCSI_NODE_TYPE_TARGET = 0,
- ISNS_ISCSI_NODE_TYPE_INITIATOR = 1,
- ISNS_ISCSI_NODE_TYPE_CONTROL = 2,
-};
-#define ISNS_ISCSI_INITIATOR_MASK (1 << ISNS_ISCSI_NODE_TYPE_INITIATOR)
-#define ISNS_ISCSI_TARGET_MASK (1 << ISNS_ISCSI_NODE_TYPE_TARGET)
-#define ISNS_ISCSI_CONTROL_MASK (1 << ISNS_ISCSI_NODE_TYPE_CONTROL)
-
-enum isns_portal_port_bits {
- ISNS_PORTAL_PORT_UDP = 16,
-};
-#define ISNS_PORTAL_PORT_UDP_MASK (1 << ISNS_PORTAL_PORT_UDP)
-
-enum isns_portal_security_bits {
- ISNS_PORTAL_SEC_BITMAP_VALID = 0,
- ISNS_PORTAL_SEC_IPSEC_ENABLED = 1,
- ISNS_PORTAL_SEC_MAIN_MODE_ENABLED = 2,
- ISNS_PORTAL_SEC_AGGR_MODE_ENABLED = 3,
- ISNS_PORTAL_SEC_PFS_ENABLED = 4,
- ISNS_PORTAL_SEC_TRANSPORT_MODE_PREFERRED = 5,
- ISNS_PORTAL_SEC_TUNNEL_MODE_PREFERRED = 6,
-};
-#define ISNS_PORTAL_SEC_BITMAP_VALID_MASK (1 << ISNS_PORTAL_SEC_BITMAP_VALID)
-#define ISNS_PORTAL_SEC_IPSEC_ENABLED_MASK (1 << ISNS_PORTAL_SEC_IPSEC_ENABLED)
-#define ISNS_PORTAL_SEC_MAIN_MODE_ENABLED_MASK (1 << ISNS_PORTAL_SEC_MAIN_MODE_ENABLED)
-#define ISNS_PORTAL_SEC_AGGR_MODE_ENABLED_MASK (1 << ISNS_PORTAL_SEC_AGGR_MODE_ENABLED)
-#define ISNS_PORTAL_SEC_PFS_ENABLED_MASK (1 << ISNS_PORTAL_SEC_PFS_ENABLED)
-#define ISNS_PORTAL_SEC_TRANSPORT_MODE_PREFERRED_MASK (1 << ISNS_PORTAL_SEC_TRANSPORT_MODE_PREFERRED)
-#define ISNS_PORTAL_SEC_TUNNEL_MODE_PREFERRED_MASK (1 << ISNS_PORTAL_SEC_TUNNEL_MODE_PREFERRED)
-
-enum isns_scn_bits {
- ISNS_SCN_DD_MEMBER_ADDED = 0,
- ISNS_SCN_DD_MEMBER_REMOVED = 1,
- ISNS_SCN_OBJECT_UPDATED = 2,
- ISNS_SCN_OBJECT_ADDED = 3,
- ISNS_SCN_OBJECT_REMOVED = 4,
- ISNS_SCN_MANAGEMENT_REGISTRATION = 5,
- ISNS_SCN_TARGET_AND_SELF_ONLY = 6,
- ISNS_SCN_INITIATOR_AND_SELF_ONLY = 7,
-};
-#define ISNS_SCN_DD_MEMBER_ADDED_MASK (1 << ISNS_SCN_DD_MEMBER_ADDED)
-#define ISNS_SCN_DD_MEMBER_REMOVED_MASK (1 << ISNS_SCN_DD_MEMBER_REMOVED)
-#define ISNS_SCN_OBJECT_UPDATED_MASK (1 << ISNS_SCN_OBJECT_UPDATED)
-#define ISNS_SCN_OBJECT_ADDED_MASK (1 << ISNS_SCN_OBJECT_ADDED)
-#define ISNS_SCN_OBJECT_REMOVED_MASK (1 << ISNS_SCN_OBJECT_REMOVED)
-#define ISNS_SCN_MANAGEMENT_REGISTRATION_MASK (1 << ISNS_SCN_MANAGEMENT_REGISTRATION)
-#define ISNS_SCN_TARGET_AND_SELF_ONLY_MASK (1 << ISNS_SCN_TARGET_AND_SELF_ONLY)
-#define ISNS_SCN_INITIATOR_AND_SELF_ONLY_MASK (1 << ISNS_SCN_INITIATOR_AND_SELF_ONLY)
-
-enum isns_dds_status_bits {
- ISNS_DDS_ENABLED = 0,
-};
-#define ISNS_DDS_ENABLED_MASK (1 << ISNS_DDS_ENABLED)
-
-enum isns_dd_feature_bits {
- ISNS_DD_BOOT_LIST_ENABLED = 0,
-};
-#define ISNS_DD_BOOT_LIST_ENABLED_MASK (1 << ISN_BOOT_LIST_DDS_ENABLED)
-
-#define ISNS_PAD(len) (((len) + 3) & ~3UL)
-
-/*
- * iSNS auth block
- */
-#define ISNS_AUTHBLK_SIZE 20
-struct isns_authblk {
- uint32_t iab_bsd; /* 16bit in SLP */
- uint32_t iab_length; /* 16bit in SLP */
- uint64_t iab_timestamp; /* 32bit in SLP */
- uint32_t iab_spi_len; /* 16bit in SLP */
-
- char * iab_spi;
- void * iab_sig;
- uint32_t iab_sig_len;
-} __attribute__((packed));
-
-#define ISNS_AUTH_TYPE_SHA1_DSA 0x0002
-
-#endif /* ISNS_PROTO_H */
diff --git a/isns.h b/isns.h
deleted file mode 100644
index fa6ec3725c84..000000000000
--- a/isns.h
+++ /dev/null
@@ -1,676 +0,0 @@
-/*
- * iSNS implementation - library header file.
- *
- * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
- *
- * This file contains all declarations and definitions
- * commonly required by users of libisns.
- */
-
-#ifndef ISNS_H
-#define ISNS_H
-
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <stdio.h>
-
-#include <isns-proto.h>
-#include "types.h"
-
-#define ISNS_MAX_BUFFER 8192
-#define ISNS_MAX_MESSAGE 8192
-
-
-/*
- * Client handle
- */
-typedef struct isns_client isns_client_t;
-struct isns_client {
- isns_source_t * ic_source;
- isns_socket_t * ic_socket;
-};
-
-/*
- * Server operations
- */
-typedef int isns_service_fn_t(isns_server_t *, isns_simple_t *, isns_simple_t **);
-typedef void isns_scn_callback_fn_t(isns_db_t *, uint32_t scn_bits,
- isns_object_template_t *node_type,
- const char *node_name,
- const char *recipient);
-struct isns_service_ops {
- isns_service_fn_t * process_registration;
- isns_service_fn_t * process_query;
- isns_service_fn_t * process_getnext;
- isns_service_fn_t * process_deregistration;
- isns_service_fn_t * process_scn_registration;
- isns_service_fn_t * process_scn_deregistration;
- isns_service_fn_t * process_scn_event;
- isns_service_fn_t * process_scn;
- isns_service_fn_t * process_dd_registration;
- isns_service_fn_t * process_dd_deregistration;
- isns_service_fn_t * process_esi;
- isns_service_fn_t * process_heartbeat;
-};
-
-extern struct isns_service_ops isns_default_service_ops;
-extern struct isns_service_ops isns_callback_service_ops;
-
-/*
- * Output function
- */
-void isns_print_stdout(const char *, ...);
-
-/*
- * Database events
- */
-struct isns_db_event {
- isns_object_t * ie_recipient; /* Recipient node or NULL */
- isns_object_t * ie_object; /* Affected object */
- isns_object_t * ie_trigger; /* Triggering object */
- unsigned int ie_bits; /* SCN bitmask */
-};
-typedef void isns_db_callback_t(const isns_db_event_t *,
- void *user_data);
-
-/*
- * Handling of client objects
- */
-extern isns_client_t * isns_create_default_client(isns_security_t *);
-extern isns_client_t * isns_create_client(isns_security_t *,
- const char *source_name);
-extern isns_client_t * isns_create_local_client(isns_security_t *,
- const char *source_name);
-extern int isns_client_call(isns_client_t *,
- isns_simple_t **inout);
-extern void isns_client_destroy(isns_client_t *);
-extern int isns_client_get_local_address(const isns_client_t *,
- isns_portal_info_t *);
-
-/*
- * Handling of server objects
- */
-extern isns_server_t * isns_create_server(isns_source_t *,
- isns_db_t *,
- struct isns_service_ops *);
-extern void isns_server_set_scn_callback(isns_server_t *,
- isns_scn_callback_fn_t *);
-
-
-/*
- * Handling of source names
- */
-extern int isns_init_names(void);
-extern const char * isns_default_source_name(void);
-extern isns_source_t * isns_source_create(isns_attr_t *);
-extern isns_source_t * isns_source_create_iscsi(const char *name);
-extern isns_source_t * isns_source_create_ifcp(const char *name);
-extern uint32_t isns_source_type(const isns_source_t *);
-extern const char * isns_source_name(const isns_source_t *);
-extern isns_attr_t * isns_source_attr(const isns_source_t *);
-extern isns_source_t * isns_source_get(isns_source_t *);
-extern isns_source_t * isns_source_from_object(const isns_object_t *);
-extern void isns_source_release(isns_source_t *);
-extern int isns_source_match(const isns_source_t *,
- const isns_source_t *);
-
-extern void isns_server_set_source(isns_source_t *);
-extern isns_message_t * isns_process_message(isns_server_t *, isns_message_t *);
-
-extern void isns_simple_print(isns_simple_t *,
- isns_print_fn_t *);
-extern int isns_simple_call(isns_socket_t *,
- isns_simple_t **);
-extern int isns_simple_transmit(isns_socket_t *,
- isns_simple_t *,
- const isns_portal_info_t *,
- unsigned int,
- void (*callback)(uint32_t, int,
- isns_simple_t *));
-extern void isns_simple_free(isns_simple_t *);
-extern const isns_attr_list_t *isns_simple_get_attrs(isns_simple_t *);
-
-extern isns_simple_t * isns_create_query(isns_client_t *clnt,
- const isns_attr_list_t *query_key);
-extern isns_simple_t * isns_create_query2(isns_client_t *clnt,
- const isns_attr_list_t *query_key,
- isns_source_t *source);
-extern int isns_query_request_attr_tag(isns_simple_t *,
- uint32_t);
-extern int isns_query_request_attr(isns_simple_t *,
- isns_attr_t *);
-extern int isns_query_response_get_objects(isns_simple_t *qry,
- isns_object_list_t *result);
-
-extern isns_simple_t * isns_create_registration(isns_client_t *clnt,
- isns_object_t *key_object);
-extern isns_simple_t * isns_create_registration2(isns_client_t *clnt,
- isns_object_t *key_object,
- isns_source_t *source);
-extern void isns_registration_set_replace(isns_simple_t *, int);
-extern void isns_registration_add_object(isns_simple_t *,
- isns_object_t *object);
-extern void isns_registration_add_object_list(isns_simple_t *,
- isns_object_list_t *);
-extern int isns_registration_response_get_objects(isns_simple_t *,
- isns_object_list_t *);
-
-extern isns_simple_t * isns_create_getnext(isns_client_t *,
- isns_object_template_t *,
- const isns_attr_list_t *);
-extern int isns_getnext_response_get_object(isns_simple_t *,
- isns_object_t **);
-extern isns_simple_t * isns_create_getnext_followup(isns_client_t *,
- const isns_simple_t *,
- const isns_attr_list_t *);
-
-extern isns_simple_t * isns_create_deregistration(isns_client_t *clnt,
- const isns_attr_list_t *);
-
-extern isns_simple_t * isns_create_scn_registration(isns_client_t *clnt,
- unsigned int);
-extern isns_simple_t * isns_create_scn_registration2(isns_client_t *clnt,
- unsigned int,
- isns_source_t *);
-
-extern int isns_dd_load_all(isns_db_t *);
-extern void isns_dd_get_members(uint32_t, isns_object_list_t *, int);
-extern isns_simple_t * isns_create_dd_registration(isns_client_t *,
- const isns_attr_list_t *);
-extern isns_simple_t * isns_create_dd_deregistration(isns_client_t *,
- uint32_t, const isns_attr_list_t *);
-
-extern isns_object_t * isns_create_object(isns_object_template_t *,
- const isns_attr_list_t *,
- isns_object_t *);
-extern isns_object_t * isns_create_entity(int, const char *);
-extern isns_object_t * isns_create_entity_for_source(const isns_source_t *,
- const char *);
-extern const char * isns_entity_name(const isns_object_t *);
-extern isns_object_t * isns_create_portal(const isns_portal_info_t *,
- isns_object_t *parent);
-extern isns_object_t * isns_create_storage_node(const char *name,
- uint32_t type_mask,
- isns_object_t *parent);
-extern isns_object_t * isns_create_storage_node2(const isns_source_t *,
- uint32_t type_mask,
- isns_object_t *parent);
-extern isns_object_t * isns_create_iscsi_initiator(const char *name,
- isns_object_t *parent);
-extern isns_object_t * isns_create_iscsi_target(const char *name,
- isns_object_t *parent);
-extern const char * isns_storage_node_name(const isns_object_t *);
-extern isns_attr_t * isns_storage_node_key_attr(const isns_object_t *);
-extern isns_object_t * isns_create_portal_group(isns_object_t *portal,
- isns_object_t *iscsi_node, uint32_t pg_tag);
-extern isns_object_t * isns_create_default_portal_group(isns_db_t *,
- isns_object_t *portal,
- isns_object_t *node);
-extern void isns_get_portal_groups(isns_object_t *portal,
- isns_object_t *node,
- isns_object_list_t *result);
-
-extern const char * isns_object_template_name(isns_object_template_t *);
-extern int isns_object_set_attr(isns_object_t *, isns_attr_t *);
-extern int isns_object_set_attrlist(isns_object_t *, const isns_attr_list_t *);
-extern isns_object_t * isns_object_get(isns_object_t *);
-extern int isns_object_get_attrlist(isns_object_t *obj,
- isns_attr_list_t *result,
- const isns_attr_list_t *requested_attrs);
-extern int isns_object_get_key_attrs(isns_object_t *,
- isns_attr_list_t *);
-extern int isns_object_get_attr(const isns_object_t *, uint32_t,
- isns_attr_t **);
-extern void isns_object_get_related(isns_db_t *,
- isns_object_t *, isns_object_list_t *);
-extern void isns_object_get_descendants(const isns_object_t *,
- isns_object_template_t *,
- isns_object_list_t *);
-extern void isns_object_release(isns_object_t *);
-extern int isns_object_match(const isns_object_t *,
- const isns_attr_list_t *);
-extern isns_object_t * isns_object_get_entity(isns_object_t *);
-extern int isns_object_attr_valid(isns_object_template_t *, uint32_t);
-extern int isns_object_contains(const isns_object_t *, const isns_object_t *);
-extern int isns_object_delete_attr(isns_object_t *, uint32_t);
-extern int isns_object_is(const isns_object_t *,
- isns_object_template_t *);
-extern int isns_object_is_entity(const isns_object_t *);
-extern int isns_object_is_iscsi_node(const isns_object_t *);
-extern int isns_object_is_fc_port(const isns_object_t *);
-extern int isns_object_is_fc_node(const isns_object_t *);
-extern int isns_object_is_portal(const isns_object_t *);
-extern int isns_object_is_pg(const isns_object_t *);
-extern int isns_object_is_policy(const isns_object_t *);
-extern int isns_object_is_dd(const isns_object_t *);
-extern int isns_object_is_ddset(const isns_object_t *);
-extern void isns_object_print(isns_object_t *,
- isns_print_fn_t *);
-extern time_t isns_object_last_modified(const isns_object_t *);
-extern int isns_object_mark_membership(isns_object_t *, uint32_t);
-extern int isns_object_clear_membership(isns_object_t *, uint32_t);
-extern int isns_object_test_membership(const isns_object_t *, uint32_t);
-extern int isns_object_test_visibility(const isns_object_t *,
- const isns_object_t *);
-extern void isns_object_get_visible(const isns_object_t *,
- isns_db_t *, isns_object_list_t *);
-extern void isns_entity_touch(isns_object_t *);
-extern int isns_object_extract_keys(const isns_object_t *,
- isns_attr_list_t *);
-extern int isns_object_extract_all(const isns_object_t *,
- isns_attr_list_t *);
-extern int isns_object_extract_writable(const isns_object_t *,
- isns_attr_list_t *);
-
-
-extern int isns_object_set_nil(isns_object_t *obj,
- uint32_t tag);
-extern int isns_object_set_string(isns_object_t *obj,
- uint32_t tag,
- const char *value);
-extern int isns_object_set_uint32(isns_object_t *obj,
- uint32_t tag,
- uint32_t value);
-extern int isns_object_set_uint64(isns_object_t *obj,
- uint32_t tag,
- uint64_t value);
-extern int isns_object_set_ipaddr(isns_object_t *obj,
- uint32_t tag,
- const struct in6_addr *value);
-
-extern int isns_object_get_string(const isns_object_t *,
- uint32_t,
- const char **);
-extern int isns_object_get_ipaddr(const isns_object_t *,
- uint32_t,
- struct in6_addr *);
-extern int isns_object_get_uint32(const isns_object_t *,
- uint32_t,
- uint32_t *);
-extern int isns_object_get_uint64(const isns_object_t *,
- uint32_t,
- uint64_t *);
-extern int isns_object_get_opaque(const isns_object_t *,
- uint32_t,
- const void **, size_t *);
-
-
-extern int isns_object_find_descendants(isns_object_t *obj,
- isns_object_template_t *,
- const isns_attr_list_t *keys,
- isns_object_list_t *result);
-extern isns_object_t * isns_object_find_descendant(isns_object_t *obj,
- const isns_attr_list_t *keys);
-extern int isns_object_detach(isns_object_t *);
-extern int isns_object_attach(isns_object_t *, isns_object_t *);
-extern void isns_object_prune_attrs(isns_object_t *);
-extern void isns_mark_object(isns_object_t *, unsigned int);
-
-extern int isns_get_entity_identifier(isns_object_t *, const char **);
-extern int isns_get_entity_protocol(isns_object_t *, isns_entity_protocol_t *);
-extern int isns_get_entity_index(isns_object_t *, uint32_t *);
-
-extern int isns_get_portal_ipaddr(isns_object_t *, struct in6_addr *);
-extern int isns_get_portal_tcpudp_port(isns_object_t *,
- int *ipprotocol, uint16_t *port);
-extern int isns_get_portal_index(isns_object_t *, uint32_t *);
-
-extern int isns_get_address(struct sockaddr_storage *,
- const char *, const char *, int, int, int);
-extern char * isns_get_canon_name(const char *);
-
-extern isns_db_t * isns_db_open(const char *location);
-extern isns_db_t * isns_db_open_shadow(isns_object_list_t *);
-extern isns_object_t * isns_db_lookup(isns_db_t *,
- isns_object_template_t *,
- const isns_attr_list_t *);
-extern isns_object_t * isns_db_vlookup(isns_db_t *,
- isns_object_template_t *,
- ...);
-extern int isns_db_gang_lookup(isns_db_t *,
- isns_object_template_t *,
- const isns_attr_list_t *,
- isns_object_list_t *);
-extern isns_object_t * isns_db_get_next(isns_db_t *,
- isns_object_template_t *,
- const isns_attr_list_t *current,
- const isns_attr_list_t *scope,
- const isns_source_t *source);
-extern isns_object_t * isns_db_lookup_source_node(isns_db_t *,
- const isns_source_t *);
-extern void isns_db_get_domainless(isns_db_t *,
- isns_object_template_t *,
- isns_object_list_t *);
-extern uint32_t isns_db_allocate_index(isns_db_t *);
-extern void isns_db_insert(isns_db_t *, isns_object_t *);
-extern void isns_db_insert_limbo(isns_db_t *, isns_object_t *);
-extern int isns_db_remove(isns_db_t *, isns_object_t *);
-extern time_t isns_db_expire(isns_db_t *);
-extern void isns_db_purge(isns_db_t *);
-extern void isns_db_sync(isns_db_t *);
-extern const char * isns_db_generate_eid(isns_db_t *, char *, size_t);
-extern isns_object_t * isns_db_get_control(isns_db_t *);
-extern void isns_db_print(isns_db_t *,
- isns_print_fn_t *);
-
-extern void isns_db_begin_transaction(isns_db_t *);
-extern void isns_db_commit(isns_db_t *);
-extern void isns_db_rollback(isns_db_t *);
-
-extern void isns_object_event(isns_object_t *obj,
- unsigned int bits,
- isns_object_t *trigger);
-extern void isns_unicast_event(isns_object_t *dst,
- isns_object_t *obj,
- unsigned int bits,
- isns_object_t *trigger);
-extern void isns_register_callback(isns_db_callback_t *,
- void *);
-extern void isns_flush_events(void);
-extern const char * isns_event_string(unsigned int);
-
-extern void isns_add_timer(unsigned int,
- isns_timer_callback_t *, void *);
-extern void isns_add_oneshot_timer(unsigned int,
- isns_timer_callback_t *, void *);
-extern void isns_cancel_timer(isns_timer_callback_t *, void *);
-extern time_t isns_run_timers(void);
-
-extern void isns_object_list_init(isns_object_list_t *);
-extern void isns_object_list_destroy(isns_object_list_t *);
-extern int isns_object_list_contains(const isns_object_list_t *,
- isns_object_t *);
-extern void isns_object_list_append(isns_object_list_t *,
- isns_object_t *);
-extern void isns_object_list_append_list(isns_object_list_t *,
- const isns_object_list_t *);
-extern isns_object_t * isns_object_list_lookup(const isns_object_list_t *,
- isns_object_template_t *,
- const isns_attr_list_t *);
-extern int isns_object_list_gang_lookup(const isns_object_list_t *,
- isns_object_template_t *,
- const isns_attr_list_t *,
- isns_object_list_t *);
-extern int isns_object_list_remove(isns_object_list_t *,
- isns_object_t *);
-extern void isns_object_list_uniq(isns_object_list_t *);
-extern void isns_object_list_print(const isns_object_list_t *,
- isns_print_fn_t *);
-
-isns_object_template_t *isns_object_template_for_key_attrs(const isns_attr_list_t *);
-isns_object_template_t *isns_object_template_for_tag(uint32_t);
-isns_object_template_t *isns_object_template_for_index_tag(uint32_t);
-isns_object_template_t *isns_object_template_find(uint32_t);
-
-extern int isns_attr_set(isns_attr_t *, const void *);
-extern isns_attr_t * isns_attr_get(isns_attr_t *);
-extern void isns_attr_release(isns_attr_t *);
-extern void isns_attr_print(const isns_attr_t *,
- isns_print_fn_t *);
-extern char * isns_attr_print_value(const isns_attr_t *,
- char *, size_t);
-extern int isns_attr_match(const isns_attr_t *,
- const isns_attr_t *);
-extern int isns_attr_compare(const isns_attr_t *,
- const isns_attr_t *);
-extern isns_attr_t * isns_attr_from_string(uint32_t, const char *);
-
-extern void isns_attr_list_print(const isns_attr_list_t *,
- isns_print_fn_t *);
-
-extern void isns_attr_list_init(isns_attr_list_t *);
-extern void isns_attr_list_copy(isns_attr_list_t *,
- const isns_attr_list_t *);
-extern void isns_attr_list_destroy(isns_attr_list_t *);
-extern int isns_attr_list_remove_tag(isns_attr_list_t *,
- uint32_t);
-
-extern void isns_attr_list_append_attr(isns_attr_list_t *,
- isns_attr_t *);
-extern void isns_attr_list_append_list(isns_attr_list_t *,
- const isns_attr_list_t *);
-extern int isns_attr_list_replace_attr(isns_attr_list_t *,
- isns_attr_t *);
-/* Warning: this does *NOT* return a reference to the attribute */
-extern int isns_attr_list_get_attr(const isns_attr_list_t *,
- uint32_t tag,
- isns_attr_t **);
-
-extern void isns_attr_list_append_nil(isns_attr_list_t *,
- uint32_t tag);
-extern void isns_attr_list_append_string(isns_attr_list_t *,
- uint32_t tag, const char *value);
-extern void isns_attr_list_append_uint32(isns_attr_list_t *,
- uint32_t tag, uint32_t value);
-extern void isns_attr_list_append_uint64(isns_attr_list_t *,
- uint32_t, int64_t);
-extern void isns_attr_list_append_int32(isns_attr_list_t *,
- uint32_t tag, int32_t value);
-extern void isns_attr_list_append_opaque(isns_attr_list_t *,
- uint32_t tag, const void *ptr, size_t len);
-extern void isns_attr_list_append_ipaddr(isns_attr_list_t *,
- uint32_t tag, const struct in6_addr *);
-
-extern int isns_attr_list_append(isns_attr_list_t *,
- uint32_t tag, const void *);
-extern int isns_attr_list_update(isns_attr_list_t *,
- uint32_t tag, const void *);
-
-extern int isns_attr_list_contains(const isns_attr_list_t *,
- uint32_t tag);
-extern int isns_attr_list_compare(const isns_attr_list_t *,
- const isns_attr_list_t *);
-
-/*
- * Helper macros
- */
-#define ISNS_ATTR_TYPE_CHECK(attr, type) \
- ((attr)->ia_value.iv_type == &isns_attr_type_##type)
-#define ISNS_ATTR_IS_NIL(attr) \
- ISNS_ATTR_TYPE_CHECK(attr, nil)
-#define ISNS_ATTR_IS_STRING(attr) \
- ISNS_ATTR_TYPE_CHECK(attr, string)
-#define ISNS_ATTR_IS_IPADDR(attr) \
- ISNS_ATTR_TYPE_CHECK(attr, ipaddr)
-#define ISNS_ATTR_IS_UINT32(attr) \
- ISNS_ATTR_TYPE_CHECK(attr, uint32)
-#define ISNS_ATTR_IS_UINT64(attr) \
- ISNS_ATTR_TYPE_CHECK(attr, uint64)
-#define ISNS_ATTR_IS_OPAQUE(attr) \
- ISNS_ATTR_TYPE_CHECK(attr, opaque)
-
-
-
-extern isns_socket_t * isns_create_server_socket(const char *hostname, const char *portname,
- int af_hint, int sock_type);
-extern isns_socket_t * isns_create_client_socket(const char *hostname, const char *portname,
- int af_hint, int sock_type);
-extern isns_socket_t * isns_create_systemd_socket(int index);
-extern isns_socket_t * isns_create_bound_client_socket(const char *myaddr,
- const char *hostname, const char *portname,
- int af_hint, int sock_type);
-extern isns_socket_t * isns_connect_to_portal(const isns_portal_info_t *);
-extern void isns_socket_set_report_failure(isns_socket_t *);
-extern void isns_socket_set_disconnect_fatal(isns_socket_t *);
-extern int isns_socket_get_local_addr(const isns_socket_t *,
- struct sockaddr_storage *);
-extern int isns_socket_get_portal_info(const isns_socket_t *,
- isns_portal_info_t *);
-extern void isns_socket_set_security_ctx(isns_socket_t *,
- isns_security_t *);
-extern isns_message_t * isns_recv_message(struct timeval *timeout);
-extern isns_message_t * isns_socket_call(isns_socket_t *, isns_message_t *, long);
-extern int isns_socket_send(isns_socket_t *, isns_message_t *);
-extern void isns_socket_free(isns_socket_t *);
-extern int isns_addr_get_port(const struct sockaddr *);
-extern void isns_addr_set_port(struct sockaddr *, unsigned int);
-extern isns_socket_t * isns_socket_find_server(const isns_portal_info_t *);
-
-extern isns_message_t * isns_create_message(uint16_t function, uint16_t flags);
-extern isns_message_t * isns_create_reply(const isns_message_t *);
-extern int isns_message_init(isns_message_t *,
- uint16_t, uint16_t, size_t);
-extern int isns_message_status(isns_message_t *);
-extern void isns_message_release(isns_message_t *);
-extern unsigned int isns_message_function(const isns_message_t *);
-extern isns_socket_t * isns_message_socket(const isns_message_t *);
-extern void isns_message_set_error(isns_message_t *, uint32_t);
-
-extern const char * isns_strerror(enum isns_status);
-extern const char * isns_function_name(unsigned int);
-
-/*
- * Security related functions
- */
-extern int isns_security_init(void);
-extern isns_principal_t *isns_security_load_privkey(isns_security_t *,
- const char *filename);
-extern isns_principal_t *isns_security_load_pubkey(isns_security_t *,
- const char *filename);
-extern isns_security_t *isns_default_security_context(int server_only);
-extern isns_security_t *isns_control_security_context(int server_only);
-extern isns_security_t *isns_create_dsa_context(void);
-extern void isns_security_set_identity(isns_security_t *, isns_principal_t *);
-extern void isns_principal_free(isns_principal_t *);
-extern void isns_add_principal(isns_security_t *, isns_principal_t *);
-extern isns_keystore_t *isns_create_keystore(const char *);
-extern void isns_security_set_keystore(isns_security_t *,
- isns_keystore_t *);
-extern void isns_principal_set_name(isns_principal_t *, const char *);
-extern const char * isns_principal_name(const isns_principal_t *);
-
-extern isns_object_template_t isns_entity_template;
-extern isns_object_template_t isns_portal_template;
-extern isns_object_template_t isns_iscsi_node_template;
-extern isns_object_template_t isns_fc_port_template;
-extern isns_object_template_t isns_fc_node_template;
-extern isns_object_template_t isns_iscsi_pg_template;
-extern isns_object_template_t isns_dd_template;
-extern isns_object_template_t isns_ddset_template;
-
-/*
- * Config file parser
- */
-struct isns_config {
- char * ic_host_name;
- char * ic_auth_name;
- char * ic_source_name;
- char * ic_source_suffix;
- char * ic_entity_name;
- char * ic_iqn_prefix;
-
- char * ic_server_name;
- char * ic_bind_address;
- char * ic_database;
- char * ic_auth_key_file;
- char * ic_server_key_file;
- char * ic_client_keystore;
- char * ic_control_socket;
- char * ic_pidfile;
- char * ic_local_registry_file;
- int ic_security;
- int ic_slp_register;
-
- char * ic_control_name;
- char * ic_control_key_file;
-
- unsigned int ic_registration_period;
- unsigned int ic_scn_timeout;
- unsigned int ic_scn_retries;
- char * ic_scn_callout;
-
- unsigned int ic_esi_max_interval;
- unsigned int ic_esi_min_interval;
- unsigned int ic_esi_retries;
-
- unsigned int ic_use_default_domain;
-
- struct {
- unsigned int policy;
- unsigned int replay_window;
- unsigned int timestamp_jitter;
- int allow_unknown_peers;
- } ic_auth;
- struct {
- unsigned int max_sockets;
- unsigned int connect_timeout;
- unsigned int reconnect_timeout;
- unsigned int call_timeout;
- unsigned int udp_retrans_timeout;
- unsigned int tcp_retrans_timeout;
- unsigned int idle_timeout;
- } ic_network;
- struct {
- char * param_file;
- unsigned int key_bits;
- } ic_dsa;
-
-};
-
-extern struct isns_config isns_config;
-extern int isns_read_initiatorname(const char *);
-extern int isns_read_config(const char *);
-extern int isns_config_set(const char *, char *);
-
-/*
- * Reserved entity name for Policy information
- */
-#define ISNS_ENTITY_CONTROL "CONTROL"
-
-
-/*
- * Helpers to deal with portal information
- */
-struct isns_portal_info {
- struct sockaddr_in6 addr;
- int proto;
-};
-
-extern void isns_portal_init(isns_portal_info_t *,
- const struct sockaddr *, int);
-extern int isns_portal_parse(isns_portal_info_t *portal,
- const char *addr_spec,
- const char *default_port);
-extern int isns_portal_from_attr_list(isns_portal_info_t *,
- uint32_t addr_tag, uint32_t port_tag,
- const isns_attr_list_t *);
-extern int isns_portal_from_attr_pair(isns_portal_info_t *,
- const isns_attr_t *,
- const isns_attr_t *);
-extern int isns_portal_from_object(isns_portal_info_t *,
- uint32_t addr_tag, uint32_t port_tag,
- const isns_object_t *);
-extern int isns_portal_from_sockaddr(isns_portal_info_t *,
- const struct sockaddr_storage *);
-extern int isns_portal_to_sockaddr(const isns_portal_info_t *,
- struct sockaddr_storage *);
-extern int isns_portal_to_attr_list(const isns_portal_info_t *,
- uint32_t addr_tag, uint32_t port_tag,
- isns_attr_list_t *);
-extern int isns_portal_to_object(const isns_portal_info_t *,
- uint32_t addr_tag, uint32_t port_tag,
- isns_object_t *);
-extern int isns_portal_is_wildcard(const isns_portal_info_t *);
-extern uint32_t isns_portal_tcpudp_port(const isns_portal_info_t *);
-extern const char * isns_portal_string(const isns_portal_info_t *);
-extern int isns_portal_equal(const isns_portal_info_t *,
- const isns_portal_info_t *);
-extern int isns_enumerate_portals(isns_portal_info_t *,
- unsigned int);
-extern int isns_get_nr_portals(void);
-
-/* Local registry stuff */
-extern int isns_local_registry_load(const char *, pid_t, isns_object_list_t *);
-extern int isns_local_registry_store(const char *, pid_t, const isns_object_list_t *);
-extern int isns_local_registry_purge(const char *, pid_t);
-
-/* Should go somwhere else .*/
-extern int isns_esi_enabled;
-
-extern void isns_esi_init(isns_server_t *);
-extern void isns_esi_register(isns_object_t *);
-
-extern void isns_scn_init(isns_server_t *);
-extern time_t isns_scn_transmit_all(void);
-
-#endif /* ISNS_H */
diff --git a/isnsadm.c b/isnsadm.c
index c170595372da..184a22fb84d7 100644
--- a/isnsadm.c
+++ b/isnsadm.c
@@ -12,13 +12,13 @@
#include <limits.h>

#include "config.h"
-#include "isns.h"
-#include "util.h"
+#include <libisns/isns.h>
+#include <libisns/util.h>
#include "vendor.h"
-#include "attrs.h"
+#include <libisns/attrs.h>
#include "security.h"
#include "objects.h"
-#include "paths.h"
+#include <libisns/paths.h>

#define ISNS_DEFAULT_PORT_INITIATOR 860
#define ISNS_DEFAULT_PORT_TARGET 3260
diff --git a/isnsd.c b/isnsd.c
index b8a41c4e2fcc..9d383de246ad 100644
--- a/isnsd.c
+++ b/isnsd.c
@@ -16,10 +16,10 @@
# include <mcheck.h>
#endif

-#include <isns.h>
+#include <libisns/isns.h>
#include "security.h"
-#include "util.h"
-#include "paths.h"
+#include <libisns/util.h>
+#include <libisns/paths.h>
#include "internal.h"

enum {
diff --git a/isnsdd.c b/isnsdd.c
index 5b0dfb4c56fe..0b034cbd3563 100644
--- a/isnsdd.c
+++ b/isnsdd.c
@@ -22,13 +22,13 @@
# include <mcheck.h>
#endif

-#include <isns.h>
+#include <libisns/isns.h>
#include "config.h"
#include "security.h"
-#include "util.h"
-#include "isns-proto.h"
-#include "paths.h"
-#include "attrs.h"
+#include <libisns/util.h>
+#include <libisns/isns-proto.h>
+#include <libisns/paths.h>
+#include <libisns/attrs.h>

enum {
ROLE_INITIATOR = 1,
diff --git a/local.c b/local.c
index ec7d1a8bcd4e..5be3f099c07c 100644
--- a/local.c
+++ b/local.c
@@ -33,13 +33,13 @@
#include <limits.h>

#include "config.h"
-#include "isns.h"
+#include <libisns/isns.h>
#include "security.h"
-#include "util.h"
-#include "isns-proto.h"
-#include "paths.h"
-#include "attrs.h"
-#include "util.h"
+#include <libisns/util.h>
+#include <libisns/isns-proto.h>
+#include <libisns/paths.h>
+#include <libisns/attrs.h>
+#include <libisns/util.h>

typedef int __isns_local_registry_cb_fn_t(const char *line,
int argc, char **argv,
diff --git a/logging.c b/logging.c
index c3edc360298f..25390bcc797c 100644
--- a/logging.c
+++ b/logging.c
@@ -10,7 +10,7 @@
#include <string.h>
#include <syslog.h>

-#include "util.h"
+#include <libisns/util.h>

static unsigned int log_stdout = 1;
static unsigned int debugging = 0;
diff --git a/mdebug.c b/mdebug.c
index 90dcaf0f575f..4eda52bc9064 100644
--- a/mdebug.c
+++ b/mdebug.c
@@ -8,7 +8,7 @@

#include <stdlib.h>
#include <string.h>
-#include "util.h"
+#include <libisns/util.h>

static void * isns_malloc_default(size_t, const char *, unsigned int);
static void * isns_calloc_default(unsigned int, size_t,
diff --git a/message.c b/message.c
index 5fa09d57cc22..ed190defff98 100644
--- a/message.c
+++ b/message.c
@@ -11,11 +11,11 @@
#include <sys/time.h> /* for timercmp */
#include <unistd.h> /* gethostname */
#include <ctype.h>
-#include "isns.h"
-#include "attrs.h"
-#include "message.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
+#include <libisns/message.h>
#include "socket.h"
-#include "util.h"
+#include <libisns/util.h>

/* iSCSI qualified names include the year and
* month in which the domain was assigned.
diff --git a/message.h b/message.h
deleted file mode 100644
index f1f4ed604063..000000000000
--- a/message.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * iSNS message definitions and functions
- *
- * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
- */
-
-#ifndef ISNS_MESSAGE_H
-#define ISNS_MESSAGE_H
-
-#include "attrs.h"
-#include "source.h"
-#include "util.h"
-
-typedef struct isns_message_queue isns_message_queue_t;
-
-struct isns_simple {
- uint32_t is_function;
- isns_source_t * is_source;
- isns_policy_t * is_policy;
- uint16_t is_xid;
-
- unsigned int is_replace : 1;
-
- isns_attr_list_t is_message_attrs;
- isns_attr_list_t is_operating_attrs;
-};
-
-struct isns_message {
- unsigned int im_users;
- isns_list_t im_list;
- struct sockaddr_storage im_addr;
- socklen_t im_addrlen;
- uint32_t im_xid;
- struct isns_hdr im_header;
- struct isns_buf * im_payload;
- isns_socket_t * im_socket;
- isns_principal_t * im_security;
- struct ucred * im_creds;
-
- isns_message_queue_t * im_queue;
-
- /* When to retransmit */
- struct timeval im_resend_timeout;
- struct timeval im_timeout;
-
- void (*im_destroy)(isns_message_t *);
- void (*im_callback)(isns_message_t *,
- isns_message_t *);
- void * im_calldata;
-};
-
-enum {
- ISNS_MQ_SORT_NONE,
- ISNS_MQ_SORT_RESEND_TIMEOUT,
-};
-
-struct isns_message_queue {
- isns_list_t imq_list;
- size_t imq_count;
-};
-
-struct isns_server {
- isns_source_t * is_source;
- isns_db_t * is_db;
-
- isns_scn_callback_fn_t *is_scn_callback;
- struct isns_service_ops *is_ops;
-};
-
-extern isns_message_t * __isns_alloc_message(uint32_t, size_t, void (*)(isns_message_t *));
-extern isns_security_t *isns_message_security(const isns_message_t *);
-
-extern isns_message_t * isns_message_queue_find(isns_message_queue_t *, uint32_t,
- const struct sockaddr_storage *, socklen_t);
-extern void isns_message_queue_insert_sorted(isns_message_queue_t *,
- int, isns_message_t *);
-extern void isns_message_queue_move(isns_message_queue_t *,
- isns_message_t *);
-extern void isns_message_queue_destroy(isns_message_queue_t *);
-
-extern isns_simple_t * isns_simple_create(uint32_t,
- isns_source_t *,
- const isns_attr_list_t *);
-extern void isns_simple_free(isns_simple_t *);
-extern int isns_simple_encode(isns_simple_t *,
- isns_message_t **result);
-extern int isns_simple_decode(isns_message_t *,
- isns_simple_t **);
-extern int isns_simple_encode_response(isns_simple_t *,
- const isns_message_t *, isns_message_t **);
-extern int isns_simple_response_get_objects(isns_simple_t *,
- isns_object_list_t *);
-extern const char * isns_function_name(uint32_t);
-
-extern isns_source_t * isns_simple_get_source(isns_simple_t *);
-
-extern int isns_process_registration(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_query(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_getnext(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_deregistration(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_scn_register(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_scn_deregistration(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_dd_registration(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_dd_deregistration(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_esi(isns_server_t *, isns_simple_t *, isns_simple_t **);
-extern int isns_process_scn(isns_server_t *, isns_simple_t *, isns_simple_t **);
-
-/*
- * Inline functions for message queues.
- */
-static inline void
-isns_message_queue_init(isns_message_queue_t *q)
-{
- isns_list_init(&q->imq_list);
- q->imq_count = 0;
-}
-
-static inline isns_message_t *
-isns_message_queue_head(const isns_message_queue_t *q)
-{
- isns_list_t *pos = q->imq_list.next;
-
- if (pos == &q->imq_list)
- return NULL;
- return isns_list_item(isns_message_t, im_list, pos);
-}
-
-static inline void
-isns_message_queue_append(isns_message_queue_t *q, isns_message_t *msg)
-{
- isns_assert(msg->im_queue == NULL);
- isns_list_append(&q->imq_list, &msg->im_list);
- q->imq_count++;
-
- msg->im_queue = q;
- msg->im_users++;
-}
-
-static inline isns_message_t *
-isns_message_queue_remove(isns_message_queue_t *q, isns_message_t *msg)
-{
- isns_assert(msg->im_queue == q);
- isns_list_del(&msg->im_list);
- msg->im_queue = NULL;
- q->imq_count--;
-
- return msg;
-}
-
-static inline isns_message_t *
-isns_message_unlink(isns_message_t *msg)
-{
- if (msg->im_queue)
- return isns_message_queue_remove(msg->im_queue, msg);
- return NULL;
-}
-
-static inline isns_message_t *
-isns_message_dequeue(isns_message_queue_t *q)
-{
- isns_message_t *msg;
-
- if ((msg = isns_message_queue_head(q)) != NULL) {
- isns_list_del(&msg->im_list);
- msg->im_queue = NULL;
- q->imq_count--;
- }
- return msg;
-}
-
-/*
- * Iterator for looping over all messages in a queue
- */
-static inline void
-isns_message_queue_begin(isns_message_queue_t *q, isns_list_t **pos)
-{
- *pos = q->imq_list.next;
-}
-
-static inline isns_message_t *
-isns_message_queue_next(isns_message_queue_t *q, isns_list_t **pos)
-{
- isns_list_t *next = *pos;
-
- if (next == &q->imq_list)
- return NULL;
- *pos = next->next;
- return isns_list_item(isns_message_t, im_list, next);
-}
-
-#define isns_message_queue_foreach(q, pos, item) \
- for (isns_message_queue_begin(q, &pos); \
- (item = isns_message_queue_next(q, &pos)) != NULL; \
- )
-
-#endif /* ISNS_MESSAGE_H */
diff --git a/objects.c b/objects.c
index 1504026e2d60..5de5c4521f10 100644
--- a/objects.c
+++ b/objects.c
@@ -7,12 +7,12 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
-#include "source.h"
+#include <libisns/source.h>
#include "vendor.h"
-#include "attrs.h"
-#include "util.h"
+#include <libisns/attrs.h>
+#include <libisns/util.h>

/* For relationship stuff - should go */
#include "db.h"
diff --git a/objects.h b/objects.h
index 8cc40c6fc3af..f764abb8d4c5 100644
--- a/objects.h
+++ b/objects.h
@@ -7,8 +7,8 @@
#ifndef ISNS_OBJECTS_H
#define ISNS_OBJECTS_H

-#include "isns.h"
-#include "attrs.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>

enum isns_object_id {
ISNS_OBJECT_TYPE_ENTITY = 1,
diff --git a/parser.c b/parser.c
index 378f2c8daead..878ed5285e43 100644
--- a/parser.c
+++ b/parser.c
@@ -10,7 +10,7 @@
#include <string.h>
#include <ctype.h>
#include <err.h>
-#include "util.h"
+#include <libisns/util.h>

/*
* By default, the parser will recognize any white space
diff --git a/paths.h b/paths.h
deleted file mode 100644
index 64cf486137ca..000000000000
--- a/paths.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Compile time configuration.
- * For now, let's keep it simple and ignore autoconf...
- *
- * Copyright (C) 2006, 2007 Olaf Kirch <olaf....@oracle.com>
- */
-
-#ifndef ISNS_CONFIG_H
-#define ISNS_CONFIG_H
-
-#define __OPENISNS_MKVERSION(maj, min) (((maj) << 8) + (min))
-#define OPENISNS_VERSION __OPENISNS_MKVERSION(0, 93);
-#define OPENISNS_VERSION_STRING "0.93"
-
-#define ISNS_ETCDIR "/etc/isns"
-#define ISNS_RUNDIR "/var/run"
-#define ISNS_DEFAULT_ISNSD_CONFIG ISNS_ETCDIR "/isnsd.conf"
-#define ISNS_DEFAULT_ISNSDD_CONFIG ISNS_ETCDIR "/isnsdd.conf"
-#define ISNS_DEFAULT_ISNSADM_CONFIG ISNS_ETCDIR "/isnsadm.conf"
-#define ISNS_DEFAULT_LOCAL_REGISTRY ISNS_RUNDIR "/isns.registry"
-
-#define ISCSI_DEFAULT_INITIATORNAME "/etc/iscsi/initiatorname.iscsi"
-
-#endif /* ISNS_CONFIG_H */
diff --git a/pidfile.c b/pidfile.c
index 338437316f66..580d70fa854a 100644
--- a/pidfile.c
+++ b/pidfile.c
@@ -11,7 +11,7 @@
#include <errno.h>
#include <unistd.h>

-#include "util.h"
+#include <libisns/util.h>

static void
__update_pidfile(int fd)
diff --git a/pki.c b/pki.c
index 261e093743de..584c20c20407 100644
--- a/pki.c
+++ b/pki.c
@@ -12,9 +12,9 @@
#include <openssl/err.h>
#include <fcntl.h>
#include "config.h"
-#include "isns.h"
+#include <libisns/isns.h>
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>

#ifdef WITH_SECURITY

diff --git a/policy.c b/policy.c
index 27da60f4ee9c..80d17bb02ac3 100644
--- a/policy.c
+++ b/policy.c
@@ -9,11 +9,11 @@

#include <string.h>
#include "config.h"
-#include "isns.h"
+#include <libisns/isns.h>
#include "security.h"
#include "objects.h"
-#include "message.h"
-#include "util.h"
+#include <libisns/message.h>
+#include <libisns/util.h>

/*
A brief discussion of policy
diff --git a/portal-group.c b/portal-group.c
index 647bbde5434f..f7fbec8a7469 100644
--- a/portal-group.c
+++ b/portal-group.c
@@ -6,11 +6,11 @@

#include <stdlib.h>
#include <string.h>
-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
#include "vendor.h"
-#include "attrs.h"
-#include "util.h"
+#include <libisns/attrs.h>
+#include <libisns/util.h>

/* For relationship stuff - should go */
#include "db.h"
diff --git a/query.c b/query.c
index 8382de8614c0..37a3d6206d83 100644
--- a/query.c
+++ b/query.c
@@ -7,13 +7,13 @@
#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
-#include "message.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
+#include <libisns/message.h>
#include "security.h"
#include "objects.h"
#include "db.h"
-#include "util.h"
+#include <libisns/util.h>

/*
* Create a query, and set the source name
diff --git a/register.c b/register.c
index 007cf551c3e9..0cebd1e7735a 100644
--- a/register.c
+++ b/register.c
@@ -8,12 +8,12 @@
#include <string.h>
#include <time.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
#include "objects.h"
-#include "message.h"
+#include <libisns/message.h>
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>
#include "db.h"


diff --git a/relation.c b/relation.c
index caac38bca92d..88b1bb4989bb 100644
--- a/relation.c
+++ b/relation.c
@@ -30,9 +30,9 @@
#include <time.h>
#include <stdarg.h>

-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
-#include "util.h"
+#include <libisns/util.h>
#include "db.h"

struct isns_relation_soup {
diff --git a/scn.c b/scn.c
index 92721e02ba4d..725d22267c39 100644
--- a/scn.c
+++ b/scn.c
@@ -8,12 +8,12 @@
#include <string.h>
#include <time.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
#include "objects.h"
-#include "message.h"
+#include <libisns/message.h>
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>
#include "db.h"

typedef struct isns_scn isns_scn_t;
diff --git a/scope.c b/scope.c
index 844d552b0774..90af99480c6a 100644
--- a/scope.c
+++ b/scope.c
@@ -7,12 +7,12 @@
#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
#include "objects.h"
-#include "message.h"
+#include <libisns/message.h>
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>
#include "db.h"

struct isns_scope {
diff --git a/security.c b/security.c
index 60bd8d744fb3..2cf6235f76e7 100644
--- a/security.c
+++ b/security.c
@@ -8,10 +8,10 @@
#include <string.h>
#include <time.h>
#include "config.h"
-#include "isns.h"
+#include <libisns/isns.h>
#include "security.h"
-#include "source.h"
-#include "util.h"
+#include <libisns/source.h>
+#include <libisns/util.h>

#ifdef WITH_SECURITY

diff --git a/security.h b/security.h
index 9ba0f0d55f3e..bbab3fe73631 100644
--- a/security.h
+++ b/security.h
@@ -9,7 +9,7 @@

#include <openssl/evp.h>
#include "buffer.h"
-#include "util.h"
+#include <libisns/util.h>

/*
* Security context
diff --git a/server.c b/server.c
index 930d20538b10..82b7bb9f50c7 100644
--- a/server.c
+++ b/server.c
@@ -5,10 +5,10 @@
*/

#include "config.h"
-#include "isns.h"
-#include "util.h"
+#include <libisns/isns.h>
+#include <libisns/util.h>
#include "security.h"
-#include "message.h"
+#include <libisns/message.h>

static int isns_not_supported(isns_server_t *, isns_simple_t *, isns_simple_t **);

diff --git a/simple.c b/simple.c
index 8972a0c858bc..56860fcb610c 100644
--- a/simple.c
+++ b/simple.c
@@ -8,13 +8,13 @@
#include <stdlib.h>
#include <string.h>
#include "config.h"
-#include "isns.h"
-#include "attrs.h"
-#include "message.h"
+#include <libisns/isns.h>
+#include <libisns/attrs.h>
+#include <libisns/message.h>
#include "objects.h"
#include "security.h"
#include "socket.h"
-#include "util.h"
+#include <libisns/util.h>

typedef void isns_simple_callback_fn_t(uint32_t, int status, isns_simple_t *);

diff --git a/slp.c b/slp.c
index 43075b310913..cc54680e620b 100644
--- a/slp.c
+++ b/slp.c
@@ -10,8 +10,8 @@
# include <slp.h>
#endif

-#include "isns.h"
-#include "util.h"
+#include <libisns/isns.h>
+#include <libisns/util.h>
#include "internal.h"

#define ISNS_SLP_SERVICE_NAME "iscsi:sms"
diff --git a/socket.c b/socket.c
index 883df51b8993..bd6d6b441077 100644
--- a/socket.c
+++ b/socket.c
@@ -21,10 +21,10 @@

#include "config.h"
#include "buffer.h"
-#include "isns.h"
+#include <libisns/isns.h>
#include "socket.h"
#include "security.h"
-#include "util.h"
+#include <libisns/util.h>

#define SOCK_DEBUG_VERBOSE 0

diff --git a/socket.h b/socket.h
index cc63d231d56b..a721a3b3c81f 100644
--- a/socket.h
+++ b/socket.h
@@ -7,9 +7,9 @@
#ifndef ISNS_SOCKET_H
#define ISNS_SOCKET_H

-#include "isns.h"
+#include <libisns/isns.h>
#include "buffer.h"
-#include "message.h"
+#include <libisns/message.h>

struct isns_partial_msg {
isns_message_t imp_base;
diff --git a/source.h b/source.h
deleted file mode 100644
index 59fb6628a5bd..000000000000
--- a/source.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * iSNS source attribute handling
- *
- * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
- */
-
-#ifndef ISNS_SOURCE_H
-#define ISNS_SOURCE_H
-
-#include "attrs.h"
-
-struct isns_source {
- unsigned int is_users;
- isns_attr_t * is_attr;
- unsigned int is_untrusted : 1;
-
- isns_object_t * is_node;
- unsigned int is_node_type;
-
- isns_object_t * is_entity;
-};
-
-extern int isns_source_encode(buf_t *, const isns_source_t *);
-extern int isns_source_decode(buf_t *, isns_source_t **);
-extern int isns_source_set_node(isns_source_t *, isns_db_t *);
-extern void isns_source_set_entity(isns_source_t *, isns_object_t *);
-extern isns_source_t * isns_source_dummy(void);
-
-extern char * isns_build_source_pattern(const char *);
-extern int isns_source_pattern_match(const char *, const char *);
-
-#endif /* ISNS_SOURCE_H */
diff --git a/storage-node.c b/storage-node.c
index 97e54d1ead73..85414e7291c3 100644
--- a/storage-node.c
+++ b/storage-node.c
@@ -7,9 +7,9 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
-#include "util.h"
+#include <libisns/util.h>

isns_object_t *
isns_create_storage_node(const char *name, uint32_t type,
diff --git a/sysdep-unix.c b/sysdep-unix.c
index d2a95326001a..a710b0cc02f6 100644
--- a/sysdep-unix.c
+++ b/sysdep-unix.c
@@ -8,8 +8,8 @@
#include <sys/ioctl.h>
#include <string.h>
#include <unistd.h>
-#include "isns.h"
-#include "util.h"
+#include <libisns/isns.h>
+#include <libisns/util.h>

int isns_get_nr_portals(void)
{
diff --git a/tags.c b/tags.c
index ec6d0f6d3dae..46e8f352fcd7 100644
--- a/tags.c
+++ b/tags.c
@@ -8,12 +8,12 @@
#include <stdlib.h>
#include <time.h>
#include "config.h"
-#include "isns-proto.h"
+#include <libisns/isns-proto.h>
#include "vendor.h"
-#include "attrs.h"
+#include <libisns/attrs.h>
#include "security.h"
#include "objects.h"
-#include "util.h"
+#include <libisns/util.h>

#define ISNS_MAX_BUILTIN_TAG 4096

diff --git a/tests/pauw1.c b/tests/pauw1.c
index c3e66f7fdfb4..ab4be7284613 100644
--- a/tests/pauw1.c
+++ b/tests/pauw1.c
@@ -3,10 +3,10 @@
* registering itself.
*/
#include <getopt.h>
-#include <isns.h>
-#include <paths.h>
-#include <util.h>
-#include <message.h>
+#include <libisns/isns.h>
+#include <libisns/paths.h>
+#include <libisns/util.h>
+#include <libisns/message.h>

int
main(int argc, char **argv)
diff --git a/tests/pauw2.c b/tests/pauw2.c
index 29084b304030..63015b1dbdfb 100644
--- a/tests/pauw2.c
+++ b/tests/pauw2.c
@@ -3,10 +3,10 @@
* registering itself.
*/
#include <getopt.h>
-#include <isns.h>
-#include <paths.h>
-#include <util.h>
-#include <message.h>
+#include <libisns/isns.h>
+#include <libisns/paths.h>
+#include <libisns/util.h>
+#include <libisns/message.h>

#define ADD(type, tag, value) \
isns_attr_list_append_##type(attrs, ISNS_TAG_##tag, value)
diff --git a/tests/pauw3.c b/tests/pauw3.c
index 3be0baa63f15..1989ec254e91 100644
--- a/tests/pauw3.c
+++ b/tests/pauw3.c
@@ -12,10 +12,10 @@
#include <getopt.h>
#include <unistd.h>

-#include <isns.h>
-#include <paths.h>
-#include <util.h>
-#include <message.h>
+#include <libisns/isns.h>
+#include <libisns/paths.h>
+#include <libisns/util.h>
+#include <libisns/message.h>

#define ADD(type, tag, value) \
isns_attr_list_append_##type(attrs, ISNS_TAG_##tag, value)
diff --git a/tests/pauw4.c b/tests/pauw4.c
index 9510ddd53f60..02f74b2c24b9 100644
--- a/tests/pauw4.c
+++ b/tests/pauw4.c
@@ -7,10 +7,10 @@
#include <getopt.h>
#include <unistd.h>

-#include <isns.h>
-#include <paths.h>
-#include <util.h>
-#include <message.h>
+#include <libisns/isns.h>
+#include <libisns/paths.h>
+#include <libisns/util.h>
+#include <libisns/message.h>

#define ADD(type, tag, value) \
isns_attr_list_append_##type(attrs, ISNS_TAG_##tag, value)
diff --git a/timer.c b/timer.c
index ed8a23ff23ce..2708fa0d7384 100644
--- a/timer.c
+++ b/timer.c
@@ -6,8 +6,8 @@

#include <stdlib.h>
#include <time.h>
-#include "isns.h"
-#include "util.h"
+#include <libisns/isns.h>
+#include <libisns/util.h>

typedef struct isns_timer isns_timer_t;
struct isns_timer {
diff --git a/types.h b/types.h
deleted file mode 100644
index ddd153f8401d..000000000000
--- a/types.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Open-iSNS types
- *
- * Copyright (C) 2007 Olaf Kirch <olaf....@oracle.com>
- */
-
-#ifndef ISNS_TYPES_H
-#define ISNS_TYPES_H
-
-typedef struct isns_simple isns_simple_t;
-typedef struct isns_source isns_source_t;
-typedef struct isns_object isns_object_t;
-typedef struct isns_relation isns_relation_t;
-typedef struct isns_attr isns_attr_t;
-typedef struct isns_attr_list isns_attr_list_t;
-typedef struct isns_message isns_message_t;
-typedef struct isns_socket isns_socket_t;
-typedef struct isns_db isns_db_t;
-typedef struct isns_tag_type isns_tag_type_t;
-typedef const struct isns_object_template isns_object_template_t;
-typedef struct isns_authdata isns_authdata_t;
-typedef struct isns_security isns_security_t;
-typedef struct isns_principal isns_principal_t;
-typedef struct isns_policy isns_policy_t;
-typedef struct isns_keystore isns_keystore_t;
-typedef struct isns_scope isns_scope_t;
-typedef struct isns_portal_info isns_portal_info_t;
-typedef struct isns_server isns_server_t;
-typedef struct isns_db_event isns_db_event_t;
-typedef struct isns_bitvector isns_bitvector_t;
-
-typedef struct isns_object_list {
- unsigned int iol_count;
- isns_object_t ** iol_data;
-} isns_object_list_t;
-
-#define ISNS_OBJECT_LIST_INIT { .iol_count = 0, .iol_data = NULL }
-
-/*
- * An attribute list
- */
-struct isns_attr_list {
- unsigned int ial_count;
- isns_attr_t ** ial_data;
-};
-#define ISNS_ATTR_LIST_INIT { .ial_count = 0, .ial_data = NULL }
-
-/*
- * Function types.
- */
-typedef void isns_print_fn_t(const char *, ...);
-typedef void isns_timer_callback_t(void *);
-
-
-#endif /* ISNS_TYPES_H */
-
-
diff --git a/util.c b/util.c
index 4c0a7b298d88..ae5f2bed6504 100644
--- a/util.c
+++ b/util.c
@@ -11,7 +11,7 @@
#include <string.h>
#include <err.h>
#include <errno.h>
-#include "util.h"
+#include <libisns/util.h>

unsigned long
parse_size(const char *arg)
diff --git a/util.h b/util.h
deleted file mode 100644
index bd6b979bd0b5..000000000000
--- a/util.h
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Utility functions
- *
- * Copyright (C) 2006, 2007 Olaf Kirch <olaf....@oracle.com>
- */
-
-#ifndef UTIL_H
-#define UTIL_H
-
-#include <sys/types.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <string.h> // for strdup
-#include "types.h"
-
-#define array_num_elements(a) (sizeof(a) / sizeof((a)[0]))
-
-const char * isns_dirname(const char *);
-int isns_mkdir_recursive(const char *);
-
-extern const char *parser_separators;
-char * parser_get_next_line(FILE *);
-char * parser_get_next_word(char **);
-char * parser_get_rest_of_line(char **);
-int parser_split_line(char *, unsigned int, char **);
-
-unsigned long parse_size(const char *);
-unsigned int parse_count(const char *);
-int parse_int(const char *);
-long long parse_longlong(const char *);
-double parse_double(const char *);
-unsigned int parse_timeout(const char *);
-
-char * print_size(unsigned long);
-
-/*
- * Very simple and stupid string array.
- */
-struct string_array {
- unsigned int count;
- char ** list;
-};
-
-void isns_string_array_append(struct string_array *, const char *);
-void isns_string_array_destroy(struct string_array *);
-
-void isns_assign_string(char **, const char *);
-
-void isns_write_pidfile(const char *);
-void isns_update_pidfile(const char *);
-void isns_remove_pidfile(const char *);
-
-extern void isns_log_background(void);
-extern void isns_assert_failed(const char *,
- const char *, unsigned int);
-extern void isns_fatal(const char *, ...);
-extern void isns_warning(const char *, ...);
-extern void isns_error(const char *, ...);
-extern void isns_notice(const char *, ...);
-extern void isns_debug_general(const char *, ...);
-extern void isns_debug_socket(const char *, ...);
-extern void isns_debug_protocol(const char *, ...);
-extern void isns_debug_message(const char *, ...);
-extern void isns_debug_state(const char *, ...);
-extern void isns_debug_auth(const char *, ...);
-extern void isns_debug_scn(const char *, ...);
-extern void isns_debug_esi(const char *, ...);
-extern void isns_enable_debugging(const char *);
-extern int isns_debug_enabled(int);
-
-enum {
- DBG_GENERAL = 0,
- DBG_SOCKET,
- DBG_PROTOCOL,
- DBG_MESSAGE,
- DBG_STATE,
- DBG_AUTH,
- DBG_SCN,
- DBG_ESI,
-};
-
-/*
- * There's no htonll yet
- */
-#ifndef htonll
-# include <endian.h>
-# include <byteswap.h>
-# if __BYTE_ORDER == __BIG_ENDIAN
-# define htonll(x) (x)
-# define ntohll(x) (x)
-# elif __BYTE_ORDER == __LITTLE_ENDIAN
-# define htonll(x) __bswap_64(x)
-# define ntohll(x) __bswap_64(x)
-# endif
-#endif
-
-/*
- * One of the those eternal staples of C coding:
- */
-#ifndef MIN
-# define MIN(a, b) ((a) < (b)? (a) : (b))
-# define MAX(a, b) ((a) > (b)? (a) : (b))
-#endif
-
-#define DECLARE_BITMAP(name, NBITS) \
- uint32_t name[(NBITS+31) >> 5] = { 0 }
-
-#define __BIT_INDEX(nr) (nr >> 5)
-#define __BIT_MASK(nr) (1 << (nr & 31))
-
-static inline void
-set_bit(uint32_t *map, unsigned int nr)
-{
- map[__BIT_INDEX(nr)] |= __BIT_MASK(nr);
-}
-
-static inline void
-clear_bit(uint32_t *map, unsigned int nr)
-{
- map[__BIT_INDEX(nr)] &= ~__BIT_MASK(nr);
-}
-
-static inline int
-test_bit(const uint32_t *map, unsigned int nr)
-{
- return !!(map[__BIT_INDEX(nr)] & __BIT_MASK(nr));
-}
-
-/*
- * Dynamically sized bit vector
- */
-extern isns_bitvector_t *isns_bitvector_alloc(void);
-extern void isns_bitvector_init(isns_bitvector_t *);
-extern void isns_bitvector_destroy(isns_bitvector_t *);
-extern void isns_bitvector_free(isns_bitvector_t *);
-extern int isns_bitvector_test_bit(const isns_bitvector_t *, unsigned int);
-extern int isns_bitvector_set_bit(isns_bitvector_t *, unsigned int);
-extern int isns_bitvector_clear_bit(isns_bitvector_t *, unsigned int);
-extern int isns_bitvector_is_empty(const isns_bitvector_t *);
-extern int isns_bitvector_intersect(const isns_bitvector_t *a,
- const isns_bitvector_t *b,
- isns_bitvector_t *result);
-extern void isns_bitvector_print(const isns_bitvector_t *,
- isns_print_fn_t *);
-extern void isns_bitvector_foreach(const isns_bitvector_t *bv,
- int (*cb)(uint32_t, void *),
- void *user_data);
-
-/*
- * List manipulation primites
- */
-typedef struct isns_list isns_list_t;
-struct isns_list {
- isns_list_t * next;
- isns_list_t * prev;
-};
-
-#define ISNS_LIST_DECLARE(list) \
- isns_list_t list = { &list, &list }
-
-static inline void
-isns_list_init(isns_list_t *head)
-{
- head->next = head->prev = head;
-}
-
-static inline void
-__isns_list_insert(isns_list_t *prev, isns_list_t *item, isns_list_t *next)
-{
- item->next = next;
- item->prev = prev;
- next->prev = item;
- prev->next = item;
-}
-
-static inline void
-isns_list_append(isns_list_t *head, isns_list_t *item)
-{
- __isns_list_insert(head->prev, item, head);
-}
-
-static inline void
-isns_list_insert(isns_list_t *head, isns_list_t *item)
-{
- __isns_list_insert(head, item, head->next);
-}
-
-static inline void
-isns_item_insert_before(isns_list_t *where, isns_list_t *item)
-{
- __isns_list_insert(where->prev, item, where);
-}
-
-static inline void
-isns_item_insert_after(isns_list_t *where, isns_list_t *item)
-{
- __isns_list_insert(where, item, where->next);
-}
-
-static inline void
-isns_list_del(isns_list_t *item)
-{
- isns_list_t *prev = item->prev;
- isns_list_t *next = item->next;
-
- prev->next = next;
- next->prev = prev;
- item->next = item->prev = item;
-}
-
-static inline int
-isns_list_empty(const isns_list_t *head)
-{
- return head == head->next;
-}
-
-static inline void
-isns_list_move(isns_list_t *dst, isns_list_t *src)
-{
- isns_list_t *prev, *next;
- isns_list_t *head, *tail;
-
- if (isns_list_empty(src))
- return;
-
- prev = dst->prev;
- next = dst;
-
- head = src->next;
- tail = src->prev;
-
- next->prev = tail;
- prev->next = head;
- head->prev = prev;
- tail->next = next;
-
- src->next = src->prev = src;
-}
-
-#define isns_list_item(type, member, ptr) \
- container_of(type, member, ptr)
-
-#define isns_list_foreach(list, __pos, __next) \
- for (__pos = (list)->next; \
- (__pos != list) && (__next = __pos->next, 1); \
- __pos = __next)
-
-#if 0
-/* This is defined in stddef */
-#define offsetof(type, member) ((unsigned long) &(((type *) 0)->member))
-#endif
-#define container_of(type, member, ptr) \
- ((type *) (((unsigned char *) ptr) - offsetof(type, member)))
-
-/*
- * Use isns_assert instead of libc's assert, so that the
- * message can be captured and sent to syslog.
- */
-#define isns_assert(condition) do { \
- if (!(condition)) \
- isns_assert_failed(#condition, \
- __FILE__, __LINE__); \
-} while (0)
-
-#ifndef MDEBUG
-# define isns_malloc(size) malloc(size)
-# define isns_calloc(n, size) calloc(n, size)
-# define isns_realloc(p, size) realloc(p, size)
-# define isns_strdup(s) strdup(s)
-# define isns_free(p) free(p)
-#else
-# define isns_malloc(size) isns_malloc_fn(size, __FILE__, __LINE__)
-# define isns_calloc(n, size) isns_calloc_fn(n, size, __FILE__, __LINE__)
-# define isns_realloc(p, size) isns_realloc_fn(p, size, __FILE__, __LINE__)
-# define isns_strdup(s) isns_strdup_fn(s, __FILE__, __LINE__)
-# define isns_free(p) isns_free_fn(p, __FILE__, __LINE__)
-
-extern void * (*isns_malloc_fn)(size_t, const char *, unsigned int);
-extern void * (*isns_calloc_fn)(unsigned int, size_t,
- const char *, unsigned int);
-extern void * (*isns_realloc_fn)(void *, size_t,
- const char *, unsigned int);
-extern char * (*isns_strdup_fn)(const char *, const char *, unsigned int);
-extern void (*isns_free_fn)(void *, const char *, unsigned int);
-#endif
-
-#endif /* UTIL_H */
diff --git a/vendor.c b/vendor.c
index e24164d5d049..82cdac36cd10 100644
--- a/vendor.c
+++ b/vendor.c
@@ -6,11 +6,11 @@

#include <stdlib.h>
#include <string.h>
-#include "isns.h"
+#include <libisns/isns.h>
#include "objects.h"
-#include "attrs.h"
+#include <libisns/attrs.h>
#include "vendor.h"
-#include "util.h"
+#include <libisns/util.h>

static uint32_t policy_attrs[] = {
OPENISNS_TAG_POLICY_SPI,
diff --git a/vendor.h b/vendor.h
index 49c61321368d..fb456ec5c11c 100644
--- a/vendor.h
+++ b/vendor.h
@@ -7,7 +7,7 @@
#ifndef ISNS_VENDOR_H
#define ISNS_VENDOR_H

-#include "isns-proto.h"
+#include <libisns/isns-proto.h>

/*
* We're poor, we don't own a OUI. Let's fake one.
--
2.1.4

The Lee-Man

unread,
Jul 13, 2015, 9:04:48 PM7/13/15
to open-...@googlegroups.com, ldu...@suse.com
If there are no objections I will commit these changes. Then I'll submit a set of patches for open-iscsi to use this package instead of it's internal copy of it.

Sound good Mike?

Mike Christie

unread,
Jul 14, 2015, 12:58:51 PM7/14/15
to open-...@googlegroups.com, ldu...@suse.com
On 07/13/2015 08:04 PM, The Lee-Man wrote:
> If there are no objections I will commit these changes. Then I'll submit
> a set of patches for open-iscsi to use this package instead of it's
> internal copy of it.
>
> Sound good Mike?
>

Thanks for taking on open-isns! Yes, sounds good to me.


> On Monday, July 13, 2015 at 2:57:45 PM UTC-7, The Lee-Man wrote:
>
> --
> You received this message because you are subscribed to the Google
> Groups "open-iscsi" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to open-iscsi+...@googlegroups.com
> <mailto:open-iscsi+...@googlegroups.com>.
> To post to this group, send email to open-...@googlegroups.com
> <mailto:open-...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/open-iscsi.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages