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 | 
| 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(), Snmp::Response::Response(), Mgr::Response::Response(), Ipc::SharedListenRequest::SharedListenRequest(), Ipc::SharedListenResponse::SharedListenResponse(), Ipc::StrandSearchRequest::StrandSearchRequest(), SBufStatsAction::unpack(), Mgr::StoreIoAction::unpack(), Mgr::IoAction::unpack(), Mgr::ServiceTimesAction::unpack(), DiskdAction::unpack(), Mgr::CountersAction::unpack(), Mgr::InfoAction::unpack(), and Mgr::IntervalAction::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::Session::unpack(), Snmp::Pdu::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(), Snmp::Session::unpack(), Snmp::Pdu::unpack(), Mgr::QueryParams::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(), Snmp::Response::Response(), Mgr::Response::Response(), Ipc::SharedListenRequest::SharedListenRequest(), Ipc::SharedListenResponse::SharedListenResponse(), Ipc::StrandSearchRequest::StrandSearchRequest(), Ipc::StrandCoord::unpack(), Snmp::Session::unpack(), Ipc::QuestionerId::unpack(), Snmp::Pdu::unpack(), SBufStatsAction::unpack(), Mgr::QueryParams::unpack(), Snmp::Var::unpack(), Mgr::StoreIoAction::unpack(), Mgr::IoAction::unpack(), Mgr::ServiceTimesAction::unpack(), DiskdAction::unpack(), Mgr::CountersAction::unpack(), Mgr::InfoAction::unpack(), and Mgr::IntervalAction::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(), Ipc::StrandCoord::unpack(), Mgr::QueryParams::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::Session::pack(), Snmp::Pdu::pack(), and Snmp::Var::pack().
◆ putInt()
| void Ipc::TypedMsgHdr::putInt | ( | int | n | ) | 
Definition at line 119 of file TypedMsgHdr.cc.
Referenced by CollapsedForwarding::Notify(), IpcIoFile::Notify(), Mgr::IntParam::pack(), Snmp::Session::pack(), Snmp::Pdu::pack(), Mgr::QueryParams::pack(), and Snmp::Var::pack().
◆ putPod()
| void Ipc::TypedMsgHdr::putPod | ( | const Pod & | pod | ) | 
Definition at line 126 of file TypedMsgHdr.h.
Referenced by Ipc::StrandSearchRequest::pack(), Mgr::IntParam::pack(), Mgr::StringParam::pack(), Ipc::StrandCoord::pack(), Ipc::QuestionerId::pack(), Snmp::Response::pack(), Mgr::ActionParams::pack(), Snmp::Session::pack(), Mgr::Request::pack(), Snmp::Request::pack(), Mgr::Response::pack(), Snmp::Pdu::pack(), SBufStatsAction::pack(), Snmp::Var::pack(), Mgr::StoreIoAction::pack(), Mgr::IoAction::pack(), Ipc::SharedListenRequest::pack(), Mgr::ServiceTimesAction::pack(), DiskdAction::pack(), Ipc::SharedListenResponse::pack(), Mgr::CountersAction::pack(), Mgr::InfoAction::pack(), and Mgr::IntervalAction::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 Ipc::StrandSearchRequest::pack(), Ipc::StrandCoord::pack(), Mgr::StringParam::pack(), Mgr::ActionParams::pack(), Mgr::Response::pack(), and Mgr::QueryParams::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.
Referenced by Ipc::Strand::receive(), Ipc::Port::receive(), Ipc::Coordinator::receive(), and Ipc::Port::receiveOrIgnore().
◆ setType()
| void Ipc::TypedMsgHdr::setType | ( | int | aType | ) | 
Definition at line 100 of file TypedMsgHdr.cc.
References Must.
Referenced by CollapsedForwarding::Notify(), IpcIoFile::Notify(), Ipc::StrandSearchRequest::pack(), Snmp::Response::pack(), Mgr::Request::pack(), Snmp::Request::pack(), Mgr::Response::pack(), SBufStatsAction::pack(), Mgr::StoreIoAction::pack(), Ipc::StrandMessage::pack(), Mgr::IoAction::pack(), Ipc::SharedListenRequest::pack(), Mgr::ServiceTimesAction::pack(), DiskdAction::pack(), Ipc::SharedListenResponse::pack(), Mgr::CountersAction::pack(), Mgr::InfoAction::pack(), and Mgr::IntervalAction::pack().
◆ sync()
| 
 | private | 
Member Data Documentation
◆ ctrl
| 
 | private | 
Referenced by operator=().
◆ data
| 
 | private | 
Referenced by hasMoreData(), and operator=().
◆ ios
| 
 | private | 
Definition at line 93 of file TypedMsgHdr.h.
Referenced by operator=().
◆ msg_control
◆ msg_controllen
◆ msg_flags
◆ msg_iov
◆ 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
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products
