]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/net/netsrc.h
xnu-6153.121.1.tar.gz
[apple/xnu.git] / bsd / net / netsrc.h
index 13fcd456bb3b41f70e54636fcf89cb60d214fbba..6372a523d64da0a0b3d90c8ba422c6ff0f157b62 100644 (file)
 
 #ifndef __NET_NETSRC_H__
 
-#define        NETSRC_CTLNAME  "com.apple.netsrc"
+#include <netinet/in.h>
 
-#define        NETSRC_VERSION1 1
-#define        NETSRC_CURVERS  NETSRC_VERSION1
+#define NETSRC_CTLNAME  "com.apple.netsrc"
+
+#define NETSRC_VERSION1 1
+#define NETSRC_VERSION2 2
+#define NETSRC_CURVERS  NETSRC_VERSION2
 
 struct netsrc_req {
        unsigned int nrq_ver;
        unsigned int nrq_ifscope;
        union {
-               struct sockaddr_in  _usin;
-               struct sockaddr_in6 _usin6;
-       } _usa;
+               union sockaddr_in_4_6 nrq_dst;
+               union sockaddr_in_4_6 _usa;
+       };
 };
 
-#define        nrq_sin         _usa._usin
-#define        nrq_sin6        _usa._usin6
+#define nrq_sin         _usa.sin
+#define nrq_sin6        _usa.sin6
 
-struct netsrc_rep {
+struct netsrc_repv1 {
        union {
-               struct sockaddr_in  _usin;
-               struct sockaddr_in6 _usin6;
-       } _usa;
-#define        NETSRC_IP6_FLAG_TENTATIVE       0x0001
-#define        NETSRC_IP6_FLAG_TEMPORARY       0x0002
-#define        NETSRC_IP6_FLAG_DEPRECATED      0x0004
-#define        NETSRC_IP6_FLAG_OPTIMISTIC      0x0008
-#define        NETSRC_IP6_FLAG_SECURED         0x0010
+               union sockaddr_in_4_6 nrp_src;
+               union sockaddr_in_4_6 _usa;
+       };
+#define NETSRC_IP6_FLAG_TENTATIVE       0x0001
+#define NETSRC_IP6_FLAG_TEMPORARY       0x0002
+#define NETSRC_IP6_FLAG_DEPRECATED      0x0004
+#define NETSRC_IP6_FLAG_OPTIMISTIC      0x0008
+#define NETSRC_IP6_FLAG_SECURED         0x0010
        uint16_t nrp_flags;
        uint16_t nrp_label;
        uint16_t nrp_precedence;
        uint16_t nrp_dstlabel;
        uint16_t nrp_dstprecedence;
+       uint16_t nrp_unused;    // Padding
 };
 
-#define        nrp_sin         _usa._usin
-#define        nrp_sin6        _usa._usin6
+struct netsrc_repv2 {
+       union {
+               union sockaddr_in_4_6 nrp_src;
+               union sockaddr_in_4_6 _usa;
+       };
+       uint32_t nrp_min_rtt;
+       uint32_t nrp_connection_attempts;
+       uint32_t nrp_connection_successes;
+       // Continues from above, fixes naming
+#define NETSRC_FLAG_IP6_TENTATIVE       NETSRC_IP6_FLAG_TENTATIVE
+#define NETSRC_FLAG_IP6_TEMPORARY       NETSRC_IP6_FLAG_TEMPORARY
+#define NETSRC_FLAG_IP6_DEPRECATED      NETSRC_IP6_FLAG_DEPRECATED
+#define NETSRC_FLAG_IP6_OPTIMISTIC      NETSRC_IP6_FLAG_OPTIMISTIC
+#define NETSRC_FLAG_IP6_SECURED         NETSRC_IP6_FLAG_SECURED
+#define NETSRC_FLAG_ROUTEABLE           0x00000020
+#define NETSRC_FLAG_DIRECT                      0x00000040
+#define NETSRC_FLAG_AWDL                        0x00000080
+#define NETSRC_FLAG_IP6_DYNAMIC         0x00000100
+#define NETSRC_FLAG_IP6_AUTOCONF        0x00000200
+       uint32_t nrp_flags;
+       uint16_t nrp_label;
+       uint16_t nrp_precedence;
+       uint16_t nrp_dstlabel;
+       uint16_t nrp_dstprecedence;
+       uint16_t nrp_ifindex;
+       uint16_t nrp_unused; // Padding
+};
+
+#define netsrc_rep netsrc_repv2
+
+#define nrp_sin         nrp_src.sin
+#define nrp_sin6        nrp_src.sin6
 
 #ifdef KERNEL_PRIVATE
 __private_extern__ void netsrc_init(void);