CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ConsRegRequestView Class Reference

#include <ConsRegMessage.h>

Public Member Functions

uint32 code () const
 
 ConsRegRequestView (void *buf)
 
std::string getConsumerName ()
 
std::string getRequestParameterSet ()
 
uint32 size () const
 
uint8startAddress ()
 

Private Attributes

uint8buf_
 
std::string consumerName_
 
HeaderView head_
 
std::string requestParameterSet_
 

Detailed Description

Definition at line 36 of file ConsRegMessage.h.

Constructor & Destructor Documentation

ConsRegRequestView::ConsRegRequestView ( void *  buf)

Constructor for the consumer registration request viewer.

Definition at line 62 of file ConsRegMessage.cc.

References buf_, code(), Header::CONS_REG_REQUEST, consumerName_, convert32(), edm::hlt::Exception, requestParameterSet_, and size().

62  :
63  buf_((uint8*)buf),head_(buf)
64 {
65  // verify that the buffer actually contains a registration request
66  if (this->code() != Header::CONS_REG_REQUEST)
67  {
68  throw cms::Exception("MessageDecoding","ConsRegRequestView")
69  << "Invalid consumer registration request message code ("
70  << this->code() << "). Should be " << Header::CONS_REG_REQUEST << "\n";
71  }
72 
73  // update the buffer pointer to just beyond the header
74  uint8* bufPtr = buf_ + sizeof(Header);
75 
76  // determine the consumer name
77  uint32 len = convert32(bufPtr);
78  bufPtr += sizeof(uint32);
79  if (len <= 256) // len >= 0, since len is unsigned
80  {
81  consumerName_.append((char *) bufPtr, len);
82  }
83  bufPtr += len;
84 
85  // determine the request parameter set (maintain backward compatibility
86  // with sources of registration requests that don't have the param set)
87  if (bufPtr < (buf_ + this->size()))
88  {
89  len = convert32(bufPtr);
90  bufPtr += sizeof(uint32);
91  // what is a reasonable limit? This is just to prevent
92  // a bogus, really large value from being used...
93  if (len <= 65000) // len >= 0, since len is unsigned
94  {
95  requestParameterSet_.append((char *) bufPtr, len);
96  }
97  bufPtr += len;
98  assert(bufPtr); // silence clang static analyzer
99  }
100 }
std::string requestParameterSet_
uint32 code() const
unsigned int uint32
Definition: MsgTools.h:13
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
unsigned char uint8
Definition: MsgTools.h:11
uint32 size() const
std::string consumerName_

Member Function Documentation

uint32 ConsRegRequestView::code ( ) const
inline

Definition at line 41 of file ConsRegMessage.h.

References HeaderView::code(), and head_.

Referenced by ConsRegRequestView().

41 { return head_.code(); }
uint32 code() const
Definition: MsgHeader.h:34
std::string ConsRegRequestView::getConsumerName ( )
inline

Definition at line 45 of file ConsRegMessage.h.

References consumerName_.

45 { return consumerName_; }
std::string consumerName_
std::string ConsRegRequestView::getRequestParameterSet ( )
inline

Definition at line 46 of file ConsRegMessage.h.

References requestParameterSet_.

46 { return requestParameterSet_; }
std::string requestParameterSet_
uint32 ConsRegRequestView::size ( void  ) const
inline

Definition at line 42 of file ConsRegMessage.h.

References head_, and HeaderView::size().

Referenced by ConsRegRequestView().

42 { return head_.size(); }
uint32 size() const
Definition: MsgHeader.h:35
uint8* ConsRegRequestView::startAddress ( )
inline

Definition at line 43 of file ConsRegMessage.h.

References buf_.

43 { return buf_; }

Member Data Documentation

uint8* ConsRegRequestView::buf_
private

Definition at line 49 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and startAddress().

std::string ConsRegRequestView::consumerName_
private

Definition at line 51 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and getConsumerName().

HeaderView ConsRegRequestView::head_
private

Definition at line 50 of file ConsRegMessage.h.

Referenced by code(), and size().

std::string ConsRegRequestView::requestParameterSet_
private

Definition at line 52 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and getRequestParameterSet().