![]() |
![]() |
|
|
eLink Adapter Development Kit References
This section discusses the following topics:
Configuration Processing API
This section provides detailed descriptions of the configuration processing API used by the ADK listed in the order that the functions will most likely be used. Following is an alphabetical list of the configuration processing API functions and a reference to where details about the function can be found in this appendix.
Table A-1 Alphabetical Cross-Reference List of Configuration Processing API Functions
Refer to |
---|
eLA_OpenTagFile opens a Tag file, reads the data into memory. Some preliminary processing is performed, such as deleting leading and trailing white space, removing blank lines, converting section names and tag data to uppercase and indexing the data. Section names are always preceded by an asterisk (*). Tag data specifically refers to a string that is to the left of an equal sign on a line. If a string is not preceded by an asterisk or to the left of an equal sign on a line, then it will not be uppercased. Finally, the file is closed and a handle to the data is returned. This handle is used by the eLA_GetFirstSection function and should be closed using eLA_CloseTagFile when no longer needed. Multiline entries are allowed. If the last non white space character on any line is a \, the next line will be concatenated to the current line. A blank line will terminate the multiline entry.
Prototype
ADK_CFG_HANDLE eLA_OpenTagFile(char * TagFileName)
where
TagFileName is the name of the Tag (or .INI) file.
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
On any error, such as invalid file name, malloc problems, etc. |
Anything else |
Success |
#include "adkfns.h"
...
ADK_CFG_HANDLE fHandle;
char FileName[256];
...
strcpy(FileName, "MYSAMPLE.INI");
fHandle = eLA_OpenTagFile(FileName);
if(fHandle == ADK_INVALID_HANDLE_VALUE)
printf("Unable to process file %s\n",FileName);
else
printf("File %s opened\n", FileName);
...
eLA_CloseTagFile(fHandle);
eLA_CloseTagFile
eLA_CloseTagFile closes a handle returned by eLA_OpenTagFile and frees any internally allocated resources. It can be called with an invalid handle.
Prototype
int eLA_CloseTagFile(ADK_CFG_HANDLE TagFileHandle)
where
TagFileHandle is the handle returned by eLA_OpenTagFile.
Return
Return |
Description |
---|---|
ADK_SUCCESS |
Success |
Anything else |
Error |
#include "adkfns.h"
...
ADK_CFG_HANDLE fHandle;
...
fHandle = eLA_OpenTagFile(FileName);
...
eLA_CloseTagFile(fHandle);
eLA_CloseTagHandle
eLA_CloseTagHandle closes a handle returned by eLA_GetFirstSection and frees any internally allocated resources. It also can be called with an invalid handle.
Prototype
int eLA_CloseTagHandle(ADK_CFG_HANDLE GenericHandle)
where
GenericHandle is the handle returned by eLA_GetFirstSection.
Return
Return |
Description |
---|---|
ADK_SUCCESS |
Success. |
Anything else |
Error. |
#include "adkfns.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
...
fHandle = eLA_OpenTagFile(FileName);
...
if(fHandle != ADK_INVALID_HANDLE_VALUE)
sHandle = eLA_GetFirstSection(fHandle, "SERVICE");
...
eLA_CloseTagFile(fHandle);
eLA_CloseTagHandle(sHandle);
eLA_GetFirstSection
eLA_GetFirstSection searches the INI file memory image for the desired sections (all text matching done after conversion to upper case). These locations are indexed, and a handle to this data is returned. This handle is used by the eLA_GetNextSection, eLA_GetFirstProperty, eLA_GetNextProperty and eLA_GetPropertyValue. It should be freed by eLA_CloseTagHandle when no longer needed.
Prototype
ADK_CFG_HANDLE eLA_GetFirstSection(ADK_CFG_HANDLE TagFileHandle,
char * SectionName)
where
TagFileHandle is the handle returned by eLA_OpenTagFile.
SectionName is the name of the section desired, excluding "*" (SectionName is provided by the API). The text is converted to upper case before searching.
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
On any error, such as invalid handle in argument, malloc problems, or not finding section name. |
Anything else |
Success |
#include "adkfns.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
...
fHandle = eLA_OpenTagFile(FileName);
...
if(fHandle != ADK_INVALID_HANDLE_VALUE)
sHandle = eLA_GetFirstSection(fHandle, "SERVICE");
...
eLA_CloseTagFile(fHandle);
eLA_CloseTagHandle(sHandle);
eLA_GetNextSection
eLA_GetNextSection updates the information in the section handle returned by eLA_GetFirstSection and point to the next occurrence of the section in question.
Prototype
int eLA_GetNextSection(ADK_CFG_HANDLE SectionHandle)
where
SectionHandle is the handle returned by eLA_GetFirstSection.
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
Invalid handle in argument. |
ADK_ERROR_LAST_SECTION |
No more sections. |
ADK_SUCCESS |
Success |
#include "adkfns.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
int rc;
...
fHandle = eLA_OpenTagFile(FileName);
...
if(fHandle != ADK_INVALID_HANDLE_VALUE)
sHandle = eLA_GetFirstSection(fHandle, "SERVICE");
if(sHandle != ADK_INVALID_HANDLE_VALUE)
{ rc = ADK_SUCCESS;
while(rc == ADK_SUCCESS);
{ rc = eLA_GetNextSection(sHandle);
...
}
}
...
eLA_CloseTagFile(fHandle);
eLA_CloseTagHandle(sHandle);
eLA_GetFirstProperty
eLA_GetFirstProperty retrieves the Tag/Value pair for the first property for a particular section.
Prototype
int eLA_GetFirstProperty(ADK_CFG_HANDLE SectionHandle,
char * TagBuffer, size_t TagLength,
char * ValueBuffer, size_t ValueLength);
where
SectionHandle is the handle returned by eLA_GetFirstSection.
TagBuffer is address of the tag data return buffer.
TagLength is the size of the tag data buffer (including NULL).
ValueBuffer is the address of the value data return buffer.
ValueLength is the size of the value data buffer (including NULL).
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
Invalid handle in argument. |
ADK_ERROR_NO_PROPERTIES |
No property lines for section. |
ADK_ERROR_NO_VALUE |
No text following the = in the tag line. |
ADK_ERROR_NO_TAG |
No text preceding the = in the tag line. |
ADK_ERROR_BUFFER_OVERFLOW |
Not enough room for either tag or value data. |
#include "adkfns.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
char tBuffer[100], vBuffer[100];
int rc, pc;
...
fHandle = eLA_OpenTagFile(FileName);
...
if(fHandle != ADK_INVALID_HANDLE_VALUE)
sHandle = eLA_GetFirstSection(fHandle, "SERVICE");
if(sHandle != ADK_INVALID_HANDLE_VALUE)
{ rc = ADK_SUCCESS;
while(rc == ADK_SUCCESS);
{ pc = eLA_GetFirstProperty(sHandle, tBuffer,
sizeof(tBuffer),vBuffer,sizeof(vBuffer);
...
rc = eLA_GetNextSection(sHandle);
...
}
}
...
eLA_CloseTagFile(fHandle);
eLA_CloseTagHandle(sHandle);
eLA_GetNextProperty
eLA_GetNextProperty retrieves the Tag/Value pair for the second and successive properties for a particular section.
Prototype
int eLA_GetNextProperty(ADK_CFG_HANDLE SectionHandle,
char * TagBuffer, size_t TagLength,
char * ValueBuffer, size_t ValueLength);
where
SectionHandle is the handle returned by eLA_GetFirstSection.
TagBuffer is the address of the tag data return buffer.
TagLength is the size of the tag data buffer (including NULL).
ValueBuffer is the address of the value data return buffer.
ValueLength is the size of the value data buffer (including NULL).
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
Invalid handle in argument. |
ADK_ERROR_LAST_PROPERTY |
No more properties for this section. |
ADK_ERROR_NO_VALUE |
No text following the = in the tag line. |
ADK_ERROR_NO_TAG |
No text preceding the = in the tag line. |
ADK_ERROR_BUFFER_OVERFLOW |
Not enough room for either tag or value data. |
#include "adkfns.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
char tBuffer[100], vBuffer[100];
int rc, pc;
...
fHandle = eLA_OpenTagFile(FileName);
...
if(fHandle != ADK_INVALID_HANDLE_VALUE)
sHandle = eLA_GetFirstSection(fHandle, "SERVICE");
if(sHandle != ADK_INVALID_HANDLE_VALUE)
{ rc = ADK_SUCCESS;
while(rc == ADK_SUCCESS);
{ pc = eLA_GetFirstProperty(sHandle, tBuffer,
sizeof(tBuffer),vBuffer, sizeof(vBuffer);
...
pc = eLA_GetNextProperty(sHandle, tBuffer,
sizeof(tBuffer),vBuffer, sizeof(vBuffer);
...
rc = eLA_GetNextSection(sHandle);
...
}
}
...
eLA_CloseTagFile(fHandle);
eLA_CloseTagHandle(sHandle);
eLA_GetPropertyValue
eLA_GetPropertyValue retrieves the Value data for the first occurrence of a particular tag in a given section. Text fields are converted to upper case prior to searching.
Prototype
int eLA_GetPropertyValue(ADK_CFG_HANDLE SectionHandle,
char * TagName,char * ValueBuffer, size_t ValueLength);
where
SectionHandle is the handle returned by eLA_GetFirstSection.
TagName is the tag to search for.
ValueBuffer is the address of the value data return buffer.
ValueLength is the size of the value data buffer (including NULL).
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
Invalid handle in argument. |
ADK_ERROR_PROPERTY_NOT_ |
No tag matching input found. |
ADK_ERROR_NO_VALUE |
No text following the = in the tag line. |
ADK_ERROR_NO_TAG |
No text preceding the = in the tag line. |
ADK_ERROR_BUFFER_OVERFLOW |
Not enough room for value data. |
#include "adkfns.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
char tBuffer[100], vBuffer[100];
int rc, pc;
...
fHandle = eLA_OpenTagFile(FileName);
...
if(fHandle != ADK_INVALID_HANDLE_VALUE)
sHandle = eLA_GetFirstSection(fHandle, "SERVICE");
if(sHandle != ADK_INVALID_HANDLE_VALUE)
{ rc = ADK_SUCCESS;
while(rc == ADK_SUCCESS);
{ pc = eLA_GetPropertyValue(sHandle, "NAME" vBuffer,
sizeof(vBuffer);
...
rc = eLA_GetNextSection(sHandle);
...
}
}
...
eLA_CloseTagFile(fHandle);
eLA_CloseTagHandle(sHandle);
eLA_GetFieldMap
eLA_GetFieldMap searches the adapter specific configuration file memory image for the named *FIELDMAP section. A handle to the data is returned, which is then used by eLA_GetFirstField and eLA_GetNextField to retrieve each line in order. This handle should be freed by eLA_CloseTagHandle when no longer needed. (This function is somewhat analogous to eLA_GetFirstSection).
Prototype
ADK_CFG_HANDLE eLA_GetFieldMap(ADK_CFG_HANDLE TagFileHandle
char * FieldMapName)
where
TagFileHandle is the handle returned by eLA_OpenTagFile.
FieldMapName is the name of the Fieldmap desired.
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
On any error, such as invalid handle in argument, malloc problems, or not finding Fieldmap. |
Anything else |
Success |
#include "adkfns.h"
#include "adktypes.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
char FileName[256];
...
fHandle = eLA_OpenTagFile(FileName);
if(fHandle != ADK_INVALID_HANDLE_VALUE)
sHandle = eLA_GetFieldMap(fHandle, "Map1");
...
eLA_CloseTagHandle(sHandle);
eLA_CloseTagFile(fHandle);
eLA_GetFirstField
eLA_GetFirstField retrieves the information for the first line in a fieldmap section. This data is parsed into the appropriate structure members, up to the maximum field widths, with no validity checking.
Prototype
long eLA_GetFirstField(ADK_CFG_HANDLE MapHandle, FIELDMAP * FieldMap)
where
MapHandle is the handle returned by eLA_GetFieldMap.
FieldMap is a pointer to a FIELDMAP (typedef(d) struct).
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
Invalid handle in argument. |
ADK_ERROR_NO_FIELDS |
No field lines for map. |
#include "adkfns.h"
#include "adktypes.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
FIELDMAP FieldMap;
char FileName[256];
long rc;
...
fHandle = eLA_OpenTagFile(FileName);
if(fHandle != ADK_INVALID_HANDLE_VALUE)
{ sHandle = eLA_GetFieldMap(fHandle, "Map1");
if(sHandle != ADK_INVALID_HANDLE_VALUE)
rc = eLA_GetFirstField(sHandle, &FieldMap);
...
}
...
eLA_CloseTagHandle(sHandle);
eLA_CloseTagFile(fHandle);
eLA_GetNextField
eLA_GetNextField retrieves the information for successive lines in a fieldmap section. This data is parsed into the appropriate structure members, up to the maximum field widths, with no validity checking.
Prototype
long eLA_GetNextField(ADK_CFG_HANDLE MapHandle, FIELDMAP * FieldMap)
where
MapHandle is the handle returned by eLA_GetFieldMap.
FieldMap is a pointer to a FIELDMAP (typedef(d) struct).
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
Invalid handle in argument. |
ADK_ERROR_LAST_FIELD |
No more fields for map. |
#include "adkfns.h"
#include "adktypes.h"
...
ADK_CFG_HANDLE fHandle, sHandle;
FIELDMAP FieldMap;
char FileName[256];
long rc;
...
fHandle = eLA_OpenTagFile(FileName);
if(fHandle != ADK_INVALID_HANDLE_VALUE)
{ sHandle = eLA_GetFieldMap(fHandle, "Map1");
if(sHandle != ADK_INVALID_HANDLE_VALUE)
{ rc = eLA_GetFirstField(sHandle, &FieldMap);
while(rc == ADK_SUCCESS)
{ ...
rc = eLA_GetNextField(sHandle, &FieldMap);
...
}
}
...
}
...
eLA_CloseTagHandle(sHandle);
eLA_CloseTagFile(fHandle);
Hash Table API
Following are the hash table API functions used by the ADK.
eLA_InitHashTable
eLA_InitHashTable creates a hash table and returns a pointer to it. This table should be free(d) when no longer needed by eLA_DestHashTable.
Prototype
struct nlist * * eLA_InitHashtable(void);
Return
Return |
Description |
---|---|
NULL |
malloc error. |
Anything else |
Table address. |
#include "adkfns.h"
...
struct nlist * * cb_hash;
...
cb_hash = eLA_InitHashtable();
if(cb_hash == NULL)
printf("unable to make hash\n");
else
...
...
...
eLA_DestHashtable(cb_hash);
eLA_DestHashTable
eLA_DestHashTable frees all of the dynamic memory in a hash table. It will behave intelligently when fed a NULL pointer.
Prototype
void eLA_DestHashtable(struct nlist * hashtable[])
Return
No returns.
Example
#include "adkfns.h"
...
struct nlist * * cb_hash;
...
cb_hash = eLA_InitHashtable();
...
...
...
eLA_DestHashtable(cb_hash);
eLA_put
eLA_put adds a new element to the hash table. It signals an error when a duplicate key is encountered.
Prototype
struct nlist * eLA_put(struct nlist * hashtable[], char * key,
void * data, size_t datalen)
Return
Return |
Description |
---|---|
NULL |
Duplicate key or malloc error. |
Anything else |
Pointer to element (success). |
#include "adkfns.h"
...
struct nlist * * cb_hash, * element;
char data[81], key[81];
...
cb_hash = eLA_InitHashtable();
if(cb_hash == NULL)
printf("unable to make hash\n");
else
{ strcpy(key, "passphrase");
strcpy(data, "Open Sesame");
element = eLA_put(cb_hash, key, data, 1 + strlen(data));
if(element == NULL)
printf("unable to add element to hash table\n");
else
...
}
...
...
eLA_DestHashtable(cb_hash);
eLA_get
eLA_get retrieves an element from the hash table. Note that a pointer to the element is returned - you must extract the data explicitly.
Prototype
struct nlist * eLA_get(struct nlist * hashtable[], char * key)
Return
Return |
Description |
---|---|
NULL |
Key not found. |
Anything else |
Pointer to element (success). |
#include "adkfns.h"
...
struct nlist * * cb_hash, * element;
char data[81], key[81];
...
cb_hash = eLA_InitHashtable();
if(cb_hash == NULL)
printf("unable to make hash\n");
else
{ strcpy(key, "passphrase");
strcpy(data, "Open Sesame");
element = eLA_put(cb_hash, key, data, 1 + strlen(data));
if(element == NULL)
printf("unable to add element to hash table\n");
else
...
}
strcpy(key, "passphrase");
element = eLA_get(cb_hash, key);
if(element == NULL)
printf("unable to fetch element from hash table\n");
else
...
...
...
eLA_DestHashtable(cb_hash);
eLA_hash
Returns the hash value for a given key.
Prototype
unsigned int eLA_hash (char * key)
Return
Return |
Description |
---|---|
Any value |
Hash value for key. |
#include "adkfns.h"
...
unsigned int cbhash;
char key[81];
...
strcpy(key, "corned beef");
cbhash = eLA_hash(key);
printf("hash value for key = %s is %d\n", key, cbhash);
...
...
Utility Functions and Macros
Following are the utility functions and macros used by the ADK.
eLA_catentry
eLA_catentry retrieves a specified error message from a message catalog file using the handle returned by eLA_OpenCatalogFile.
Prototype
char * eLA_catentry(char * msgbuffer, size_t bufferlen,
ADK_CAT_HANDLE chandle, int msgnumber)
where
msgbuffer is the caller supplied buffer. This is filled to a maximum of bufferlen -1 chars with the message requested.
bufferlen is the size of the buffer.
chandle is the ADK_CAT_HANDLE returned by eLA_OpenCatalogFile.
msgnumber is the ID of the message desired.
Return
A message buffer is ALWAYS returned. This buffer may contain the following text
Return |
Description |
---|---|
Invalid ADK_CAT_HANDLE |
An invalid handle was passed. |
Message xxx not found |
Message ID xxx not found in file. |
#include adkfns.h
#include adktypes.h
...
ADK_CAT_HANDLE rHandle;
char catFileName[MAX_FNAME];
char msgbuffer[1024];
...
strcpy(catFileName, "c:\\tuxedo\elink\catalogs\ouradapter.text"
rHandle = eLA_OpenCatalogFile(catFileName);
...
eLA_log(eLA_catentry(msgbuffer, sizeof(msgbuffer), rHandle, 121);
...
eLA_CloseCatalogFile(rHandle);
eLA_chkeLinkLic
eLA_chkeLinkLic checks for a valid, current 'eLink Platform' section within the Tuxedo License File (TUXDIR/udataobj/lic.txt), in addition to checking the adapter_section specified in the argument to the function. Version numbers in the License File >= function argument are acceptable. eLA_chkeLinkLic can be used to verify the platform license only by passing a NULL in the adapter_section parameter.
Prototype
int eLA_chkeLinkLic(const char * adapter_section, const char
* current_version)
Return
Return |
Description |
---|---|
-1 |
Invalid (missing, expired, etc.) license. (Details in userlog()). |
0 |
Success |
#include "adkfns.h"
...
int rc;
char Section[81], Version[81];
strcpy(Section, "eLink Adapter for PeopleSoft");
strcpy(Version, "1.1");
rc = eLA_chkeLinkLic(Section, Version);
printf("eLinkLicense test, (v%s) - rc = %d\n", Version, rc);
...
eLA_CloseCatalogFile
eLA_CloseCatalogFile closes a handle returned by eLA_OpenCatalogFile and frees any internally allocated resources. It can be called with an invalid handle.
Prototype
int eLA_CloseCatalogFile(ADK_CAT_HANDLE CatFileHandle)
where
CatFileHandle is the handle returned by eLA_OpenCatalogFile.
Return
Return |
Description |
---|---|
ADK_SUCCESS |
Success |
Anything else |
Error |
#include adkfns.h
#include adktypes.h
...
ADK_CAT_HANDLE rHandle;
char catFileName[MAX_FNAME];
...
strcpy(catFileName, "c:\\tuxedo\elink\catalogs\tuxnt.text"
rHandle = eLA_OpenCatalogFile(catFileName);
...
eLA_CloseCatalogFile(rHandle);
eLA_GetConfigFileName
eLA_GetConfigFileName extracts the server configuration file name from the command line arguments passed to tpsvrinit() by Tuxedo.
Prototype
int eLA_GetConfigFileName(char * FileNameBuffer, size_t
BufferSize,int argc, char * argv[])
where
FileNameBuffer is the caller-supplied buffer to receive the file name.
BufferSize is the length of the buffer.
argc, argv argc, is the argv as passed to tpsvrinit() by Tuxedo.
Return
Return |
Description |
---|---|
-1 |
Buffer not large enough. |
0 |
File Name parameter NOT found. |
>0 |
Number of characters returned, including NULL. |
char configFileName[MAX_FNAME];
...
rc = eLA_GetConfigFileName(configFileName, MAX_FNAME, argc, argv);
printf("eLA_GetConfigFileName - rc = %d\n", rc);
if(rc == -1)
printf("Buffer not large enough\n");
else if(rc == 0)
printf("File Name parameter not found\n");
else
printf("File Name = %s\n", configFileName);
eLA_hexdump
eLA_hexdump prints (to ULOG) data in the format given below, starting with the input address and continuing for maxchars bytes. If offlag = = ELA_HEX_ADDRESS_OFFSET, the offset from starting address is printed, otherwise the absolute address is printed.
Prototype
void eLA_hexdump(void * char_buffer, size_t maxchars, int offlag)
Example of Output
0012FB38 ff ff ff ff 54 fb 12 00 f1 85 f8 77 18 07 14 00 ....Tû..ñ..w....
0012FB48 74 0f 14 00 dc 05 14 00 09 00 00 00 00 00 00 00 t...Ü...........
0012FB58 09 00 00 00 b0 2b 00 10 50 0f 14 00 cc 05 14 01 ....°+..P.......
0012FB68 7d 1e f6 77 68 }..wh
eLA_log
eLA_log currently is a cover function for userlog(). It is intended that this function will be extended to handle message catalogs in the near future.
Prototype
void eLA_log(char *userText, ...)
Return
None
Example
#include "adkfns.h"
...
eLA_log("Required parameter -C missing");
...
eLA_OpenCatalogFile
eLA_OpenCatalogFile opens a message catalog file (in text form), reads the information into memory, does some preliminary processing (for example, removes double quotes) and indexes the file. The file is closed and a handle to the data is returned. This handle is used by the eLA_catentry function and should be closed using eLA_CloseCatalogFile when no longer needed.
Prototype
ADK_CAT_HANDLE eLA_OpenCatalogFile(char * CatFileName)
where
CatFileName is the FULLY QUALIFIED file name for the message catalog.
Return
Return |
Description |
---|---|
ADK_INVALID_HANDLE_VALUE |
On any error, such as invalid handle in argument, malloc problems, or not finding Fieldmap. |
Anything else |
Success |
#include adkfns.h
#include adktypes.h
...
ADK_CAT_HANDLE rHandle;
char catFileName[MAX_FNAME];
...
strcpy(catFileName, "c:\\tuxedo\elink\catalogs\tuxnt.text"
rHandle = eLA_OpenCatalogFile(catFileName);
...
eLA_CloseCatalogFile(rHandle);
eLA_SetServerMsgLevel
eLA_SetServerMsgLevel extracts the min and max message levels from the values for the MINMSGLEVEL and MAXMSGLEVEL tags in the SERVER section of the configuration file.
Prototype
int eLA_SetServerMsgLevel(char * Filename, MSG_LEVEL * msglevels)
where
Filename is the configuration file name.
msglevels is the MSG_LEVEL struct to receive level data.
Return
Return |
Description |
---|---|
ADK_SUCCESS |
Found and extracted both values |
ADK_ERROR_SECTION_NOT_ |
SERVER section not found. |
ADK_ERROR_PROPERTY_NOT_ |
One or both levels not found. |
ADK_ERROR_OPEN_READ |
Unable to read file. |
MSG_LEVEL zLevel = {0,0};
char configFileName[MAX_FNAME];
...
rc = eLA_GetConfigFileName(configFileName, MAX_FNAME, argc, argv);
if(rc == ADK_SUCCESS)
{ rc = eLA_SetServerMsgLevel(configFileName, &zLevel);
printf("SetServerMsgLevel - rc = %d\n",rc);
if(rc == ADK_SUCCESS)
printf("min, max = %d, %d\n", zLevel.minMsgLevel,
zLevel.maxMsgLevel);
}
...
ELACATENTRY
ELACATENTRY is a cover macro for the eLA_catentry function.
Definition
#define ELACATENTRY(u,v,x,y) eLA_catentry((u),(v),(x),(y))
Example
...
char cat_buffer[ELA_MAX_ERROR_MESSAGE];
size_t cat_len;
...
cat_len = sizeof(cat_buffer);
strcpy(catFileName, "c:\\tuxedo\elink\catalogs\ouradapter.text"
rHandle = eLA_OpenCatalogFile(catFileName);
...
eLA_log( ELACATENTRY(cat_buffer, cat_len, rHandle, 2221));
ELAIFTRACE
ELAIFTRACE calls a bracketed {} set of code if LVL falls within a range defined by minMsgLevel and maxMsgLevel of the given MSG_LEVEL structure VAR.
Definition
#define ELAIFTRACE(VAR,LVL) if( ((LVL) >= (VAR).minMsgLevel)
&& \((LVL)<= (VAR).maxMsgLevel
Example
ELAIFTRACE can be used to invoke the eLA_hexdump program:
...
MSG_LEVEL zLevel = {0,0};
char configFileName[256];
...
eLA_SetServerMsgLevel(configFileName, &zLevel);
...
ELAIFTRACE(zLevel, 3){ eLA_hexdump(buffer, sizeof(buffer), 1);}
ELATRACE
ELATRACE calls eLA_log with ARGS if LVL falls within a range defined by minMsgLevel and maxMsgLevel of the given MSG_LEVEL structure VAR.
Definition
#define ELATRACE(VAR, LVL, ARGS) if(((LVL) >= (VAR).minMsgLevel)
&& \ ((LVL) <= (VAR).maxMsgLevel)
Example
...
MSG_LEVEL zLevel = {0,0};
char cat_buffer[ELA_MAX_ERROR_MESSAGE];
size_t cat_len;
...
cat_len = sizeof(cat_buffer);
...
eLA_SetServerMsgLevel(configFileName, &zLevel);
strcpy(catFileName, "c:\\tuxedo\elink\catalogs\ouradapter.text"
rHandle = eLA_OpenCatalogFile(catFileName);
...
ELATRACE(zLevel, 3, (ELACATENTRY(cat_buffer, cat_len, rHandle,
1221)));
Definitions and Typedefs
The following typedef and definitions are used by the configuration file processing functions:
typedef int ADK_CFG_Handle
Function |
Typedef |
---|---|
#define ADK_INVALID_HANDLE_VALUE |
-1 |
#define ADK_SUCCESS |
0 |
#define ADK_ERROR_LAST_SECTION |
1 |
#define ADK_ERROR_NO_PROPERTIES |
2 |
#define ADK_ERROR_LAST_PROPERTY |
3 |
#define ADK_ERROR_NO_TAG |
4 |
#define ADK_ERROR_NO_VALUE |
5 |
#define ADK_ERROR_BUFFER_OVERFLOW |
6 |
#define ADK_ERROR_PROPERTY_NOT_FOUND |
7 |
#define ADK_ERROR_SECTION_NOT_FOUND |
8 |
#define ADK_INVALID_HANDLE_VALUE |
-1 |
#define ADK_SUCCESS |
0 |
The following definitions are used by the eLA_GetConfigFileName and eLA_SetServerMsgLevel utility functions:
Function |
Typedef |
---|---|
#define ADK_ERROR_FILE_NOT_FOUND |
21 |
#define ADK_ERROR_OPEN_READ |
22 |
#define ADK_ERROR_OPEN_WRITE |
23 |
#define ADK_ERROR_ON_READ |
24 |
#define ADK_ERROR_ON_WRITE |
25 |
The following definition is used by the hash table functions:
struct nlist
{
struct nlist *next; /* next element in the linked list */
char *key; /* String that is hashed */
void *data; /* Data stored in hash table */
};
The following definitions are used by the and eLA_SetServerMsgLevel, eLA_hexdump and other utility functions, and the tracing macros:
typedef struct
{ int minMsgLevel;
int maxMsgLevel;
} MSG_LEVEL;
#define ELA_MAX_ERROR_MESSAGE 1024
#define ELA_HEX_ADDRESS_ABSOLUTE 0x00000000
#define ELA_HEX_ADDRESS_OFFSET 0x00000001
The following typedef is used by the message catalogue functions:
typedef long ADK_CAT_HANDLE;
The following #define(s) and typedef(s) are used in the ADK functions to support FML32 Field Maps in the configuration files:
#define ADK_ERROR_NO_FIELDS |
8 |
#define ADK_ERROR_LAST_FIELD |
9 |
#define FM_AN_MAX |
256 |
#define FM_FN_MAX |
32 |
#define FM_IO_MAX |
16 |
#define FM_FD_MAX |
16 |
typedef struct
{ char ApplicationName[FM_AN_MAX];
char FML32FieldName[FM_FN_MAX];
char InputOutput[FM_IO_MAX];
char FieldDesignator[FM_FD_MAX];
} FIELDMAP;
![]() |
![]() |
![]() |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|