]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kdp/kdp_udp.h
xnu-344.23.tar.gz
[apple/xnu.git] / osfmk / kdp / kdp_udp.h
index f8db005d46be8e16285a8d90e7201718d259f419..ce34cde0069355cbd8d03b0c0ee5cae51c7e72cb 100644 (file)
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
+/*
+ * Copyright (c) 1982, 1986, 1993
+ *      The Regents of the University of California.  All rights reserved.
+ */
 
+#include <libsa/types.h>
 #include <libkern/OSByteOrder.h>   /* OSSwap functions */
 
 #define     ETHERMTU        1500
@@ -37,6 +42,9 @@ struct ether_addr {
 
 typedef struct ether_addr enet_addr_t;
 
+extern struct ether_addr kdp_get_mac_addr(void);
+unsigned int  kdp_get_ip_address(void);
+
 struct ipovly {
         caddr_t ih_next, ih_prev;       /* for protocol sequence q's */
         u_char  ih_x1;                  /* (unused) */
@@ -118,3 +126,44 @@ typedef struct ether_header ether_header_t;
 
 #define ntohs(x)           OSSwapBigToHostInt16(x)
 #define htons(x)           OSSwapHostToBigInt16(x)
+
+/*
+ * Ethernet Address Resolution Protocol.
+ *
+ * See RFC 826 for protocol description.  Structure below is adapted
+ * to resolving internet addresses.  Field names used correspond to
+ * RFC 826.
+ */
+
+#define ETHERTYPE_ARP          0x0806  /* Addr. resolution protocol */
+
+struct  arphdr {
+  u_short ar_hrd;         /* format of hardware address */
+#define ARPHRD_ETHER    1       /* ethernet hardware format */
+#define ARPHRD_FRELAY   15      /* frame relay hardware format */
+  u_short ar_pro;         /* format of protocol address */
+  u_char  ar_hln;         /* length of hardware address */
+  u_char  ar_pln;         /* length of protocol address */
+  u_short ar_op;          /* one of: */
+#define ARPOP_REQUEST   1       /* request to resolve address */
+#define ARPOP_REPLY     2       /* response to previous request */
+#define ARPOP_REVREQUEST 3      /* request protocol address given hardware */
+#define ARPOP_REVREPLY  4       /* response giving protocol address */
+#define ARPOP_INVREQUEST 8      /* request to identify peer */
+#define ARPOP_INVREPLY  9       /* response identifying peer */
+};
+
+#define ETHER_ADDR_LEN 6
+
+struct  ether_arp {
+  struct  arphdr ea_hdr;  /* fixed-size header */
+  u_char  arp_sha[ETHER_ADDR_LEN];        /* sender hardware address */
+  u_char  arp_spa[4];     /* sender protocol address */
+  u_char  arp_tha[ETHER_ADDR_LEN];        /* target hardware address */
+  u_char  arp_tpa[4];     /* target protocol address */
+};
+#define arp_hrd ea_hdr.ar_hrd
+#define arp_pro ea_hdr.ar_pro
+#define arp_hln ea_hdr.ar_hln
+#define arp_pln ea_hdr.ar_pln
+#define arp_op  ea_hdr.ar_op