struct msghdr with a known type, fixed-size I/O and control buffers More...
#include <TypedMsgHdr.h>
Classes | |
struct | CtrlBuffer |
struct | DataBuffer |
Public Types | |
enum | { maxSize = 4096 } |
Public Member Functions | |
TypedMsgHdr () | |
TypedMsgHdr (const TypedMsgHdr &tmh) | |
TypedMsgHdr & | operator= (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 |
int | rawType () const |
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 iovec * | msg_iov |
size_t | msg_iovlen |
void * | msg_control |
size_t | msg_controllen |
int | msg_flags |
Private Member Functions | |
void | clear () |
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 = 0 |
data offset for the next get/put*() to start with More... | |
Detailed Description
Definition at line 34 of file TypedMsgHdr.h.
Member Enumeration Documentation
◆ anonymous enum
anonymous enum |
Enumerator | |
---|---|
maxSize |
Definition at line 37 of file TypedMsgHdr.h.
Constructor & Destructor Documentation
◆ TypedMsgHdr() [1/2]
Ipc::TypedMsgHdr::TypedMsgHdr | ( | ) |
Definition at line 19 of file TypedMsgHdr.cc.
◆ TypedMsgHdr() [2/2]
Ipc::TypedMsgHdr::TypedMsgHdr | ( | const TypedMsgHdr & | tmh | ) |
Definition at line 25 of file TypedMsgHdr.cc.
Member Function Documentation
◆ address()
void Ipc::TypedMsgHdr::address | ( | const struct sockaddr_un & | addr | ) |
Definition at line 85 of file TypedMsgHdr.cc.
References SUN_LEN.
Referenced by Ipc::UdsSender::UdsSender().
◆ allocControl()
|
private |
Definition at line 266 of file TypedMsgHdr.cc.
References Must.
◆ allocData()
|
private |
Definition at line 246 of file TypedMsgHdr.cc.
References Must.
◆ allocName()
|
private |
Definition at line 258 of file TypedMsgHdr.cc.
References Must.
◆ checkType()
void Ipc::TypedMsgHdr::checkType | ( | int | aType | ) | const |
throws if stored type is not aType
Definition at line 94 of file TypedMsgHdr.cc.
References Must.
Referenced by Mgr::Request::Request(), Snmp::Request::Request(), Mgr::Response::Response(), Snmp::Response::Response(), Ipc::SharedListenRequest::SharedListenRequest(), Ipc::SharedListenResponse::SharedListenResponse(), Ipc::StrandSearchRequest::StrandSearchRequest(), DiskdAction::unpack(), Mgr::CountersAction::unpack(), Mgr::InfoAction::unpack(), Mgr::IntervalAction::unpack(), Mgr::IoAction::unpack(), Mgr::ServiceTimesAction::unpack(), Mgr::StoreIoAction::unpack(), and SBufStatsAction::unpack().
◆ clear()
|
private |
Definition at line 46 of file TypedMsgHdr.cc.
Referenced by TypedMsgHdr().
◆ getFd()
int Ipc::TypedMsgHdr::getFd | ( | ) | const |
Definition at line 217 of file TypedMsgHdr.cc.
References CMSG_FIRSTHDR, cmsghdr::cmsg_level, cmsghdr::cmsg_type, Must, SCM_RIGHTS, and SQUID_CMSG_DATA.
Referenced by Mgr::Request::Request(), Snmp::Request::Request(), and Ipc::SharedListenResponse::SharedListenResponse().
◆ getFixed()
void Ipc::TypedMsgHdr::getFixed | ( | void * | raw, |
size_t | size | ||
) | const |
Definition at line 151 of file TypedMsgHdr.cc.
Referenced by getPod(), Snmp::Pdu::unpack(), Snmp::Session::unpack(), and Snmp::Var::unpack().
◆ getInt()
int Ipc::TypedMsgHdr::getInt | ( | ) | const |
Definition at line 111 of file TypedMsgHdr.cc.
Referenced by CollapsedForwarding::HandleNotification(), IpcIoFile::HandleNotification(), Mgr::QueryParams::unpack(), Snmp::Pdu::unpack(), Snmp::Session::unpack(), Snmp::Var::unpack(), and Mgr::IntParam::unpackValue().
◆ getPod()
void Ipc::TypedMsgHdr::getPod | ( | Pod & | pod | ) | const |
Definition at line 118 of file TypedMsgHdr.h.
References getFixed().
Referenced by Mgr::ActionParams::ActionParams(), Mgr::Request::Request(), Snmp::Request::Request(), Mgr::Response::Response(), Snmp::Response::Response(), Ipc::SharedListenRequest::SharedListenRequest(), Ipc::SharedListenResponse::SharedListenResponse(), Ipc::StrandSearchRequest::StrandSearchRequest(), DiskdAction::unpack(), Mgr::QueryParams::unpack(), Snmp::Pdu::unpack(), Snmp::Session::unpack(), Snmp::Var::unpack(), Mgr::CountersAction::unpack(), Mgr::InfoAction::unpack(), Mgr::IntervalAction::unpack(), Mgr::IoAction::unpack(), Mgr::ServiceTimesAction::unpack(), Mgr::StoreIoAction::unpack(), SBufStatsAction::unpack(), Ipc::QuestionerId::unpack(), and Ipc::StrandCoord::unpack().
◆ getRaw()
|
private |
Definition at line 166 of file TypedMsgHdr.cc.
References Must.
◆ getString()
void Ipc::TypedMsgHdr::getString | ( | String & | s | ) | const |
Definition at line 125 of file TypedMsgHdr.cc.
References String::assign(), String::clean(), and Must.
Referenced by Mgr::ActionParams::ActionParams(), Mgr::Response::Response(), Ipc::StrandSearchRequest::StrandSearchRequest(), Mgr::QueryParams::unpack(), Ipc::StrandCoord::unpack(), and Mgr::StringParam::unpackValue().
◆ hasFd()
bool Ipc::TypedMsgHdr::hasFd | ( | ) | const |
Definition at line 187 of file TypedMsgHdr.cc.
References CMSG_FIRSTHDR, cmsghdr::cmsg_level, cmsghdr::cmsg_type, and SCM_RIGHTS.
Referenced by Snmp::Request::Request().
◆ hasMoreData()
|
inline |
Definition at line 66 of file TypedMsgHdr.h.
References data, offset, and Ipc::TypedMsgHdr::DataBuffer::size.
Referenced by Mgr::Response::Response().
◆ operator=()
Ipc::TypedMsgHdr & Ipc::TypedMsgHdr::operator= | ( | const TypedMsgHdr & | tmh | ) |
◆ prepForReading()
void Ipc::TypedMsgHdr::prepForReading | ( | ) |
Definition at line 234 of file TypedMsgHdr.cc.
◆ putFd()
void Ipc::TypedMsgHdr::putFd | ( | int | aFd | ) |
Definition at line 196 of file TypedMsgHdr.cc.
References CMSG_FIRSTHDR, cmsghdr::cmsg_len, CMSG_LEN, cmsghdr::cmsg_level, cmsghdr::cmsg_type, Must, SCM_RIGHTS, and SQUID_CMSG_DATA.
Referenced by Mgr::Request::pack(), Snmp::Request::pack(), and Ipc::SharedListenResponse::pack().
◆ putFixed()
void Ipc::TypedMsgHdr::putFixed | ( | const void * | raw, |
size_t | size | ||
) |
Definition at line 158 of file TypedMsgHdr.cc.
Referenced by Snmp::Pdu::pack(), Snmp::Session::pack(), and Snmp::Var::pack().
◆ putInt()
void Ipc::TypedMsgHdr::putInt | ( | int | n | ) |
Definition at line 119 of file TypedMsgHdr.cc.
Referenced by IpcIoFile::Notify(), CollapsedForwarding::Notify(), Mgr::QueryParams::pack(), Snmp::Pdu::pack(), Snmp::Session::pack(), Snmp::Var::pack(), and Mgr::IntParam::pack().
◆ putPod()
void Ipc::TypedMsgHdr::putPod | ( | const Pod & | pod | ) |
Definition at line 126 of file TypedMsgHdr.h.
Referenced by DiskdAction::pack(), Mgr::ActionParams::pack(), Snmp::Pdu::pack(), Snmp::Session::pack(), Snmp::Var::pack(), Mgr::CountersAction::pack(), Mgr::InfoAction::pack(), Mgr::IntervalAction::pack(), Mgr::IntParam::pack(), Mgr::IoAction::pack(), Mgr::Request::pack(), Mgr::Response::pack(), Mgr::ServiceTimesAction::pack(), Mgr::StoreIoAction::pack(), Mgr::StringParam::pack(), SBufStatsAction::pack(), Snmp::Request::pack(), Snmp::Response::pack(), Ipc::QuestionerId::pack(), Ipc::SharedListenRequest::pack(), Ipc::SharedListenResponse::pack(), Ipc::StrandCoord::pack(), and Ipc::StrandSearchRequest::pack().
◆ putRaw()
|
private |
Definition at line 177 of file TypedMsgHdr.cc.
References Must.
◆ putString()
void Ipc::TypedMsgHdr::putString | ( | const String & | s | ) |
Definition at line 143 of file TypedMsgHdr.cc.
References Must, String::psize(), and String::rawBuf().
Referenced by Mgr::ActionParams::pack(), Mgr::QueryParams::pack(), Mgr::Response::pack(), Mgr::StringParam::pack(), Ipc::StrandCoord::pack(), and Ipc::StrandSearchRequest::pack().
◆ raw() [1/2]
|
inline |
Definition at line 75 of file TypedMsgHdr.h.
◆ raw() [2/2]
|
inline |
Definition at line 76 of file TypedMsgHdr.h.
◆ rawType()
|
inline |
received or set message kind; may not be a MessageType value
- Returns
- 0 if no message kind has been received or set
Definition at line 51 of file TypedMsgHdr.h.
References data, msghdr::msg_iov, and Ipc::TypedMsgHdr::DataBuffer::type_.
Referenced by Ipc::Port::receive(), Ipc::Coordinator::receive(), Ipc::Strand::receive(), and Ipc::Port::receiveOrIgnore().
◆ setType()
void Ipc::TypedMsgHdr::setType | ( | int | aType | ) |
Definition at line 100 of file TypedMsgHdr.cc.
References Must.
Referenced by IpcIoFile::Notify(), CollapsedForwarding::Notify(), DiskdAction::pack(), Mgr::CountersAction::pack(), Mgr::InfoAction::pack(), Mgr::IntervalAction::pack(), Mgr::IoAction::pack(), Mgr::Request::pack(), Mgr::Response::pack(), Mgr::ServiceTimesAction::pack(), Mgr::StoreIoAction::pack(), SBufStatsAction::pack(), Snmp::Request::pack(), Snmp::Response::pack(), Ipc::StrandMessage::pack(), Ipc::SharedListenRequest::pack(), Ipc::SharedListenResponse::pack(), and Ipc::StrandSearchRequest::pack().
◆ size()
|
inline |
Definition at line 77 of file TypedMsgHdr.h.
◆ sync()
|
private |
Member Data Documentation
◆ ctrl
|
private |
Referenced by operator=().
◆ data
|
private |
Referenced by hasMoreData(), operator=(), and rawType().
◆ ios
|
private |
Definition at line 93 of file TypedMsgHdr.h.
Referenced by operator=().
◆ msg_control
◆ msg_controllen
◆ msg_flags
◆ msg_iov
|
inherited |
◆ msg_iovlen
◆ msg_name
◆ msg_namelen
◆ name
|
private |
Definition at line 91 of file TypedMsgHdr.h.
Referenced by operator=().
◆ offset
|
mutableprivate |
Definition at line 111 of file TypedMsgHdr.h.
Referenced by hasMoreData(), and operator=().
The documentation for this class was generated from the following files:
- src/ipc/TypedMsgHdr.h
- src/ipc/TypedMsgHdr.cc