48 if (community_len > 0) {
49 Must(community !=
nullptr);
61 if (community_len > 0) {
62 Must(community !=
nullptr);
63 msg.
putFixed(community, community_len);
67 int len = peername !=
nullptr ? strlen(peername) : 0;
80 community_len = msg.
getInt();
81 if (community_len > 0) {
82 community =
static_cast<u_char*
>(
xmalloc(community_len + 1));
83 Must(community !=
nullptr);
84 msg.
getFixed(community, community_len);
85 community[community_len] = 0;
91 peername =
static_cast<char*
>(
xmalloc(len + 1));
92 Must(peername !=
nullptr);
struct msghdr with a known type, fixed-size I/O and control buffers
void getFixed(void *raw, size_t size) const
always load size bytes
void putInt(int n)
store an integer
void getPod(Pod &pod) const
load POD
void putFixed(const void *raw, size_t size)
always store size bytes
void putPod(const Pod &pod)
store POD
int getInt() const
load an integer
snmp_session wrapper add pack/unpack feature
void reset()
free internal members
void pack(Ipc::TypedMsgHdr &msg) const
prepare for sendmsg()
Session & operator=(const Session &session)
void unpack(const Ipc::TypedMsgHdr &msg)
restore struct from the message