Skip to content
Snippets Groups Projects
Commit f407aefa authored by Jan Kadlec's avatar Jan Kadlec
Browse files

Added function wireformat_size() to descriptors. TODO: doxygen

Refs #233
parent 6c98a36b
No related branches found
No related tags found
No related merge requests found
......@@ -508,3 +508,24 @@ uint16_t dnslib_rrclass_from_string(const char *name)
return (uint16_t) rrclass;
}
size_t dnslib_wireformat_size(uint wire_type)
{
switch(wire_type) {
case DNSLIB_RDATA_WF_BYTE:
return 1;
break;
case DNSLIB_RDATA_WF_SHORT:
return 2;
break;
case DNSLIB_RDATA_WF_LONG:
return 4;
break;
case DNSLIB_RDATA_WF_A:
return 4;
break;
default: /* unknown size */
return 0;
break;
} /* switch */
}
......@@ -146,22 +146,22 @@ enum dnslib_rdata_wireformat {
/*!
* \brief Possibly compressed domain name.
*/
DNSLIB_RDATA_WF_COMPRESSED_DNAME,
DNSLIB_RDATA_WF_UNCOMPRESSED_DNAME, /*!< Uncompressed domain name. */
DNSLIB_RDATA_WF_LITERAL_DNAME, /*!< Literal (not downcased) dname. */
DNSLIB_RDATA_WF_BYTE, /*!< 8-bit integer. */
DNSLIB_RDATA_WF_SHORT, /*!< 16-bit integer. */
DNSLIB_RDATA_WF_LONG, /*!< 32-bit integer. */
DNSLIB_RDATA_WF_TEXT, /*!< Text string. */
DNSLIB_RDATA_WF_A, /*!< 32-bit IPv4 address. */
DNSLIB_RDATA_WF_AAAA, /*!< 128-bit IPv6 address. */
DNSLIB_RDATA_WF_BINARY, /*!< Binary data (unknown length). */
DNSLIB_RDATA_WF_COMPRESSED_DNAME = 50,
DNSLIB_RDATA_WF_UNCOMPRESSED_DNAME = 51, /*!< Uncompressed domain name. */
DNSLIB_RDATA_WF_LITERAL_DNAME = 52, /*!< Literal (not downcased) dname. */
DNSLIB_RDATA_WF_BYTE = 1, /*!< 8-bit integer. */
DNSLIB_RDATA_WF_SHORT = 2, /*!< 16-bit integer. */
DNSLIB_RDATA_WF_LONG = 4, /*!< 32-bit integer. */
DNSLIB_RDATA_WF_TEXT = 53, /*!< Text string. */
DNSLIB_RDATA_WF_A = 58, /*!< 32-bit IPv4 address. */
DNSLIB_RDATA_WF_AAAA = 16, /*!< 128-bit IPv6 address. */
DNSLIB_RDATA_WF_BINARY = 54, /*!< Binary data (unknown length). */
/*!
* \brief Binary data preceded by 1 byte length
*/
DNSLIB_RDATA_WF_BINARYWITHLENGTH,
DNSLIB_RDATA_WF_APL, /*!< APL data. */
DNSLIB_RDATA_WF_IPSECGATEWAY /*!< IPSECKEY gateway ip4, ip6 or dname. */
DNSLIB_RDATA_WF_BINARYWITHLENGTH = 55,
DNSLIB_RDATA_WF_APL = 56, /*!< APL data. */
DNSLIB_RDATA_WF_IPSECGATEWAY = 57 /*!< IPSECKEY gateway ip4, ip6 or dname. */
};
/*!
......@@ -247,6 +247,8 @@ const char *dnslib_rrclass_to_string(uint16_t rrclass);
*/
uint16_t dnslib_rrclass_from_string(const char *name);
size_t dnslib_wireformat_size(uint wire_type);
#endif /* _CUTEDNS_DNSLIB_DESCRIPTOR_H_ */
/*! @} */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment