36 memcpy(&ios, &tmh.
ios,
sizeof(ios));
50 memset(&name, 0,
sizeof(name));
51 memset(&ios, 0,
sizeof(ios));
63 Must(!msg_namelen && !msg_name);
67 Must(msg_iovlen == 1);
69 ios[0].iov_base = &data;
70 Must(ios[0].iov_len ==
sizeof(data));
72 Must(!msg_iovlen && !msg_iov);
76 Must(msg_controllen > 0);
79 Must(!msg_controllen && !msg_control);
96 Must(rawType() == destType);
103 Must(data.type_ == aType);
127 const int length = getInt();
135 Must(length <= maxSize);
138 getRaw(&buf, length);
154 getRaw(rawBuf, rawSize);
161 putRaw(rawBuf, rawSize);
169 Must(rawSize <= data.size - offset);
170 memcpy(rawBuf, data.raw + offset, rawSize);
180 Must(rawSize <=
sizeof(data.raw) - data.size);
181 memcpy(data.raw + data.size, rawBuf, rawSize);
182 data.size += rawSize;
202 const int fdCount = 1;
210 memcpy(fdStore, &fd, fdCount *
sizeof(
int));
219 Must(msg_control && msg_controllen);
226 const int fdCount = 1;
227 const int *fdStore =
reinterpret_cast<const int*
>(
SQUID_CMSG_DATA(cmsg));
229 memcpy(&fd, fdStore, fdCount *
sizeof(
int));
248 Must(!msg_iovlen && !msg_iov);
251 ios[0].iov_base = &data;
252 ios[0].iov_len =
sizeof(data);
260 Must(!msg_name && !msg_namelen);
262 msg_namelen =
sizeof(name);
268 Must(!msg_control && !msg_controllen);
270 msg_controllen =
sizeof(ctrl);
struct msghdr with a known type, fixed-size I/O and control buffers
struct Ipc::TypedMsgHdr::CtrlBuffer ctrl
same as .msg_control
void getRaw(void *raw, size_t size) const
low-level loading of exactly size bytes of raw data
int getFd() const
returns stored descriptor
unsigned int offset
data offset for the next get/put*() to start with
void putRaw(const void *raw, size_t size)
low-level storage of exactly size bytes of raw data
void putString(const String &s)
store variable-length string
TypedMsgHdr & operator=(const TypedMsgHdr &tmh)
void putFd(int aFd)
stores descriptor
void getFixed(void *raw, size_t size) const
always load size bytes
struct Ipc::TypedMsgHdr::DataBuffer data
same as .msg_iov[0].iov_base
void putInt(int n)
store an integer
void getString(String &s) const
load variable-length string
bool hasFd() const
whether the message has a descriptor stored
struct iovec ios[1]
same as .msg_iov[]
struct sockaddr_un name
same as .msg_name
void allocData()
initialize io vector with one io record
void checkType(int aType) const
void putFixed(const void *raw, size_t size)
always store size bytes
void prepForReading()
reset and provide all buffers
void setType(int aType)
sets message type; use MessageType enum
int getInt() const
load an integer
void address(const struct sockaddr_un &addr)
sets [dest.] address
void assign(const char *str, int len)
char const * rawBuf() const
#define CMSG_FIRSTHDR(mhdr)
#define SQUID_CMSG_DATA(cmsg)