Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

BinPAC::DCE_RPC_Body Class Reference

#include <dce_rpc_pac.h>

Collaboration diagram for BinPAC::DCE_RPC_Body:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DCE_RPC_Body (DCE_RPC_Header *arg_header, int arg_length)
 ~DCE_RPC_Body ()
int parse (const uint8 *const t_begin_of_data, const uint8 *const t_end_of_data, int t_byteorder)
DCE_RPC_Header *const  header () const
int const  length () const
int val_case_index () const
DCE_RPC_Bind *const & bind () const
DCE_RPC_Request *const & request () const
DCE_RPC_Response *const & response () const
array< uint8 > const & other () const

Protected Attributes

DCE_RPC_Headerheader_
int length_
int val_case_index_
union {
   DCE_RPC_Bind *   bind_
   DCE_RPC_Request *   request_
   DCE_RPC_Response *   response_
   array< uint8 >   other_
val_

Constructor & Destructor Documentation

BinPAC::DCE_RPC_Body::DCE_RPC_Body DCE_RPC_Header arg_header,
int  arg_length
 

Definition at line 546 of file dce_rpc_pac.cc.

References header_, length_, and val_case_index_.

00547         {
00548         header_ = arg_header;
00549         length_ = arg_length;
00550         val_case_index_ = -1;
00551         }

BinPAC::DCE_RPC_Body::~DCE_RPC_Body  ) 
 

Definition at line 553 of file dce_rpc_pac.cc.

References BinPAC::delete_array(), val_, and val_case_index().

00554         {
00555         switch ( val_case_index() )
00556                 {
00557                 case 11:
00558                         // Clean up "bind"
00559                         {
00560                         delete val_.bind_;
00561                         }
00562                         break;
00563                 case 0:
00564                         // Clean up "request"
00565                         {
00566                         delete val_.request_;
00567                         }
00568                         break;
00569                 case 2:
00570                         // Clean up "response"
00571                         {
00572                         delete val_.response_;
00573                         }
00574                         break;
00575                 default:
00576                         // Clean up "other"
00577                         {
00578                         delete_array(val_.other_);
00579                         }
00580                         break;
00581                 }
00582         }


Member Function Documentation

DCE_RPC_Bind* const& BinPAC::DCE_RPC_Body::bind  )  const [inline]
 

Definition at line 285 of file dce_rpc_pac.h.

References val_, and val_case_index().

00286                 {
00287                 if ( val_case_index() == 11 )
00288                         return val_.bind_;
00289                 else
00290                         throw ExceptionInvalidCase("./dce_rpc.pac:108:bind", val_case_index(), 11);
00291                 }

DCE_RPC_Header* const BinPAC::DCE_RPC_Body::header  )  const [inline]
 

Definition at line 282 of file dce_rpc_pac.h.

References header_.

Referenced by parse().

00282 { return header_; };

int const BinPAC::DCE_RPC_Body::length  )  const [inline]
 

Definition at line 283 of file dce_rpc_pac.h.

References length_.

Referenced by parse().

00283 { return length_; };

array<uint8> const& BinPAC::DCE_RPC_Body::other  )  const [inline]
 

Definition at line 306 of file dce_rpc_pac.h.

References val_.

00307                 {
00308                 return val_.other_;
00309                 }

int BinPAC::DCE_RPC_Body::parse const uint8 *const  t_begin_of_data,
const uint8 *const  t_end_of_data,
int  t_byteorder
 

Definition at line 584 of file dce_rpc_pac.cc.

References header(), length(), BinPAC::DCE_RPC_Header::PTYPE(), BinPAC::uint8, val_, val_case_index(), and val_case_index_.

Referenced by BinPAC::DCE_RPC_PDU::parse().

