summaryrefslogtreecommitdiff
path: root/TAO/tao/GIOP_Utils.h
blob: 7cbb8c1bb71ea6673e27e37334b5254d425ded54 (plain)
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
// -*- C++ -*-

//=============================================================================
/**
 *  @file     GIOP_Utils.h
 *
 *  $Id$
 *
 *   GIOP utility definitions
 *
 *
 *  @author  Chris Cleeland <cleeland@cs.wustl.edu>
 *  @author  Carlos O' Ryan <coryan@uci.edu>
 */
//=============================================================================

#ifndef TAO_GIOP_UTILS_H
#define TAO_GIOP_UTILS_H

#include /**/ "ace/pre.h"

#include "tao/Object.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/IOP_IORC.h"

class ACE_Time_Value;

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_Transport;

/**
 * All GIOP messages include a header and message type.  Not
 * really a message type, but needed to bring that information
 * back somehow.
 */
typedef enum GIOP_Messages
{
  // = GIOP message types.
  TAO_GIOP_REQUEST = 0,                // sent by client.
  TAO_GIOP_REPLY = 1,                  // by server.
  TAO_GIOP_CANCELREQUEST = 2,          // by client.
  TAO_GIOP_LOCATEREQUEST = 3,          // by client.
  TAO_GIOP_LOCATEREPLY = 4,
  TAO_GIOP_CLOSECONNECTION = 5,
  TAO_GIOP_MESSAGERROR = 6,           // by both.
  TAO_GIOP_FRAGMENT = 7                // by both.
}  TAO_GIOP_Message_Type;


typedef enum GIOP_LocateStatusType
{
  TAO_GIOP_UNKNOWN_OBJECT,
  TAO_GIOP_OBJECT_HERE,
  TAO_GIOP_OBJECT_FORWARD,
  TAO_GIOP_OBJECT_FORWARD_PERM,      //GIOP1.2
  TAO_GIOP_LOC_SYSTEM_EXCEPTION,     // GIOP1.2
  TAO_GIOP_LOC_NEEDS_ADDRESSING_MODE //GIOP 1.2
}TAO_GIOP_Locate_Status_Type;

/**
 * @class TAO_GIOP_Locate_Status_Msg
 *
 * @brief Hold the relevant information for every type of Locate mesg.
 *
 * This class is there to hold the relevant info for different
 * types of locate status messages. As on date we dont know much
 * about other mesg types other than OBJECT_FORWARD. This clss can
 * be clearly defined as time progresses.
 */
class TAO_Export TAO_GIOP_Locate_Status_Msg
{
public:
  /// The value will need to be used when the Message type is
  /// TAO_GIOP_OBJECT_FORWARD
  CORBA::Object_var forward_location_var;

  /// Stype of Locate status message
  ///@@ Other mesg types.
  TAO_GIOP_Locate_Status_Type status;
};


typedef enum GIOP_ReplyStatusType
{
  /// Request completed successfully
  TAO_GIOP_NO_EXCEPTION,

  /// Request terminated with user exception
  TAO_GIOP_USER_EXCEPTION,

  /// Request terminated with system exception
  TAO_GIOP_SYSTEM_EXCEPTION,

  /// Reply is a location forward type
  TAO_GIOP_LOCATION_FORWARD,

  /// GIOP 1.2, Reply is a location forward perm type..
  TAO_GIOP_LOCATION_FORWARD_PERM,

  /// GIOP1.2,
  TAO_GIOP_NEEDS_ADDRESSING_MODE

} TAO_GIOP_Reply_Status_Type;


/**
 * @class TAO_GIOP_ReplyHeader
 *
 * @brief This class embodies the header of a GIOP reply.
 * @@Not used. Could be used in future
 */
class TAO_Export TAO_GIOP_ReplyHeader
{
public:
  /// Information
  IOP::ServiceContextList service_info;

  /// Unique identifier of the request for which this is a reply.
  CORBA::ULong request_id;

  /// Status of the reply (see above enum).
  TAO_GIOP_Reply_Status_Type reply_status;
};

/**
 * @class TAO_GIOP_Utils
 *
 * @brief Utility class that has some commonly used methods for both GIOP
 * Base  & GIOP lite
 */
class TAO_Export TAO_GIOP_Utils
{
public:
  static int read_bytes_input (TAO_Transport *transport,
                               TAO_InputCDR &cdr,
                               CORBA::ULong buf_size,
                               ACE_Time_Value *value = 0);

  static ssize_t read_buffer (TAO_Transport *transport,
                              char *buf,
                              size_t len,
                              ACE_Time_Value *max_wait_time = 0);
};

TAO_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"
#endif /*TAO_GIOP_UTILS_H */