Blame ares_data.h

Packit 514978
Packit 514978
/* Copyright (C) 2009-2013 by Daniel Stenberg
Packit 514978
 *
Packit 514978
 * Permission to use, copy, modify, and distribute this
Packit 514978
 * software and its documentation for any purpose and without
Packit 514978
 * fee is hereby granted, provided that the above copyright
Packit 514978
 * notice appear in all copies and that both that copyright
Packit 514978
 * notice and this permission notice appear in supporting
Packit 514978
 * documentation, and that the name of M.I.T. not be used in
Packit 514978
 * advertising or publicity pertaining to distribution of the
Packit 514978
 * software without specific, written prior permission.
Packit 514978
 * M.I.T. makes no representations about the suitability of
Packit 514978
 * this software for any purpose.  It is provided "as is"
Packit 514978
 * without express or implied warranty.
Packit 514978
 */
Packit 514978
Packit 514978
typedef enum {
Packit 514978
  ARES_DATATYPE_UNKNOWN = 1,  /* unknown data type     - introduced in 1.7.0 */
Packit 514978
  ARES_DATATYPE_SRV_REPLY,    /* struct ares_srv_reply - introduced in 1.7.0 */
Packit 514978
  ARES_DATATYPE_TXT_REPLY,    /* struct ares_txt_reply - introduced in 1.7.0 */
Packit 514978
  ARES_DATATYPE_TXT_EXT,      /* struct ares_txt_ext   - introduced in 1.11.0 */
Packit 514978
  ARES_DATATYPE_ADDR_NODE,    /* struct ares_addr_node - introduced in 1.7.1 */
Packit 514978
  ARES_DATATYPE_MX_REPLY,    /* struct ares_mx_reply   - introduced in 1.7.2 */
Packit 514978
  ARES_DATATYPE_NAPTR_REPLY,/* struct ares_naptr_reply - introduced in 1.7.6 */
Packit 514978
  ARES_DATATYPE_SOA_REPLY,    /* struct ares_soa_reply - introduced in 1.9.0 */
Packit 514978
#if 0
Packit 514978
  ARES_DATATYPE_ADDR6TTL,     /* struct ares_addrttl   */
Packit 514978
  ARES_DATATYPE_ADDRTTL,      /* struct ares_addr6ttl  */
Packit 514978
  ARES_DATATYPE_HOSTENT,      /* struct hostent        */
Packit 514978
  ARES_DATATYPE_OPTIONS,      /* struct ares_options   */
Packit 514978
#endif
Packit 514978
  ARES_DATATYPE_ADDR_PORT_NODE, /* struct ares_addr_port_node - introduced in 1.11.0 */
Packit 514978
  ARES_DATATYPE_LAST          /* not used              - introduced in 1.7.0 */
Packit 514978
} ares_datatype;
Packit 514978
Packit 514978
#define ARES_DATATYPE_MARK 0xbead
Packit 514978
Packit 514978
/*
Packit 514978
 * ares_data struct definition is internal to c-ares and shall not
Packit 514978
 * be exposed by the public API in order to allow future changes
Packit 514978
 * and extensions to it without breaking ABI.  This will be used
Packit 514978
 * internally by c-ares as the container of multiple types of data
Packit 514978
 * dynamically allocated for which a reference will be returned
Packit 514978
 * to the calling application.
Packit 514978
 *
Packit 514978
 * c-ares API functions returning a pointer to c-ares internally
Packit 514978
 * allocated data will actually be returning an interior pointer
Packit 514978
 * into this ares_data struct.
Packit 514978
 *
Packit 514978
 * All this is 'invisible' to the calling application, the only
Packit 514978
 * requirement is that this kind of data must be free'ed by the
Packit 514978
 * calling application using ares_free_data() with the pointer
Packit 514978
 * it has received from a previous c-ares function call.
Packit 514978
 */
Packit 514978
Packit 514978
struct ares_data {
Packit 514978
  ares_datatype type;  /* Actual data type identifier. */
Packit 514978
  unsigned int  mark;  /* Private ares_data signature. */
Packit 514978
  union {
Packit 514978
    struct ares_txt_reply    txt_reply;
Packit 514978
    struct ares_txt_ext      txt_ext;
Packit 514978
    struct ares_srv_reply    srv_reply;
Packit 514978
    struct ares_addr_node    addr_node;
Packit 514978
    struct ares_addr_port_node  addr_port_node;
Packit 514978
    struct ares_mx_reply     mx_reply;
Packit 514978
    struct ares_naptr_reply  naptr_reply;
Packit 514978
    struct ares_soa_reply    soa_reply;
Packit 514978
  } data;
Packit 514978
};
Packit 514978
Packit 514978
void *ares_malloc_data(ares_datatype type);
Packit 514978