struct msghdr with a known type, fixed-size I/O and control buffers More...

#include <TypedMsgHdr.h>

Inheritance diagram for Ipc::TypedMsgHdr:
Collaboration diagram for Ipc::TypedMsgHdr:

Classes

struct  CtrlBuffer
 
struct  DataBuffer
 

Public Types

enum  { maxSize = 4096 }
 

Public Member Functions

 TypedMsgHdr ()
 
 TypedMsgHdr (const TypedMsgHdr &tmh)
 
TypedMsgHdroperator= (const TypedMsgHdr &tmh)
 
void address (const struct sockaddr_un &addr)
 sets [dest.] address More...
 
void setType (int aType)
 sets message type; use MessageType enum More...
 
void checkType (int aType) const
 throws if stored type is not aType More...
 
int type () const
 returns stored type or zero if none More...
 
template<class Pod >
void getPod (Pod &pod) const
 load POD More...
 
template<class Pod >
void putPod (const Pod &pod)
 store POD More...
 
void getString (String &s) const
 load variable-length string More...
 
void putString (const String &s)
 store variable-length string More...
 
int getInt () const
 load an integer More...
 
void putInt (int n)
 store an integer More...
 
void getFixed (void *raw, size_t size) const
 always load size bytes More...
 
void putFixed (const void *raw, size_t size)
 always store size bytes More...
 
bool hasMoreData () const
 returns true if there is data to extract; handy for optional parts More...
 
void putFd (int aFd)
 stores descriptor More...
 
int getFd () const
 returns stored descriptor More...
 
bool hasFd () const
 whether the message has a descriptor stored More...
 
void prepForReading ()
 reset and provide all buffers More...
 
char * raw ()
 
const char * raw () const
 
size_t size () const
 not true message size More...
 

Public Attributes

void * msg_name
 
socklen_t msg_namelen
 
struct iovecmsg_iov
 
size_t msg_iovlen
 
void * msg_control
 
size_t msg_controllen
 
int msg_flags
 

Private Member Functions

void sync ()
 
void allocData ()
 initialize io vector with one io record More...
 
void allocName ()
 
void allocControl ()
 
void getRaw (void *raw, size_t size) const
 low-level loading of exactly size bytes of raw data More...
 
void putRaw (const void *raw, size_t size)
 low-level storage of exactly size bytes of raw data More...
 

Private Attributes

struct sockaddr_un name
 same as .msg_name More...
 
struct iovec ios [1]
 same as .msg_iov[] More...
 
struct Ipc::TypedMsgHdr::DataBuffer data
 same as .msg_iov[0].iov_base More...
 
struct Ipc::TypedMsgHdr::CtrlBuffer ctrl
 same as .msg_control More...
 
unsigned int offset
 data offset for the next get/put*() to start with More...
 

Detailed Description

Definition at line 31 of file TypedMsgHdr.h.

Member Enumeration Documentation

anonymous enum
Enumerator
maxSize 

Definition at line 34 of file TypedMsgHdr.h.

Constructor & Destructor Documentation

Ipc::TypedMsgHdr::TypedMsgHdr ( )

Definition at line 19 of file TypedMsgHdr.cc.

References sync().

Ipc::TypedMsgHdr::TypedMsgHdr ( const TypedMsgHdr tmh)

Definition at line 25 of file TypedMsgHdr.cc.

Member Function Documentation

void Ipc::TypedMsgHdr::address ( const struct sockaddr_un addr)

Definition at line 75 of file TypedMsgHdr.cc.

References addr, and SUN_LEN.

Referenced by Ipc::UdsSender::UdsSender().

void Ipc::TypedMsgHdr::allocControl ( )
private

Definition at line 254 of file TypedMsgHdr.cc.

References Must.

void Ipc::TypedMsgHdr::allocData ( )
private

Definition at line 234 of file TypedMsgHdr.cc.

References data, and Must.

