00001
00002
00003 #include "tao/GIOP_Message_Generator_Parser.h"
00004 #include "tao/Pluggable_Messaging_Utils.h"
00005 #include "tao/GIOP_Utils.h"
00006 #include "tao/debug.h"
00007 #include "tao/CDR.h"
00008 #include "ace/Log_Msg.h"
00009
00010
00011 ACE_RCSID (tao,
00012 GIOP_Message_Gen_Parser,
00013 "$Id: GIOP_Message_Generator_Parser.cpp 78931 2007-07-18 09:59:36Z johnnyw $")
00014
00015
00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00017
00018 TAO_GIOP_Message_Generator_Parser::~TAO_GIOP_Message_Generator_Parser (void)
00019 {
00020 }
00021
00022 int
00023 TAO_GIOP_Message_Generator_Parser::parse_reply (
00024 TAO_InputCDR &stream,
00025 TAO_Pluggable_Reply_Params ¶ms)
00026 {
00027
00028
00029 if (!stream.read_ulong (params.request_id_))
00030 {
00031 if (TAO_debug_level)
00032 {
00033 ACE_ERROR ((LM_ERROR,
00034 ACE_TEXT ("TAO (%P|%t) : TAO_GIOP_Message_Generator_Parser::parse_reply :")
00035 ACE_TEXT ("extracting request id\n")));
00036 }
00037 return -1;
00038 }
00039
00040
00041
00042
00043 CORBA::ULong rep_stat = 0;
00044 if (!stream.read_ulong (rep_stat))
00045 {
00046 if (TAO_debug_level > 0)
00047 {
00048 ACE_ERROR ((LM_ERROR,
00049 ACE_TEXT ("TAO (%P|%t) : TAO_GIOP_Message_Generator_Parser::parse_reply, ")
00050 ACE_TEXT ("extracting reply status\n")));
00051 }
00052 return -1;
00053 }
00054
00055
00056
00057 switch (rep_stat)
00058 {
00059
00060 case TAO_GIOP_NO_EXCEPTION:
00061 params.reply_status_ =
00062 TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION;
00063 break;
00064
00065
00066 case TAO_GIOP_USER_EXCEPTION:
00067 params.reply_status_ =
00068 TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION;
00069 break;
00070
00071 case TAO_GIOP_SYSTEM_EXCEPTION:
00072 params.reply_status_ =
00073 TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION;
00074 break;
00075
00076 case TAO_GIOP_LOCATION_FORWARD:
00077 params.reply_status_ =
00078 TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD;
00079 break;
00080
00081
00082
00083
00084 case TAO_GIOP_LOCATION_FORWARD_PERM:
00085 params.reply_status_ =
00086 TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM;
00087 break;
00088
00089 case TAO_GIOP_NEEDS_ADDRESSING_MODE:
00090 params.reply_status_ =
00091 TAO_PLUGGABLE_MESSAGE_NEEDS_ADDRESSING_MODE;
00092 break;
00093 default:
00094 if (TAO_debug_level > 0)
00095 {
00096 ACE_ERROR ((LM_ERROR,
00097 ACE_TEXT ("TAO (%P|%t) : TAO_GIOP_Message_Generator_Parser::parse_reply, ")
00098 ACE_TEXT ("Unknown reply status \n")));
00099 }
00100 return -1;
00101 }
00102
00103 return 0;
00104 }
00105
00106
00107 int
00108 TAO_GIOP_Message_Generator_Parser::parse_locate_reply (
00109 TAO_InputCDR &cdr,
00110 TAO_Pluggable_Reply_Params ¶ms)
00111 {
00112
00113 if (!cdr.read_ulong (params.request_id_))
00114 {
00115 if (TAO_debug_level > 0)
00116 ACE_ERROR ((LM_ERROR,
00117 ACE_TEXT ("TAO (%P|%t|%N|%l):parse_locate_reply, ")
00118 ACE_TEXT ("extracting request id\n")));
00119
00120 return -1;
00121 }
00122
00123
00124
00125
00126
00127
00128
00129
00130 if (!cdr.read_ulong (params.reply_status_))
00131 {
00132 if (TAO_debug_level > 0)
00133 ACE_ERROR ((LM_ERROR,
00134 ACE_TEXT ("TAO N|(%P|%t|l) parse_locate_reply, ")
00135 ACE_TEXT ("extracting reply status\n")));
00136
00137 return -1;
00138 }
00139
00140 return 0;
00141
00142 }
00143
00144 bool
00145 TAO_GIOP_Message_Generator_Parser::is_ready_for_bidirectional (void) const
00146 {
00147 return false;
00148 }
00149
00150 void
00151 TAO_GIOP_Message_Generator_Parser::marshal_reply_status (
00152 TAO_OutputCDR &output,
00153 TAO_Pluggable_Reply_Params_Base &reply)
00154 {
00155 switch (reply.reply_status_)
00156 {
00157 case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION:
00158 output.write_ulong (TAO_GIOP_NO_EXCEPTION);
00159 break;
00160 case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
00161 output.write_ulong (TAO_GIOP_LOCATION_FORWARD);
00162 break;
00163 case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION:
00164 output.write_ulong (TAO_GIOP_SYSTEM_EXCEPTION);
00165 break;
00166 case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION:
00167 output.write_ulong (TAO_GIOP_USER_EXCEPTION);
00168 break;
00169 default:
00170
00171 output.write_ulong (reply.reply_status_);
00172 break;
00173 }
00174 }
00175
00176 TAO_END_VERSIONED_NAMESPACE_DECL