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
|
// $Id$
// ============================================================================
//
// = LIBRARY
// TAO/utils/IOR-parser
//
// = FILENAME
// ior-handler.h
//
// = DESCRIPTION
// Provides the definition of a class that parses real (valid) IORs.
//
// = AUTHORS
// Priya Narasimhan <priya@lambda.ece.ucsb.edu>
//
// ============================================================================
#ifndef __IORPARSER_H__
#define __IORPARSER_H__
#include "ace/OS.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Basic_Types.h" // To determine BYTE_ORDER
// Maximum length of the stringified IOR, the type_id, and the
// object_key and hostname fields. Tentatively assigned.
#define MAX_IOR_LEN 600
#define MAX_IOR_FIELD_LEN 200
#define MAX_TYPE_ID_LEN 100
#define MAX_OBJ_KEY_LEN 100
#define MAX_HOSTNAME_LEN 64
class IOR
{
// = TITLE
// This is the useful information obtained from parsing an IOR.
//
// = DESCRIPTION
// This structure assumes that the profile_id is
// TAG_INTERNET_IOP and that there is only one TaggedProfile in
// the IOR.
public:
u_long typeIdLen;
// The length of the type_id field of the IOR
char typeId[MAX_TYPE_ID_LEN];
// The string in the type_id field of the IOR
char idlInterface[MAX_TYPE_ID_LEN];
// The IDL interface of the server that published the IOR (can be extracted
// from the type_id field)
u_long profileBodyLen;
// The length of the body of the profile field of the IOR
u_long hostLen;
// The length of the hostname embedded in the IOR
char HostName[MAX_HOSTNAME_LEN];
// The server's hostname embedded in the IOR
u_long portNum;
// The server's port number embedded in the IOR
u_long objectKeyLen;
// The length of the object_key field of the IOR
char objectKey[MAX_OBJ_KEY_LEN];
// The object_key field of the IOR
};
class IorHandler
{
// = TITLE
// This is the class that takes in a real (valid) IOR and
// parses it.
//
// = DESCRIPTION
// This class prints out the useful information in the
// IORs generated by VisiBroker, Orbix and TAO
public:
IorHandler (void);
// Constructor
void interpretIor (char *thisIor, struct IOR *thisIorInfo);
// The main IOR parsing routine
char *getIdlInterface (char *typeId, int *validTypeId);
// Extracts the IDL interface from the type_id field in the IOR
void readIorFromFile (char *filename);
// Reads in the IOR from a specified file
char stringIOR[MAX_IOR_LEN];
// Holds the stringified IOR during parsing
struct IOR parsedIOR;
// Holds the parsed IOR
private:
int hexChar2int (char thisChar);
// Converts a pair of hexadecimal-encoded characters in the stringified
// IOR into their integer value
u_long getOctet8Field (char *readPtr, int *hexCharsRead);
// Interpret the next 8 octets into an unsigned long
u_long getOctet4Field (char *readPtr, int *hexCharsRead);
// Interpret the next 4 octets into an unsigned long
u_long getOctet2Field (char *readPtr, int *hexCharsRead);
// Interpret the next 2 octets into an unsigned long
void skipSpaceIfAny (char *readPtr, int *hexCharsRead);
// Skip the space character encountered while parsing the IOR
void skipNullOctets (char *readPtr, int *hexCharsRead, int expectingStr);
// Skip the null octets encountered while parsing the IOR
int findIfVisiIor (char *readPtr, int *hexCharsRead);
// Finds out if VisiBroker generated this IOR
char getCharacter (char *readPtr, int *offset);
// Extracts a single character from the IOR
char *getString (char *readPtr, int givenLen);
// Extracts a character string of a given length from the IOR
};
#endif /* __IORPARSER_H__ */
|