void Ipc::TypedMsgHdr::allocName ( )
private

Definition at line 246 of file TypedMsgHdr.cc.

References Must.

void Ipc::TypedMsgHdr::getFixed ( void *  raw,
size_t  size 
) const
void Ipc::TypedMsgHdr::getRaw ( void *  raw,
size_t  size 
) const
private

Definition at line 156 of file TypedMsgHdr.cc.

References data, and Must.

bool Ipc::TypedMsgHdr::hasFd ( ) const

Definition at line 177 of file TypedMsgHdr.cc.

References CMSG_FIRSTHDR, cmsghdr::cmsg_level, cmsghdr::cmsg_type, and SCM_RIGHTS.

Referenced by Snmp::Request::Request().

bool Ipc::TypedMsgHdr::hasMoreData ( ) const
inline

Definition at line 63 of file TypedMsgHdr.h.

References data, offset, and Ipc::TypedMsgHdr::DataBuffer::size.

Referenced by Mgr::Response::Response().

Ipc::TypedMsgHdr & Ipc::TypedMsgHdr::operator= ( const TypedMsgHdr tmh)

Definition at line 31 of file TypedMsgHdr.cc.

void Ipc::TypedMsgHdr::prepForReading ( )

Definition at line 224 of file TypedMsgHdr.cc.

void Ipc::TypedMsgHdr::putFixed ( const void *  raw,
size_t  size 
)

Definition at line 148 of file TypedMsgHdr.cc.

Referenced by Snmp::Session::pack(), Snmp::Pdu::pack(), Snmp::Var::pack(), and putPod().

void Ipc::TypedMsgHdr::putRaw ( const void *  raw,
size_t  size 
)
private

Definition at line 167 of file TypedMsgHdr.cc.

References data, and Must.

char* Ipc::TypedMsgHdr::raw ( )
inline

Definition at line 72 of file TypedMsgHdr.h.

const char* Ipc::TypedMsgHdr::raw ( ) const
inline

Definition at line 73 of file TypedMsgHdr.h.

size_t Ipc::TypedMsgHdr::size ( ) const
inline

Definition at line 74 of file TypedMsgHdr.h.

void Ipc::TypedMsgHdr::sync ( void  )
private

Definition at line 41 of file TypedMsgHdr.cc.

References data, and Must.

Referenced by TypedMsgHdr().

int Ipc::TypedMsgHdr::type ( ) const

Definition at line 68 of file TypedMsgHdr.cc.

References data, and Must.

Referenced by Ipc::Strand::receive(), and Ipc::Coordinator::receive().

Member Data Documentation

struct Ipc::TypedMsgHdr::CtrlBuffer Ipc::TypedMsgHdr::ctrl
private
struct Ipc::TypedMsgHdr::DataBuffer Ipc::TypedMsgHdr::data
private

Referenced by hasMoreData().

struct iovec Ipc::TypedMsgHdr::ios[1]
private

Definition at line 89 of file TypedMsgHdr.h.

void* msghdr::msg_control
inherited

Definition at line 95 of file cmsg.h.

size_t msghdr::msg_controllen
inherited

Definition at line 96 of file cmsg.h.

int msghdr::msg_flags
inherited

Definition at line 101 of file cmsg.h.

struct iovec* msghdr::msg_iov
inherited

Definition at line 92 of file cmsg.h.

size_t msghdr::msg_iovlen
inherited

Definition at line 93 of file cmsg.h.

void* msghdr::msg_name
inherited

Definition at line 89 of file cmsg.h.

socklen_t msghdr::msg_namelen
inherited

Definition at line 90 of file cmsg.h.

struct sockaddr_un Ipc::TypedMsgHdr::name
private

Definition at line 87 of file TypedMsgHdr.h.

unsigned int Ipc::TypedMsgHdr::offset
mutableprivate

Definition at line 103 of file TypedMsgHdr.h.

Referenced by hasMoreData().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors