This file is indexed.

/usr/include/libisns/attrs.h is in libisns-dev 0.97-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/*
 * iSNS object attributes
 *
 * Copyright (C) 2007 Olaf Kirch <olaf.kirch@oracle.com>
 */

#ifndef ISNS_ATTRS_H
#define ISNS_ATTRS_H

#include <netinet/in.h>
#include <libisns/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 */