/*
 ******************************************************************************
 *  Copyright 1984-1995 United States Data Corporation. All Rights Reserved.
 ******************************************************************************
 *                                - NOTICE -
 *
 *  The information contained herein is confidential information of United
 *  States Data Corporation, a Delaware corporation, and is protected by
 *  United States copyright and trade secret law and international treaties.
 *  This information is not to be disclosed, used or copied by or transferred
 *  to any individual, corporation, company or other person without the
 *  express written permission of United States Data Corporation.
 ******************************************************************************
 *
 * Module:  OBJCT.H
 *
 *	Header file for FactoryLink Object CT API.  These functions
 *	manage the extraction of tag definition records from the object CT.
 *
 * History:
 *
 *	tmw ??/??/92	Created.
 *	bjc 03/25/95	Abstracted, polished for official FLIB inclusion. 
 */

#ifndef _FLOBJCT_INCLUDED
#define _FLOBJCT_INCLUDED

/*
 ************************************************************************
 *                            Constants                                 *       
 ************************************************************************
 */

#define FLOBJCT_MAGIC     0x8888   /* Handle integrity value */

/*
 ************************************************************************
 *                        Structures and Types                          *
 ************************************************************************
 */

typedef	struct _flobjrec
{
	char  tagname[MAX_TAG_NAME+1];
	char  tagdomain[MAX_USR_NAME+1];
	char  tagtype[MAX_TYPE_NAME+1];
	char  tagdescr[MAX_PROC_DESC+1];
	char  tagdimen[MAX_DIM_LENGTH+1];
	char  tagflags[MAX_TFLAGS_LENGTH+1];
	u16   tagperwhen;  /* 0-4 value */
	u16   tagchgbits;  /* 0-1 value */
	TAG   tagno;       /* TAGSEGMENT:TAGOFFSET */
} FLOBJREC;

/*
 ************************************************************************
 *                              Macros                                  * 
 ************************************************************************
 */

#define ct_close_obj(ctp) \
        ct_close(ctp)

#define flobjrec_get_name(p)      ((p)->tagname)
#define flobjrec_get_domain(p)    ((p)->tagdomain)
#define flobjrec_get_type(p)      ((p)->tagtype)
#define flobjrec_get_descr(p)     ((p)->tagdescr)
#define flobjrec_get_dimen(p)     ((p)->tagdimen)
#define flobjrec_get_flags(p)     ((p)->tagflags)
#define flobjrec_get_perwhen(p)   ((p)->tagperwhen)
#define flobjrec_get_chgbits(p)   ((p)->tagchgbits)
#define flobjrec_get_tag(p)       (&((p)->tagno))

/*
 ************************************************************************
 *                         Function Prototypes                          * 
 ************************************************************************
 */

#ifndef NOCT

#ifdef __cplusplus
extern "C" {
#endif

extern int ct_open_obj(CT *ctp, char *flapp);
extern int ct_open_obj_ext(CT *ctp, char *flapp, char *ext);
extern int ct_find_obj(CT *ctp, char *objname, FLOBJREC *objrec);
extern int ct_nrecs_obj(CT *ctp, u32 *nrecs);
extern int ct_read_objs(CT *ctp, FLOBJREC *objbuf, u32 srec, u32 nrecs);

/* For backwards compatability */
#define OBJECT_CT FLOBJREC
#define ct_find_tag(ctp, name, objrec) \
        ct_find_obj(ctp, name, objrec)
extern int ct_open_tag(CT *, char *);

#ifdef __cplusplus
}
#endif

#endif /* NOCT */

#endif
