]> Chaos Git - corbenik/ctrulib.git/commitdiff
Protocol numbers and sockopt options
authorLectem <lectem@gmail.com>
Thu, 27 Aug 2015 18:24:10 +0000 (14:24 -0400)
committerLectem <lectem@gmail.com>
Tue, 6 Oct 2015 15:13:29 +0000 (11:13 -0400)
Protocol numbers are based on both RFC 1700 p.7 and the Internet Assigned Numbers Authority (IANA) http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

Those are to be used with the added sockopt options. The various options have been
tested with wireshark.

libctru/include/netinet/in.h

index bc8d6f82ee02536f36ecabd22940314336f917d6..5d274b05f333482bea5aa04db9d3428553319ae4 100644 (file)
@@ -3,15 +3,25 @@
 #include <stdint.h>
 #include <sys/socket.h>
 
-#define INADDR_ANY             0x00000000
-#define INADDR_BROADCAST       0xFFFFFFFF
-#define INADDR_NONE            0xFFFFFFFF
+#define INADDR_ANY       0x00000000
+#define INADDR_BROADCAST 0xFFFFFFFF
+#define INADDR_NONE             0xFFFFFFFF
 
 #define INET_ADDRSTRLEN                16
 
-//#define IPPROTO_IP           ???
-//#define IPPROTO_TCP          ???
-//#define IPPROTO_UDP          ???
+/*
+ * Protocols (See RFC 1700 and the IANA)
+ */
+#define IPPROTO_IP          0               /* dummy for IP */
+#define IPPROTO_UDP        17               /* user datagram protocol */
+#define IPPROTO_TCP         6               /* tcp */
+
+#define        IP_TOS              7
+#define        IP_TTL              8
+#define IP_MULTICAST_LOOP   9
+#define        IP_MULTICAST_TTL   10
+#define        IP_ADD_MEMBERSHIP  11
+#define        IP_DROP_MEMBERSHIP 12
 
 typedef uint16_t in_port_t;
 typedef uint32_t in_addr_t;
@@ -26,3 +36,9 @@ struct sockaddr_in {
        struct in_addr  sin_addr;
        unsigned char   sin_zero[8];
 };
+
+/* Request struct for multicast socket ops */
+struct ip_mreq  {
+       struct in_addr imr_multiaddr;   /* IP multicast address of group */
+       struct in_addr imr_interface;   /* local IP address of interface */
+};
\ No newline at end of file