00585         {
00586         int t_val__size;
00587         val_case_index_ = header()->PTYPE();
00588         switch ( val_case_index() )
00589                 {
00590                 case 11:
00591                         // Parse "bind"
00592                         {
00593                         val_.bind_ = new DCE_RPC_Bind();
00594                         int t_bind__size = 
00595                                 val_.bind_->parse(t_begin_of_data, t_end_of_data, t_byteorder);
00596                         t_val__size = t_bind__size;
00597                         }
00598                         break;
00599                 case 0:
00600                         // Parse "request"
00601                         {
00602                         val_.request_ = new DCE_RPC_Request(length());
00603                         int t_request__size = 
00604                                 val_.request_->parse(t_begin_of_data, t_end_of_data, t_byteorder);
00605                         t_val__size = t_request__size;
00606                         }
00607                         break;
00608                 case 2:
00609                         // Parse "response"
00610                         {
00611                         val_.response_ = new DCE_RPC_Response(length());
00612                         int t_response__size = 
00613                                 val_.response_->parse(t_begin_of_data, t_end_of_data, t_byteorder);
00614                         t_val__size = t_response__size;
00615                         }
00616                         break;
00617                 default:
00618                         // Parse "other"
00619                         {
00620                         int t_other__arraylength = length();
00621                         int t_other__size = 1 * t_other__arraylength;
00622                         // Checking out-of-bound for "DCE_RPC_Body:other"
00623                         if ( t_begin_of_data + (t_other__size) > t_end_of_data )
00624                                 {
00625                                 // Handle out-of-bound condition
00626                                 throw ExceptionOutOfBound("DCE_RPC_Body:other",
00627                                         (0) + (t_other__size), 
00628                                         (t_end_of_data) - (t_begin_of_data));
00629                                 }
00630                         make_array<uint8>(val_.other_, t_other__arraylength);
00631                         const uint8* t_other__elem__data = t_begin_of_data;
00632                         for ( int t_other__elem__it = 0; 
00633                                 t_other__elem__it < t_other__arraylength; 
00634                                 ++t_other__elem__it )
00635                                 {
00636                                 uint8 t_other__elem;
00637                                 t_other__elem = *((uint8 *) (t_other__elem__data));
00638                                 val_.other_.v[t_other__elem__it] = t_other__elem;
00639                                 t_other__elem__data += 1;
00640                                 }
00641                         t_val__size = t_other__size;
00642                         }
00643                         break;
00644                 }
00645         return t_val__size;
00646         }

DCE_RPC_Request* const& BinPAC::DCE_RPC_Body::request  )  const [inline]
 

Definition at line 292 of file dce_rpc_pac.h.

References val_, and val_case_index().

00293                 {
00294                 if ( val_case_index() == 0 )
00295                         return val_.request_;
00296                 else
00297                         throw ExceptionInvalidCase("./dce_rpc.pac:109:request", val_case_index(), 0);
00298                 }

DCE_RPC_Response* const& BinPAC::DCE_RPC_Body::response  )  const [inline]
 

Definition at line 299 of file dce_rpc_pac.h.

References val_, and val_case_index().

00300                 {
00301                 if ( val_case_index() == 2 )
00302                         return val_.response_;
00303                 else
00304                         throw ExceptionInvalidCase("./dce_rpc.pac:110:response", val_case_index(), 2);
00305                 }

int BinPAC::DCE_RPC_Body::val_case_index  )  const [inline]
 

Definition at line 284 of file dce_rpc_pac.h.

References val_case_index_.

Referenced by bind(), parse(), request(), response(), and ~DCE_RPC_Body().

00284 { return val_case_index_; }


Member Data Documentation

DCE_RPC_Bind* BinPAC::DCE_RPC_Body::bind_ [protected]
 

Definition at line 316 of file dce_rpc_pac.h.

DCE_RPC_Header* BinPAC::DCE_RPC_Body::header_ [protected]
 

Definition at line 312 of file dce_rpc_pac.h.

Referenced by DCE_RPC_Body(), and header().

int BinPAC::DCE_RPC_Body::length_ [protected]
 

Definition at line 313 of file dce_rpc_pac.h.

Referenced by DCE_RPC_Body(), and length().

array<uint8> BinPAC::DCE_RPC_Body::other_ [protected]
 

Definition at line 319 of file dce_rpc_pac.h.

DCE_RPC_Request* BinPAC::DCE_RPC_Body::request_ [protected]
 

Definition at line 317 of file dce_rpc_pac.h.

DCE_RPC_Response* BinPAC::DCE_RPC_Body::response_ [protected]
 

Definition at line 318 of file dce_rpc_pac.h.

union { ... } BinPAC::DCE_RPC_Body::val_ [protected]
 

Referenced by bind(), other(), parse(), request(), response(), and ~DCE_RPC_Body().

int BinPAC::DCE_RPC_Body::val_case_index_ [protected]
 

Definition at line 314 of file dce_rpc_pac.h.

Referenced by DCE_RPC_Body(), parse(), and val_case_index().


The documentation for this class was generated from the following files:
Generated on Wed Sep 14 03:16:11 2005 for bro_docs by doxygen 1.3.5