|
root / base / usr / src / cmd / isns / isnsd / isns_esi.h
isns_esi.h C 105 lines 2.4 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_ISNS_ESI_H
#define	_ISNS_ESI_H

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
	EV_ESI = 1,
	EV_REG_EXP
} ev_type_t;

#define	EV_FLAG_INIT	(0x01)
#define	EV_FLAG_AGAIN	(0x02)
#define	EV_FLAG_WAKEUP	(0x04)
#define	EV_FLAG_REMOVE	(0x08)
#define	EV_FLAG_REM_P1	(0x10)
#define	EV_FLAG_REM_P2	(0x20)
#define	EV_FLAG_REM_P3	(0x40)
#define	EV_FLAG_REM_P4	(0x80)

#define	EV_FLAG_REM_P	(0xF0)

typedef struct esi_portal {
	int sz;
	in_addr_t ip4;
	in6_addr_t *ip6;
	uint32_t port;
	uint32_t esip;
	uint32_t ref;
	int so;
	struct esi_portal *next;
} esi_portal_t;

typedef struct ev {
	ev_type_t type;
	uint32_t uid;
	uint32_t intval;
	int flags;
	uchar_t *eid;
	uint32_t eid_len;
	esi_portal_t *portal;
	pthread_mutex_t mtx;
	struct ev *next;
} ev_t;

/* function prototypes */
int esi_load(uint32_t, uchar_t *, uint32_t);
int esi_add(uint32_t, uchar_t *, uint32_t);
int esi_remove(uint32_t);
int esi_remove_obj(const isns_obj_t *, int);
int verify_esi_portal();
uint32_t get_stopwatch(int);
uint32_t ev_intval(void *);
int ev_match(void *, uint32_t);
int ev_remove(void *, uint32_t, int, int);
void ev_free(void *);
int evf_init(void *);
int evf_again(void *);
int evf_wakeup(void *);
int evf_rem(void *);
int evf_rem_pending(void *);
void evf_zero(void *);

void evl_append(void *);
void evl_strip(void *);
int evl_remove(uint32_t, uint32_t, int);

void *esi_proc(void *);

void portal_dies(uint32_t);
void reg_expiring(void *);

#ifdef __cplusplus
}
#endif

#endif /* _ISNS_ESI_H */