-/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
? sun_len - offsetof(struct sockaddr_un, sun_path)
: 0);
}
+
+uint32_t
+guess_netmask(uint32_t ip)
+{
+ ip = ntohl(ip);
+ return ((ip >> 31) == 0 ? htonl(0xff000000) /* Class A */
+ : (ip >> 30) == 2 ? htonl(0xffff0000) /* Class B */
+ : (ip >> 29) == 6 ? htonl(0xffffff00) /* Class C */
+ : htonl(0)); /* ??? */
+}
-/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
int make_unix_socket(int style, bool nonblock, bool passcred,
const char *bind_path, const char *connect_path);
int get_unix_name_len(socklen_t sun_len);
+uint32_t guess_netmask(uint32_t ip);
#endif /* socket-util.h */