isns_server.h revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _ISNS_SERVER_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _ISNS_SERVER_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <assert.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/param.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <isns_protocol.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ASSERT(EXP) assert(EXP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ASSERT(EXP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISNS_RSP_MASK (0x8000)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * definitions for SMF.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISNS_SERVER_SVC_NAME "network/isns_server"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISNS_SERVER_CONFIG "config"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define CONFIG_DATA_STORE "data_store_location"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define CONFIG_ESI_THRESHOLD "ESI_retry_threshold_count"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define CONFIG_MGMT_SCN "Management_SCN_Enabled"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define CONFIG_CONTROL_NODES "Authorized_Control_Nodes"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DEBUG
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPT_DAEMONLIZE "daemonlize"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISNS_DAEMON_SYSLOG_PP "isns"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FIRST_TAG_ENTITY ISNS_EID_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FIRST_TAG_ISCSI ISNS_ISCSI_NAME_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FIRST_TAG_PORTAL ISNS_PORTAL_IP_ADDR_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FIRST_TAG_PG ISNS_PG_ISCSI_NAME_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FIRST_TAG_DD ISNS_DD_ID_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FIRST_TAG_DDS ISNS_DD_SET_ID_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FIRST_TAG_ASSOC_ISCSI ISNS_DD_ISCSI_INDEX_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define FIRST_TAG_ASSOC_DD ISNS_DD_ID_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LAST_TAG_ENTITY ISNS_ENTITY_INDEX_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LAST_TAG_ISCSI ISNS_ISCSI_AUTH_METHOD_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LAST_TAG_PORTAL ISNS_SCN_PORT_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LAST_TAG_PG ISNS_PG_INDEX_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LAST_TAG_DD ISNS_DD_FEATURES_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LAST_TAG_DDS ISNS_DD_SET_STATUS_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LAST_TAG_ASSOC_ISCSI ISNS_DD_ISCSI_NAME_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LAST_TAG_ASSOC_DD ISNS_DD_ID_ATTR_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_OF_ENTITY_ATTRS \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LAST_TAG_ENTITY - FIRST_TAG_ENTITY + 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_OF_ISCSI_ATTRS \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LAST_TAG_ISCSI - FIRST_TAG_ISCSI + 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_OF_PORTAL_ATTRS \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LAST_TAG_PORTAL - FIRST_TAG_PORTAL + 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_OF_PG_ATTRS \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LAST_TAG_PG - FIRST_TAG_PG + 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_OF_DD_ATTRS \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LAST_TAG_DD - FIRST_TAG_DD + 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_OF_DDS_ATTRS \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LAST_TAG_DDS - FIRST_TAG_DDS + 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_OF_ASSOC_ISCSI_ATTRS \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LAST_TAG_ASSOC_ISCSI - FIRST_TAG_ASSOC_ISCSI + 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NUM_OF_ASSOC_DD_ATTRS \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LAST_TAG_ASSOC_DD - FIRST_TAG_ASSOC_DD + 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX_ENTITY(TAG) ((TAG) - FIRST_TAG_ENTITY)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX_ISCSI(TAG) ((TAG) - FIRST_TAG_ISCSI)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX_PORTAL(TAG) ((TAG) - FIRST_TAG_PORTAL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX_PG(TAG) ((TAG) - FIRST_TAG_PG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX_DD(TAG) ((TAG) - FIRST_TAG_DD)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX_DDS(TAG) ((TAG) - FIRST_TAG_DDS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX_ASSOC_ISCSI(TAG) ((TAG) - FIRST_TAG_ASSOC_ISCSI)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX_ASSOC_DD(TAG) ((TAG) - FIRST_TAG_ASSOC_DD)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATTR_INDEX(TAG, TYPE) ((TAG) - TAG_RANGE[TYPE][0])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_ATTR(ISCSI, TAG) ((ISCSI)->attrs[ATTR_INDEX_ISCSI(TAG)].value)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * isns object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum isns_otype {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iSNS objects as they are defined in RFC 4171.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_ENTITY = 0x1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_ISCSI,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_PORTAL,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_PG,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_DD,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_DDS,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MAX_OBJ_TYPE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dummy object types for future extension.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_DUMMY1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_DUMMY2,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_DUMMY3,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_DUMMY4,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * madeup object for internal implementation.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_ASSOC_ISCSI,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OBJ_ASSOC_DD,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MAX_OBJ_TYPE_FOR_SIZE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_type_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_LOOKUP_CTRL (3)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lookup operation.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OP_STRING = 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OP_INTEGER,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OP_MEMORY_IP6
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} lookup_method_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct lookup_ctrl {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t curr_uid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint16_t id[MAX_LOOKUP_CTRL];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t op[MAX_LOOKUP_CTRL];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte union {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t *ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t ui;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte in6_addr_t *ip;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } data[MAX_LOOKUP_CTRL];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} lookup_ctrl_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SET_UID_LCP(LCP, TYPE, UID) {\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->type = TYPE;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->curr_uid = 0;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->id[0] = UID_ATTR_INDEX[TYPE];\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->op[0] = OP_INTEGER;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->data[0].ui = UID;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->op[1] = 0;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define UPDATE_LCP_UID(LCP, UID) {\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->curr_uid = 0;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->id[0] = UID_ATTR_INDEX[(LCP)->type];\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->op[0] = OP_INTEGER;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->data[0].ui = UID;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (LCP)->op[1] = 0;\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * isns object attribute
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_attr {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t tag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte union {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t ui;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte in6_addr_t *ip;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t *ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_t timestamp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } value;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_attr_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_KEY_ATTRS (3)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * isns generic object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_obj {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_obj_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_PARENT_TYPE (OBJ_ENTITY)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PORTAL_PARENT_TYPE (OBJ_ENTITY)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PG_PARENT_TYPE (OBJ_ENTITY)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ASSOC_ISCSI_PARENT_TYPE (OBJ_DD)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ASSOC_DD_PARENT_TYPE (OBJ_DDS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iSNS objects.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_dds {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[NUM_OF_DDS_ATTRS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_dds_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_assoc_dd {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[NUM_OF_ASSOC_DD_ATTRS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parent object uid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef ASSOC_DD_PARENT_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t puid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_assoc_dd_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DDS_ENABLED(UI) ((UI) & (ISNS_DDS_STATUS))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ENABLE_DDS(DDS) (((DDS)->status) |= (ISNS_DDS_STATUS))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DISABLE_DDS(DDS) (((DDS)->status) &= ~(ISNS_DDS_STATUS))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DD_BOOTLIST_ENABLED(UI) ((UI) & (ISNS_DD_BOOTLIST))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_dd {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[NUM_OF_DD_ATTRS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_dd_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_assoc_iscsi {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[NUM_OF_ASSOC_ISCSI_ATTRS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parent object uid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef ASSOC_ISCSI_PARENT_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t puid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_assoc_iscsi_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_ISCSI_CHILD (0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_PORTAL_CHILD (0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_PG_CHILD (0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_ENTITY_CHILD (2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_CHILD_TYPE (2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PG_REF_COUNT (2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_REF_COUNT (2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_iscsi {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[NUM_OF_ISCSI_ATTRS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parent object uid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef ISCSI_PARENT_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t puid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* subordinate object uid(s) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(MAX_ISCSI_CHILD) && (MAX_ISCSI_CHILD > 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *cuid[MAX_ISCSI_CHILD];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_iscsi_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_ISCSI_TARGET(NODE) (((NODE)->type) & ISNS_TARGET_NODE_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_ISCSI_INITIATOR(NODE) (((NODE)->type) & ISNS_INITIATOR_NODE_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_ISCSI_CONTROL(NODE) (((NODE)->type) & ISNS_CONTROL_NODE_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_TYPE_TARGET(TYPE) ((TYPE) & ISNS_TARGET_NODE_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_TYPE_INITIATOR(TYPE) ((TYPE) & ISNS_INITIATOR_NODE_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_TYPE_CONTROL(TYPE) ((TYPE) & ISNS_CONTROL_NODE_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_TYPE_UNKNOWN(TYPE) (!IS_TYPE_TARGET(TYPE) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !IS_TYPE_INITIATOR(TYPE) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !IS_TYPE_CONTROL(TYPE))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_INIT_SELF_INFO_ONLY(UI) ((UI) & ISNS_INIT_SELF_INFO_ONLY)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_TARGET_SELF_INFO_ONLY(UI) ((UI) & ISNS_TARGET_SELF_INFO_ONLY)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_MGMT_REG(UI) ((UI) & ISNS_MGMT_REG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_OBJ_REMOVED(UI) ((UI) & ISNS_OBJECT_REMOVED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_OBJ_ADDED(UI) ((UI) & ISNS_OBJECT_ADDED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_OBJ_UPDATED(UI) ((UI) & ISNS_OBJECT_UPDATED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_MEMBER_REMOVED(UI) ((UI) & ISNS_MEMBER_REMOVED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_MEMBER_ADDED(UI) ((UI) & ISNS_MEMBER_ADDED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_portal {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[NUM_OF_PORTAL_ATTRS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parent object uid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef PORTAL_PARENT_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t puid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* subordinate object uid(s) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(MAX_PORTAL_CHILD) && (MAX_PORTAL_CHILD > 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *cuid[MAX_PORTAL_CHILD];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_portal_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PORTAL_PORT(UI) ((UI) & ISNS_PORT_BITS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ESI_PORT(UI) ((UI) & ISNS_PORT_BITS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_ESI_UDP(UI) ((UI) & ISNS_PORT_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SCN_PORT(UI) ((UI) & ISNS_PORT_BITS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_SCN_UDP(UI) ((UI) & ISNS_PORT_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PORT_NUMBER(UI) ((UI) & ISNS_PORT_BITS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IS_PORT_UDP(UI) ((UI) & ISNS_PORT_TYPE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_pg {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[NUM_OF_PG_ATTRS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parent object uid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef PG_PARENT_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t puid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* subordinate object uid(s) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(MAX_PG_CHILD) && (MAX_PG_CHILD > 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *cuid[MAX_PG_CHILD];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ref count */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(PG_REF_COUNT) && (PG_REF_COUNT > 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t ref[PG_REF_COUNT];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_pg_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PG_TAG(PGT) (((PGT)->tag) & ISNS_PG_TAG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct isns_entity {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_type_t type;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t attrs[NUM_OF_ENTITY_ATTRS];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parent object uid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef ENTITY_PARENT_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t puid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* subordinate object uid(s) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(MAX_ENTITY_CHILD) && (MAX_ENTITY_CHILD > 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *cuid[MAX_ENTITY_CHILD];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} isns_entity_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PROTOCOL_MAX_VER(ENTITY) ((((ENTITY)->versions) >> \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ISNS_VER_SHIFT) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ISNS_VERSION)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PROTOCOL_MIN_VER(ENTITY) (((ENTITY)->versions) & ISNS_VERSION)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DEFAULT_EID_LEN 20
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DEFAULT_EID_PATTERN "isns: %.6d"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DEFAULT_DD_NAME "Default"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DEFAULT_DD_SET_NAME "Default"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DEFAULT_DD_FEATURES 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DEFAULT_DD_SET_STATUS 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MIN_ESI_INTVAL (20) /* 20 seconds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DEFAULT_ESI_INTVAL (3 * 60) /* 3 mintues */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ONE_DAY (86400)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define INFINITY (4294967295UL) /* >136 years, max # of uint32_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * function prototype.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteisns_port_watcher(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuint16_t get_server_xid(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid inc_thr_count(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid dec_thr_count(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid shutdown_server(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _ISNS_SERVER_H */