struct rr_entry *rr_create_ptr(uint8_t *name, struct rr_entry *d_rr) {
    DECL_MALLOC_ZERO_STRUCT(rr, rr_entry);
    FILL_RR_ENTRY(rr, name, RR_PTR);
    rr->cache_flush = 0; // PTRs shouldn't have their cache flush bit set
    rr->data.PTR.entry = d_rr;
    return rr;
}
struct rr_entry *rr_create_srv(uint8_t *name, uint16_t port, uint8_t *target) {
    DECL_MALLOC_ZERO_STRUCT(rr, rr_entry);
    FILL_RR_ENTRY(rr, name, RR_SRV);
    rr->data.SRV.port = port;
    rr->data.SRV.target = target;
    return rr;
}
struct rr_entry *rr_create_aaaa(uint8_t *name, struct in6_addr *addr) {
    DECL_MALLOC_ZERO_STRUCT(rr, rr_entry);
    FILL_RR_ENTRY(rr, name, RR_AAAA);
    rr->data.AAAA.addr = addr;
    rr->ttl = DEFAULT_TTL_FOR_RECORD_WITH_HOSTNAME; // 120 seconds -- see RFC 6762 Section 10
    return rr;
}
struct rr_entry *rr_create(uint8_t *name, enum rr_type type) {
  DECL_MALLOC_ZERO_STRUCT(rr, rr_entry);
  if (rr) {
    FILL_RR_ENTRY(rr, name, type);
  } else {
    die("could not allocate an RR 4 data structure in tinysvcmdns.c.");
  }
  return rr;
}
struct rr_entry *rr_create_ptr(uint8_t *name, struct rr_entry *d_rr) {
  DECL_MALLOC_ZERO_STRUCT(rr, rr_entry);
  if (rr) {
    FILL_RR_ENTRY(rr, name, RR_PTR);
    rr->cache_flush = 0; // PTRs shouldn't have their cache flush bit set
    rr->data.PTR.entry = d_rr;
  } else {
    die("could not allocate an RR 4 data structure in tinysvcmdns.c.");
  }
  return rr;
}
struct rr_entry *rr_create_srv(uint8_t *name, uint16_t port, uint8_t *target) {
  DECL_MALLOC_ZERO_STRUCT(rr, rr_entry);
  if (rr) {
    FILL_RR_ENTRY(rr, name, RR_SRV);
    rr->data.SRV.port = port;
    rr->data.SRV.target = target;
  } else {
    die("could not allocate an RR 3 data structure in tinysvcmdns.c.");
  }
  return rr;
}
struct rr_entry *rr_create_aaaa(uint8_t *name, struct in6_addr *addr) {
  DECL_MALLOC_ZERO_STRUCT(rr, rr_entry);
  if (rr) {
    FILL_RR_ENTRY(rr, name, RR_AAAA);
    rr->data.AAAA.addr = addr;
    rr->ttl = DEFAULT_TTL_FOR_RECORD_WITH_HOSTNAME; // 120 seconds -- see RFC 6762 Section 10
  } else {
    die("could not allocate an RR 2 data structure in tinysvcmdns.c.");
  }
  return rr;
}
struct rr_entry *rr_create(uint8_t *name, enum rr_type type) {
    DECL_MALLOC_ZERO_STRUCT(rr, rr_entry);
    FILL_RR_ENTRY(rr, name, type);
    return rr;
}