dbnews_h

/*
**	Copyright 1993-2016, Fermi Research Alliance, LLC.  All rights reserved.
*/
/******************************************************************************/
/* dbnews.h
**  
**	prototypes and defined constants for argument values for
**	DBNEWS service
**
*/
/******************************************************************************/

#ifndef DBNEWSH_DEFINED				/* do this only once */
#define	DBNEWSH_DEFINED

#include "acnet.h"
#include "netapi.h"

/*
**  flags bit constants
*/
#define	DBNEWS_FLAG_NEW_DEVICE		1	/* new device created */
#define	DBNEWS_FLAG_NEW_PROPERTY	2	/* new property added */
#define	DBNEWS_FLAG_READ_SCALING_MOD	4	/* reading scaling modified */
#define	DBNEWS_FLAG_SET_SCALING_MOD	8	/* setting scaling modified */
#define	DBNEWS_FLAG_READ_SET_SCALING_MOD	0xC	/* reading or setting scaling modified */
#define	DBNEWS_FLAG_READ_ENUMVAL_MOD	0x10	/* reading enumerated value information modified */
#define	DBNEWS_FLAG_SET_ENUMVAL_MOD	0x20	/* setting enumerated value information modified */
#define	DBNEWS_FLAG_ENUMVAL_MOD		0x30	/* enumerated value information modified */
#define	DBNEWS_FLAG_STATUS_SCALING_MOD	0x40	/* status scaling modified */
#define	DBNEWS_FLAG_SCALING_MOD		0x4C	/* scaling modified */
#define	DBNEWS_FLAG_FOREIGN_DEVICE_MOD	0x80	/* foreign device mapping information modified */
#define DBNEWS_FLAG_READ_STRUC_MOD	0x100	/* reading structure name modified */
#define DBNEWS_FLAG_SET_STRUC_MOD	0x200	/* setting structure name modified */
#define DBNEWS_FLAG_STRUC_MOD		0x300	/* structure name modified */
#define DBNEWS_FLAG_EXPRESSION_MOD	0x400	/* device expression modified */
#define DBNEWS_FLAG_DEVICE_RENAMED	0x800	/* device was renamed */
#define DBNEWS_FLAG_OBSOLETE_DEVICE	0x1000	/* device was obsoleted */
#define DBNEWS_FLAG_UNOBSOLETE_DEVICE	0x2000	/* device was unobsoleted */
#define DBNEWS_FLAG_DOC_DEVICE		0x4000	/* device was documented */
#define DBNEWS_FLAG_UNDOC_DEVICE	0x8000	/* device was undocumented */

#define	DBNEWS_NUM_DEFINED_FLAGS	11	/* number of defined DBNEWS operation flags */

#define DBNEWS_ALL_DEVICES		(-1)	/* include all devices */

#define DBNEWS_ALL_MODIFICATION_TYPES	(DATA_EVENT_DBNEWS_ANY_MOD_TYPE)	/* include all modification types */

typedef struct DBNEWS_REPORT_DATA
    {
    unsigned int	seconds;
    unsigned int	nanoseconds;
    unsigned long long	property_mask;		/* property mask: see dbprops.h (bit set means property was added/modified/deleted) */
    unsigned long long	edit_mask;		/* edit mask: see dbprops.h (bit set means property was added/modified) (bit clear means property was deleted) */
    unsigned long long	modification_flags;	/* modification type flags (DBNEWS_FLAG_xxx) */
    int			modify_node;		/* node where modification was made */
    int			console_user_id;	/* console user ID of Dabbel user */
    char		display_name[DBNEWS_DISPLAY_NAME_LEN+2];	/* display name where modification was made */
    } __attribute__((packed)) DBNEWS_REPORT_DATA;

typedef void (*dbnews_handler)(int device_index,
			       DBNEWS_REPORT_DATA *dbnews_data,
			       void *user_data);	/* DBNEWS callback */

int dbnews_callback_init_c(int num_devices, int *device_indices, 
			   dbnews_handler callback_func,
			   void *callback_data=(void *) NULL,
			   unsigned long long modify_flags=DBNEWS_ALL_MODIFICATION_TYPES);
int dbnews_callback_term_c(int num_devices, int *device_indices,
			   dbnews_handler callback_func,
			   void *callback_data=(void *) NULL,
			   unsigned long long modify_flags=DBNEWS_ALL_MODIFICATION_TYPES);

#endif