Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(268)

Unified Diff: src/process-manager/cmsg.cc

Issue 82061: add several ipv6 sockopt support for ns-3-simu
Patch Set: Created 14 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/process-manager/cmsg.h ('k') | src/process-manager/unix-datagram-socket-fd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/process-manager/cmsg.cc
===================================================================
--- a/src/process-manager/cmsg.cc
+++ b/src/process-manager/cmsg.cc
@@ -28,6 +28,30 @@
m_len -= cmsglen;
}
+
+int
+Cmsg::GetNext(int *level, int *type, int *len, uint8_t **buffer)
+{
+ struct cmsghdr *cm = NULL;
+
+ if (m_len < (int)CMSG_LEN(0))
+ return -1;
+
+ cm = (struct cmsghdr *)m_current;
+ if (cm->cmsg_len == 0 || (int)cm->cmsg_len > m_len)
+ return -(1);
+
+ *level = cm->cmsg_level;
+ *type = cm->cmsg_type;
+ *len = cm->cmsg_len - CMSG_LEN(0);
+ *buffer = CMSG_DATA(cm);
+
+ m_current += CMSG_ALIGN(cm->cmsg_len);
+ m_len -= CMSG_ALIGN(cm->cmsg_len);
+
+ return 0;
+}
+
void
Cmsg::Finish (void)
{
« no previous file with comments | « src/process-manager/cmsg.h ('k') | src/process-manager/unix-datagram-socket-fd.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b