⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omapip.h

📁 dhcp-3.1.0.tar.gz。DHCP源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* omapip.h   Definitions for the object management API and protocol... *//* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * *   Internet Systems Consortium, Inc. *   950 Charter Street *   Redwood City, CA 94063 *   <info@isc.org> *   http://www.isc.org/ * * This software has been written for Internet Systems Consortium * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. * To learn more about Internet Systems Consortium, see * ``http://www.isc.org/''.  To learn more about Vixie Enterprises, * see ``http://www.vix.com''.   To learn more about Nominum, Inc., see * ``http://www.nominum.com''. */#ifndef _OMAPIP_H_#define _OMAPIP_H_#include <isc-dhcp/result.h>typedef unsigned int omapi_handle_t;struct __omapi_object;typedef struct __omapi_object omapi_object_t;typedef enum {	omapi_datatype_int,	omapi_datatype_string,	omapi_datatype_data,	omapi_datatype_object} omapi_datatype_t;typedef struct {	int refcnt;	omapi_datatype_t type;	union {		struct {			unsigned len;#define OMAPI_TYPED_DATA_NOBUFFER_LEN (sizeof (int) + \				       sizeof (omapi_datatype_t) + \				       sizeof (int))			unsigned char value [1];		} buffer;#define OMAPI_TYPED_DATA_OBJECT_LEN (sizeof (int) + \				     sizeof (omapi_datatype_t) + \				     sizeof (omapi_object_t *))		omapi_object_t *object;#define OMAPI_TYPED_DATA_REF_LEN (sizeof (int) + \				  sizeof (omapi_datatype_t) + \				  3 * sizeof (void *))		struct {			void *ptr;			isc_result_t (*reference) (void *,						   void *, const char *, int);			isc_result_t (*dereference) (void *,						     const char *, int);		} ref;#define OMAPI_TYPED_DATA_INT_LEN (sizeof (int) + \				  sizeof (omapi_datatype_t) + \				  sizeof (int))		int integer;	} u;} omapi_typed_data_t;typedef struct {	int refcnt;	unsigned len;#define OMAPI_DATA_STRING_EMPTY_SIZE (2 * sizeof (int))	unsigned char value [1];} omapi_data_string_t;typedef struct {	int refcnt;	omapi_data_string_t *name;	omapi_typed_data_t *value;} omapi_value_t;typedef struct __omapi_object_type_t {	const char *name;	struct __omapi_object_type_t *next;		isc_result_t (*set_value) (omapi_object_t *, omapi_object_t *,				   omapi_data_string_t *,				   omapi_typed_data_t *);	isc_result_t (*get_value) (omapi_object_t *,				   omapi_object_t *,				   omapi_data_string_t *, omapi_value_t **);	isc_result_t (*destroy) (omapi_object_t *, const char *, int);	isc_result_t (*signal_handler) (omapi_object_t *,					const char *, va_list);	isc_result_t (*stuff_values) (omapi_object_t *,				      omapi_object_t *, omapi_object_t *);	isc_result_t (*lookup) (omapi_object_t **, omapi_object_t *,				omapi_object_t *);	isc_result_t (*create) (omapi_object_t **, omapi_object_t *);	isc_result_t (*remove) (omapi_object_t *, omapi_object_t *);	isc_result_t (*freer) (omapi_object_t *, const char *, int);	isc_result_t (*allocator) (omapi_object_t **, const char *, int);	isc_result_t (*sizer) (size_t);	size_t size;	int rc_flag;	isc_result_t (*initialize) (omapi_object_t *, const char *, int);} omapi_object_type_t;#define OMAPI_OBJECT_PREAMBLE \	omapi_object_type_t *type; \	int refcnt; \	omapi_handle_t handle; \	omapi_object_t *outer, *inner/* The omapi handle structure. */struct __omapi_object {	OMAPI_OBJECT_PREAMBLE;};/* The port on which applications should listen for OMAPI connections. */#define OMAPI_PROTOCOL_PORT	7911typedef struct {	unsigned addrtype;	unsigned addrlen;	unsigned char address [16];	unsigned port;} omapi_addr_t;typedef struct {	int refcnt;	unsigned count;	omapi_addr_t *addresses;} omapi_addr_list_t;typedef struct auth_key {	OMAPI_OBJECT_PREAMBLE;	char *name;	char *algorithm;	omapi_data_string_t *key;} omapi_auth_key_t;#define OMAPI_CREATE          1#define OMAPI_UPDATE          2#define OMAPI_EXCL            4#define OMAPI_NOTIFY_PROTOCOL 8#define OMAPI_OBJECT_ALLOC(name, stype, type) \isc_result_t name##_allocate (stype **p, const char *file, int line)	      \{									      \	return omapi_object_allocate ((omapi_object_t **)p,		      \				      type, 0, file, line);		      \}									      \									      \isc_result_t name##_reference (stype **pptr, stype *ptr,		      \			       const char *file, int line)		      \{									      \	return omapi_object_reference ((omapi_object_t **)pptr,		      \				       (omapi_object_t *)ptr, file, line);    \}									      \									      \isc_result_t name##_dereference (stype **ptr, const char *file, int line)     \{									      \	return omapi_object_dereference ((omapi_object_t **)ptr, file, line); \}#define OMAPI_OBJECT_ALLOC_DECL(name, stype, type) \isc_result_t name##_allocate (stype **p, const char *file, int line); \isc_result_t name##_reference (stype **pptr, stype *ptr, \			       const char *file, int line); \isc_result_t name##_dereference (stype **ptr, const char *file, int line);typedef isc_result_t (*omapi_array_ref_t) (char **, char *, const char *, int);typedef isc_result_t (*omapi_array_deref_t) (char **, const char *, int);/* An extensible array type. */typedef struct {	char **data;	omapi_array_ref_t ref;	omapi_array_deref_t deref;	int count;	int max;} omapi_array_t;#define OMAPI_ARRAY_TYPE(name, stype)					      \isc_result_t name##_array_allocate (omapi_array_t **p,			      \				    const char *file, int line)		      \{									      \	return (omapi_array_allocate					      \		(p,							      \		 (omapi_array_ref_t)name##_reference,			      \		 (omapi_array_deref_t)name##_dereference,		      \		 file, line));						      \}									      \									      \isc_result_t name##_array_free (omapi_array_t **p,			      \				const char *file, int line)		      \{									      \	return omapi_array_free (p, file, line);			      \}									      \									      \isc_result_t name##_array_extend (omapi_array_t *pptr, stype *ptr, int *index,\				  const char *file, int line)		      \{									      \	return omapi_array_extend (pptr, (char *)ptr, index, file, line);     \}									      \									      \isc_result_t name##_array_set (omapi_array_t *pptr, stype *ptr,	int index,    \			       const char *file, int line)		      \{									      \	return omapi_array_set (pptr, (char *)ptr, index, file, line);	      \}									      \									      \isc_result_t name##_array_lookup (stype **ptr, omapi_array_t *pptr,	      \				  int index, const char *file, int line)      \{									      \	return omapi_array_lookup ((char **)ptr, pptr, index, file, line);    \}#define OMAPI_ARRAY_TYPE_DECL(name, stype) \isc_result_t name##_array_allocate (omapi_array_t **, const char *, int);     \isc_result_t name##_array_free (omapi_array_t **, const char *, int);	      \isc_result_t name##_array_extend (omapi_array_t *, stype *, int *,	      \				  const char *, int);			      \isc_result_t name##_array_set (omapi_array_t *,				      \			       stype *, int, const char *, int);	      \isc_result_t name##_array_lookup (stype **,				      \				  omapi_array_t *, int, const char *, int)#define	omapi_array_foreach_begin(array, stype, var)			      \	{								      \		int omapi_array_foreach_index;				      \		stype *var = (stype *)0;				      \		for (omapi_array_foreach_index = 0;			      \			     array &&					      \			     omapi_array_foreach_index < (array) -> count;    \		     omapi_array_foreach_index++) {			      \			if ((array) -> data [omapi_array_foreach_index]) {    \				((*(array) -> ref)			      \				 ((char **)&var,			      \				  (array) -> data [omapi_array_foreach_index],\				  MDL));#define	omapi_array_foreach_end(array, stype, var)			      \				(*(array) -> deref) ((char **)&var, MDL);     \			}						      \		}							      \	}isc_result_t omapi_protocol_connect (omapi_object_t *,				     const char *, unsigned, omapi_object_t *);isc_result_t omapi_connect_list (omapi_object_t *, omapi_addr_list_t *,				 omapi_addr_t *);isc_result_t omapi_protocol_listen (omapi_object_t *, unsigned, int);isc_boolean_t omapi_protocol_authenticated (omapi_object_t *);isc_result_t omapi_protocol_configure_security (omapi_object_t *,						isc_result_t (*)						(omapi_object_t *,						 omapi_addr_t *),						isc_result_t (*)						(omapi_object_t *,						 omapi_auth_key_t *));isc_result_t omapi_protocol_accept (omapi_object_t *);isc_result_t omapi_protocol_send_intro (omapi_object_t *, unsigned, unsigned);isc_result_t omapi_protocol_ready (omapi_object_t *);isc_result_t omapi_protocol_add_auth (omapi_object_t *, omapi_object_t *,				      omapi_handle_t);isc_result_t omapi_protocol_lookup_auth (omapi_object_t **, omapi_object_t *,					 omapi_handle_t);isc_result_t omapi_protocol_set_value (omapi_object_t *, omapi_object_t *,				       omapi_data_string_t *,				       omapi_typed_data_t *);isc_result_t omapi_protocol_get_value (omapi_object_t *, omapi_object_t *,				       omapi_data_string_t *,				       omapi_value_t **); isc_result_t omapi_protocol_stuff_values (omapi_object_t *,					  omapi_object_t *,					  omapi_object_t *);isc_result_t omapi_protocol_destroy (omapi_object_t *, const char *, int);isc_result_t omapi_protocol_send_message (omapi_object_t *,					  omapi_object_t *,					  omapi_object_t *,					  omapi_object_t *);isc_result_t omapi_protocol_signal_handler (omapi_object_t *,					    const char *, va_list);isc_result_t omapi_protocol_listener_set_value (omapi_object_t *,						omapi_object_t *,						omapi_data_string_t *,						omapi_typed_data_t *);isc_result_t omapi_protocol_listener_get_value (omapi_object_t *,						omapi_object_t *,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -