📄 psap.h
字号:
/* psap.h - include file for presentation users (PS-USER) *//* * $Header: /xtel/isode/isode/h/RCS/psap.h,v 9.0 1992/06/16 12:17:57 isode Rel $ * * * $Log: psap.h,v $ * Revision 9.0 1992/06/16 12:17:57 isode * Release 8.0 * *//* * NOTICE * * Acquisition, use, and distribution of this module and related * materials are subject to the restrictions of a license agreement. * Consult the Preface in the User's Manual for the full terms of * this agreement. * */#ifndef _PSAP_#define _PSAP_#ifndef _MANIFEST_#include "manifest.h"#endif#ifndef _GENERAL_#include "general.h"#endif#include <math.h>/* */#ifndef USE_BUILTIN_OIDS#define USE_BUILTIN_OIDS 1#endiftypedef struct OIDentifier { int oid_nelem; /* number of sub-identifiers */ unsigned int *oid_elements; /* the (ordered) list of sub-identifiers */} OIDentifier, *OID;#define NULLOID ((OID) 0)OID ode2oid ();int oid_cmp (), elem_cmp ();OID oid_cpy ();int oid_free ();#define oid2ode(i) oid2ode_aux ((i), 1)char *oid2ode_aux ();char *sprintoid ();OID str2oid ();/* */typedef u_char PElementClass;typedef u_char PElementForm;typedef u_short PElementID; /* 0..16383 are meaningful (14 bits) */#define PE_ID_BITS 14#define PE_ID(class,code) \ ((int) ((((code) & 0x3fff) << 2) | ((class) & 0x0003)))typedef int PElementLen;typedef u_char byte, *PElementData;#define NULLPED ((PElementData) 0)#define PEDalloc(s) ((PElementData) malloc ((unsigned int) (s)))#define PEDrealloc(p, s) ((PElementData) \ realloc ((char *) (p), (unsigned int) (s)))#define PEDfree(p) free ((char *) (p))#define PEDcmp(b1, b2, length) \ bcmp ((char *) (b1), (char *) (b2), (int) (length))#define PEDcpy(b1, b2, length) \ bcopy ((char *) (b1), (char *) (b2), (int) (length))/* */typedef struct PElement { int pe_errno; /* Error codes */#define PE_ERR_NONE 0 /* No error */#define PE_ERR_OVER 1 /* Overflow */#define PE_ERR_NMEM 2 /* Out of memory */#define PE_ERR_BIT 3 /* No such bit */#define PE_ERR_UTCT 4 /* Malformed universal timestring */#define PE_ERR_GENT 5 /* Malformed generalized timestring */#define PE_ERR_MBER 6 /* No such member */#define PE_ERR_PRIM 7 /* Not a primitive form */#define PE_ERR_CONS 8 /* Not a constructor form */#define PE_ERR_TYPE 9 /* Class/ID mismatch in constructor */#define PE_ERR_OID 10 /* Malformed object identifier */#define PE_ERR_BITS 11 /* Malformed bitstring */#define PE_ERR_NOSUPP 12 /* Type not supported */#define PE_ERR_SIGNED 13 /* Signed integer not expected */#define PE_ERR_DUPLICATE 14 /* duplicate member */#define PE_ERR_SYNTAX 15 /* syntax error */ /* for the PSAP */ int pe_context; /* indirect reference */#define PE_DFLT_CTX 0 /* the default context */#define PE_ID_XTND 0x1f /* distinguished ID for extension bits */#define PE_ID_MORE 0x80 /* more to come flag */#define PE_ID_MASK 0x7f /* value in extension byte */#define PE_ID_SHIFT 7#define PE_CLASS_MASK 0xc0 /* identifier class bits (8-7) */#define PE_CLASS_SHIFT 6#define PE_FORM_MASK 0x20 /* identifier form bit (6) */#define PE_FORM_SHIFT 5#define PE_CODE_MASK 0x1f /* identifier code bits (5-1) + ... */#define PE_CODE_SHIFT 0 PElementClass pe_class;#define PE_CLASS_UNIV 0x0 /* Universal */#define PE_CLASS_APPL 0x1 /* Application-wide */#define PE_CLASS_CONT 0x2 /* Context-specific */#define PE_CLASS_PRIV 0x3 /* Private-use */ PElementForm pe_form;#define PE_FORM_PRIM 0x0 /* PRIMitive */#define PE_FORM_CONS 0x1 /* CONStructor */#define PE_FORM_ICONS 0x2 /* internal: Inline CONStructor */ PElementID pe_id; /* should be extensible, 14 bits for now */ /* Pseudo Types */#define PE_UNIV_EOC 0x000 /* End-of-contents */ /* Built-in Types */#define PE_PRIM_BOOL 0x001 /* Boolean */#define PE_PRIM_INT 0x002 /* Integer */#define PE_PRIM_BITS 0x003 /* Bitstring */#define PE_PRIM_OCTS 0x004 /* Octetstring */#define PE_PRIM_NULL 0x005 /* Null */#define PE_PRIM_OID 0x006 /* Object identifier */#define PE_PRIM_ODE 0x007 /* Object descriptor */#define PE_CONS_EXTN 0x008 /* External */#define PE_PRIM_REAL 0x009 /* Real */#define PE_PRIM_ENUM 0x00a /* Enumerated type */#define PE_PRIM_ENCR 0x00b /* Encrypted */#define PE_CONS_SEQ 0x010 /* Sequence */#define PE_CONS_SET 0x011 /* Set */ /* Defined Types */#define PE_DEFN_NUMS 0x012 /* Numeric String */#define PE_DEFN_PRTS 0x013 /* Printable String */#define PE_DEFN_T61S 0x014 /* T.61 String */#define PE_DEFN_VTXS 0x015 /* Videotex String */#define PE_DEFN_IA5S 0x016 /* IA5 String */#define PE_DEFN_UTCT 0x017 /* UTC Time */#define PE_DEFN_GENT 0x018 /* Generalized Time */#define PE_DEFN_GFXS 0x019 /* Graphics string (ISO2375) */#define PE_DEFN_VISS 0x01a /* Visible string */#define PE_DEFN_GENS 0x01b /* General string */#define PE_DEFN_CHRS 0x01c /* Character string */ PElementLen pe_len;#define PE_LEN_XTND 0x80 /* long or indefinite form */#define PE_LEN_SMAX 127 /* largest short form */#define PE_LEN_MASK 0x7f /* mask to get number of bytes in length */#define PE_LEN_INDF (-1) /* indefinite length */ PElementLen pe_ilen; union { PElementData un_pe_prim; /* PRIMitive value */ struct PElement *un_pe_cons; /* CONStructor head */ } pe_un1;#define pe_prim pe_un1.un_pe_prim#define pe_cons pe_un1.un_pe_cons union { int un_pe_cardinal; /* cardinality of list */ int un_pe_nbits; /* number of bits in string */ } pe_un2;#define pe_cardinal pe_un2.un_pe_cardinal#define pe_nbits pe_un2.un_pe_nbits int pe_inline; /* for "ultra-efficient" PElements */ char *pe_realbase; /* .. */ int pe_offset; /* offset of element in sequence */ struct PElement *pe_next; int pe_refcnt; /* hack for ANYs in pepy */#ifdef DEBUG struct PElement *pe_link; /* malloc debugging... */#endif} PElement, *PE;#define NULLPE ((PE) 0)#define NULLPEP ((PE *) 0)#define pe_seterr(pe, e, v) ((pe) -> pe_errno = (e), (v))extern int pe_allocs;extern int pe_frees;extern int pe_most;extern PE pe_list;#ifdef DEBUGextern PE pe_active;#endifPE pe_alloc ();int pe_free ();int pe_cmp ();PE pe_cpy ();int pe_pullup ();PE pe_expunge ();int pe_extract ();PE str2pe ();PE qb2pe ();extern int pe_maxclass;extern char *pe_classlist[];extern int pe_maxuniv;extern char *pe_univlist[];extern int pe_maxappl;extern char **pe_applist;extern int pe_maxpriv;extern char **pe_privlist;/* */typedef struct UTCtime { int ut_year; int ut_mon; int ut_mday; int ut_hour; int ut_min; int ut_sec; int ut_usec; int ut_zone; int ut_flags;#define UT_NULL 0x00#define UT_ZONE 0x01#define UT_SEC 0x02#define UT_USEC 0x04} UTCtime, *UTC;#define NULLUTC ((UTC) 0)void tm2ut ();long gtime ();struct tm *ut2tm ();/* */extern char *psapversion;int prim2flag ();PE flag2prim ();#define bool2prim(b) flag2prim ((b), PE_CLASS_UNIV, PE_PRIM_BOOL)integer prim2num ();PE num2prim ();#define int2prim(i) num2prim ((integer) (i), PE_CLASS_UNIV, PE_PRIM_INT)#define prim2enum(i) prim2num((i))#define enum2prim(a,b,c) num2prim((a), (b), (c))#define enumint2prim(i) enum2prim ((i), PE_CLASS_UNIV, PE_PRIM_ENUM)/* psap REAL parameters - tons of 'em */#define PE_REAL_FLAGS 0300 /* flag bits of real */#define PE_REAL_BINENC 0200 /* binary encoding */#define PE_REAL_DECENC 0000 /* decimal encoding */#define PE_REAL_SPECENC 0100 /* special encoding */#define PE_REAL_B_S 0100 /* sign bit */#define PE_REAL_B_BASE 0060 /* base bits */#define PE_REAL_B_B2 0000#define PE_REAL_B_B8 0020#define PE_REAL_B_B16 0040#define PE_REAL_B_F 0014 /* factor bits */#define PE_REAL_B_EXP 0003 /* exponent type bits */#define PE_REAL_B_EF1 0000#define PE_REAL_B_EF2 0001#define PE_REAL_B_EF3 0002#define PE_REAL_B_EF4 0003#define PE_REAL_PLUSINF 0200#define PE_REAL_MINUSINF 0201#ifndef HUGE#ifdef MAXFLOAT#define PE_REAL_INFINITY MAXFLOAT#else#define PE_REAL_INFINITY 99.e99#endif#else#define PE_REAL_INFINITY HUGE#endifdouble prim2real ();PE real2prim ();#define double2prim(i) real2prim ((i), PE_CLASS_UNIV, PE_PRIM_REAL)char *prim2str ();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -