summaryrefslogtreecommitdiffstats
path: root/public/sdk/inc/ossglobl.h
blob: ff7e3aded8cf80d944baa6b9e6d4607253c3292d (plain) (blame)
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
/*
 * Copyright (C) 1992-1996 Open Systems Solutions, Inc.  All rights reserved
 */
/*
 * THIS FILE IS PROPRIETARY MATERIAL OF OPEN SYSTEMS SOLUTIONS, INC. AND
 * MAY BE USED ONLY BY DIRECT LICENSEES OF OPEN SYSTEMS SOLUTIONS, INC.
 * THIS FILE MAY NOT BE DISTRIBUTED.
 */
/*
 * FILE: @(#)ossglobl.h 5.1  96/04/23
 */

#ifndef OSSGLOBL_H
#define OSSGLOBL_H

#include "ossdll.h"

#ifndef OSS_TOED
#define _EncDecGlobals dencoding
#endif
#ifndef ossMemMgrVarLen
#ifdef AS400
#define ossMemMgrVarLen 100
#define ossEncDecVarLen 500    /* The size of the
                                  encDecVar array shouldn't be less than
                                  the sizeof(world->c) since the latter
                                  structure overlays encDecVar */
#else
#define ossMemMgrVarLen 48
#define ossEncDecVarLen 192    /* The size of the
                                  encDecVar array shouldn't be less than
                                  the sizeof(world->c) since the latter
                                  structure overlays encDecVar */
#endif /* AS400 */
#if !defined(EOF) && !defined(_FILE_DEFINED)
typedef char FILE;
#endif /* EOF */

#ifndef ERR_MSG_LENGTH 
#define ERR_MSG_LENGTH 512      /* length of error messages to be output */
#endif 

#ifdef __cplusplus
extern "C"
{
#endif

typedef enum  {
    OSS_BASIC = 0,
    OSS_SPARTAN
} ossAPI;

typedef enum  {
    OSS_BER = 0,
    OSS_PER_ALIGNED,
    OSS_PER_UNALIGNED,
    OSS_SER,
    OSS_DER
} ossEncodingRules;

#if defined(_MSC_VER) && (defined(_WIN32) || defined(WIN32))
#pragma pack(push, ossPacking, 4)
#elif defined(_MSC_VER) && (defined(_WINDOWS) || defined(_MSDOS))
#pragma pack(1)
#elif defined(__BORLANDC__) && defined(__MSDOS__)
#pragma option -a1
#elif defined(__BORLANDC__) && defined(__WIN32__)
#pragma option -a4
#elif defined(__IBMC__)
#pragma pack(4)
#endif /* _MSC_VER && _WIN32 */

typedef struct ossGlobal {
    /*
     * used for communicating with the memory manager and the tracing-routine
     */
                                /* low-level memory allocator */
    void       *(DLL_ENTRY_FPTR *mallocp)(size_t p);
                                /* memory re-allocator */
    void       *(DLL_ENTRY_FPTR *reallocp)(void *p, size_t s);
                                /* low-level memory freer */
    void        (DLL_ENTRY_FPTR *freep)(void *p);
    size_t      asn1chop;       /* 0 means do not truncate strings; greater 
                                 * value means truncate long output strings 
                                 * (OCTET STRING, BIT STRING, Character String)
                                 * to be "asn1chop" bytes long.  Read by
                                 * encoder&decoder tracing and "printPDU"
                                 */
    size_t      ossblock;       /* if not 0, size of largest block
                                 * to allocate */
    size_t      ossprefx;       /* # bytes to leave before OSAK data buffer */

    FILE        *asn1out;       /* tracing output file */

    /* low-level tracing-output function; default is fprintf */
    int (*asn1prnt)(FILE *stream, const char *format, ...);

        /*
         * available for use by user application
         */
    void        *userVar;

        /*
         * used for storing DLL- & library NLMs-related parameters
         */
#if defined(_WINDOWS) || defined(_DLL) || \
    defined(OS2_DLL)  || defined(NETWARE_DLL)
    WinParm      wp;
#endif /* _WINDOWS || _DLL || OS2_DLL || NETWARE_DLL */

        /*
         * reserved for use by the memory manager and the tracing-routine
         */
#ifdef storing
    struct storHandling t;
#else /* not storing */
    long int    memMgrVar[ossMemMgrVarLen];
#endif

        /*
         * related to the new API; not for direct reference by user code
         */
    void             *ctlTbl;
    ossAPI            api;
    ossEncodingRules  encRules;
    unsigned int      encodingFlags;
    unsigned int      decodingFlags;
    long              decodingLength;
    char              errMsg[ERR_MSG_LENGTH];

        /*
         * reserved for use by the encoder/decoder
         */
    double       reserved[4];
#if defined(OSS_TOED)
    struct _EncDecGlobals c;
#elif defined(coding)
    struct _EncDecGlobals c;
#else
    long int encDecVar[ossEncDecVarLen];
#endif
} OssGlobal;

#if defined(_MSC_VER) && (defined(_WIN32) || defined(WIN32))
#pragma pack(pop, ossPacking)
#elif defined(_MSC_VER) && (defined(_WINDOWS) || defined(_MSDOS))
#pragma pack()
#elif defined(__BORLANDC__) && (defined(__WIN32__) || defined(__MSDOS__))
#pragma option -a.
#elif defined(__IBMC__)
#pragma pack()
#endif /* _MSC_VER && _WIN32 */

int DLL_ENTRY ossSetEncodingRules(struct ossGlobal *world,
                                  ossEncodingRules rules);
ossEncodingRules DLL_ENTRY ossGetEncodingRules(struct ossGlobal *world);
int  DLL_ENTRY ossSetDecodingLength(struct ossGlobal *world, long bufferLength);
long DLL_ENTRY ossGetDecodingLength(struct ossGlobal *world);
int  DLL_ENTRY ossSetEncodingFlags(struct ossGlobal *world, unsigned flags);
unsigned DLL_ENTRY ossGetEncodingFlags(struct ossGlobal *world);
int  DLL_ENTRY ossSetDecodingFlags(struct ossGlobal *world, unsigned flags);
unsigned DLL_ENTRY ossGetDecodingFlags(struct ossGlobal *world);
char *DLL_ENTRY ossGetErrMsg(struct ossGlobal *world);
int  DLL_ENTRY ossCallerIsDecoder(struct ossGlobal *world);
                        /*
                         * The following are declarations for link routines
                         * needed to link the encoding rule or rules specified
                         * on the compiler command line.  The function calls
                         * are generated by the compiler into _ossinit_...()
                         * in the control table.  These functions are not
                         * meant to be referenced by user code.
                         */
void DLL_ENTRY ossLinkAPI(OssGlobal *);
void DLL_ENTRY ossLinkBer(OssGlobal *);
void DLL_ENTRY ossLinkPer(OssGlobal *);
void DLL_ENTRY ossLinkDer(OssGlobal *);
void DLL_ENTRY ossLinkSer(OssGlobal *);
void DLL_ENTRY ossLinkConstraint(OssGlobal *);
void DLL_ENTRY ossLinkUserConstraint(OssGlobal *);
void DLL_ENTRY ossLinkBerReal(OssGlobal *);
void DLL_ENTRY ossLinkPerReal(OssGlobal *);
void DLL_ENTRY ossLinkCmpValue(OssGlobal *);
void DLL_ENTRY ossLinkCpyValue(OssGlobal *);
void DLL_ENTRY ossLinkPerPDV(OssGlobal *);
void DLL_ENTRY ossLinkPerReal(OssGlobal *);

#ifdef __cplusplus
}
#endif
#endif /* ossMemMgrVarLen */
#endif /* OSSGLOBL_H */