Add reverse DNS (ip to name) resolution
[vpp.git] / src / vnet / dns / dns.h
index 5da2615..442ef86 100644 (file)
 #include <vnet/dns/dns_packet.h>
 #include <vnet/ip/ip.h>
 
+typedef struct
+{
+  u32 request_type;
+  u32 client_index;
+  u32 client_context;
+} pending_api_request_t;
+
+#define DNS_API_PENDING_NAME_TO_IP 1
+#define DNS_API_PENDING_IP_TO_NAME 2
+
 typedef struct
 {
   /** flags */
@@ -32,6 +42,9 @@ typedef struct
   /** The name in "normal human being" notation, e.g. www.foobar.com */
   u8 *name;
 
+  /** For CNAME records, the "next name" to resolve */
+  u8 *cname;
+
   /** Expiration time */
   f64 expiration_time;
 
@@ -48,14 +61,14 @@ typedef struct
   u8 *dns_response;
 
   /** Clients awaiting responses */
-  u32 *api_clients_to_notify;
-  u32 *api_client_contexts;
+  pending_api_request_t *pending_api_requests;
   ip4_address_t *ip4_peers_to_notify;
   ip6_address_t *ip6_peers_to_notify;
 } dns_cache_entry_t;
 
 #define DNS_CACHE_ENTRY_FLAG_VALID     (1<<0) /**< we have Actual Data */
 #define DNS_CACHE_ENTRY_FLAG_STATIC    (1<<1) /**< static entry */
+#define DNS_CACHE_ENTRY_FLAG_CNAME     (1<<2) /**< CNAME (indirect) entry */
 
 #define DNS_RETRIES_PER_SERVER 3
 
@@ -112,8 +125,9 @@ typedef enum
 } dns46_reply_error_t;
 
 void vnet_send_dns_request (dns_main_t * dm, dns_cache_entry_t * ep);
-int vnet_dns_cname_indirection_nolock (dns_main_t * dm,
-                                      dns_cache_entry_t * ep, u8 * reply);
+int
+vnet_dns_cname_indirection_nolock (dns_main_t * dm, u32 ep_index, u8 * reply);
+
 int vnet_dns_delete_entry_by_index_nolock (dns_main_t * dm, u32 index);
 
 format_function_t format_dns_reply;