@@ -51,6 +51,7 @@ typedef enum {
51
51
ARES_REC_TYPE_HINFO = 13 , /*!< Host information. */
52
52
ARES_REC_TYPE_MX = 15 , /*!< Mail routing information. */
53
53
ARES_REC_TYPE_TXT = 16 , /*!< Text strings. */
54
+ ARES_REC_TYPE_SIG = 24 , /*!< RFC 2535 / RFC 2931. SIG Record */
54
55
ARES_REC_TYPE_AAAA = 28 , /*!< RFC 3596. Ip6 Address. */
55
56
ARES_REC_TYPE_SRV = 33 , /*!< RFC 2782. Server Selection. */
56
57
ARES_REC_TYPE_NAPTR = 35 , /*!< RFC 3403. Naming Authority Pointer */
@@ -93,7 +94,7 @@ typedef enum {
93
94
ARES_OPCODE_IQUERY = 1 , /*!< Inverse query. Obsolete. */
94
95
ARES_OPCODE_STATUS = 2 , /*!< Name server status query */
95
96
ARES_OPCODE_NOTIFY = 4 , /*!< Zone change notification (RFC 1996) */
96
- ARES_OPCODE_UPDATE = 5 , /*!< Zone update message (RFC2136) */
97
+ ARES_OPCODE_UPDATE = 5 /*!< Zone update message (RFC2136) */
97
98
} ares_dns_opcode_t ;
98
99
99
100
/*! DNS Header flags */
@@ -107,7 +108,7 @@ typedef enum {
107
108
ARES_FLAG_AD = 1 << 5 , /*!< RFC 2065. Authentic Data bit indicates in a
108
109
* response that the data included has been verified by
109
110
* the server providing it */
110
- ARES_FLAG_CD = 1 << 6 , /*!< RFC 2065. Checking Disabled bit indicates in a
111
+ ARES_FLAG_CD = 1 << 6 /*!< RFC 2065. Checking Disabled bit indicates in a
111
112
* query that non-verified data is acceptable to the
112
113
* resolver sending the query. */
113
114
} ares_dns_flags_t ;
@@ -151,7 +152,7 @@ typedef enum {
151
152
ARES_RCODE_BADNAME = 20 , /*!< RFC 2930. Duplicate Key Name */
152
153
ARES_RCODE_BADALG = 21 , /*!< RFC 2930. Algorithm not supported */
153
154
ARES_RCODE_BADTRUNC = 22 , /*!< RFC 8945. Bad Truncation */
154
- ARES_RCODE_BADCOOKIE = 23 , /*!< RVC 7973 . Bad/missing Server Cookie */
155
+ ARES_RCODE_BADCOOKIE = 23 /*!< RFC 7873 . Bad/missing Server Cookie */
155
156
} ares_dns_rcode_t ;
156
157
157
158
/*! Data types used */
@@ -170,6 +171,9 @@ typedef enum {
170
171
* length) */
171
172
ARES_DATATYPE_OPT = 10 , /*!< Array of options. 16bit identifier, BIN
172
173
* data. */
174
+ ARES_DATATYPE_ABINP = 11 /*!< Array of binary data, likely printable.
175
+ * Guaranteed to have a NULL terminator for
176
+ * convenience (not included in length) */
173
177
} ares_dns_datatype_t ;
174
178
175
179
/*! Keys used for all RR Types. We take the record type and multiply by 100
@@ -206,8 +210,26 @@ typedef enum {
206
210
ARES_RR_MX_PREFERENCE = (ARES_REC_TYPE_MX * 100 ) + 1 ,
207
211
/*! MX Record. Exchange, domain. Datatype: NAME */
208
212
ARES_RR_MX_EXCHANGE = (ARES_REC_TYPE_MX * 100 ) + 2 ,
209
- /*! TXT Record. Data. Datatype: BINP */
213
+ /*! TXT Record. Data. Datatype: ABINP */
210
214
ARES_RR_TXT_DATA = (ARES_REC_TYPE_TXT * 100 ) + 1 ,
215
+ /*! SIG Record. Type Covered. Datatype: U16 */
216
+ ARES_RR_SIG_TYPE_COVERED = (ARES_REC_TYPE_SIG * 100 ) + 1 ,
217
+ /*! SIG Record. Algorithm. Datatype: U8 */
218
+ ARES_RR_SIG_ALGORITHM = (ARES_REC_TYPE_SIG * 100 ) + 2 ,
219
+ /*! SIG Record. Labels. Datatype: U8 */
220
+ ARES_RR_SIG_LABELS = (ARES_REC_TYPE_SIG * 100 ) + 3 ,
221
+ /*! SIG Record. Original TTL. Datatype: U32 */
222
+ ARES_RR_SIG_ORIGINAL_TTL = (ARES_REC_TYPE_SIG * 100 ) + 4 ,
223
+ /*! SIG Record. Signature Expiration. Datatype: U32 */
224
+ ARES_RR_SIG_EXPIRATION = (ARES_REC_TYPE_SIG * 100 ) + 5 ,
225
+ /*! SIG Record. Signature Inception. Datatype: U32 */
226
+ ARES_RR_SIG_INCEPTION = (ARES_REC_TYPE_SIG * 100 ) + 6 ,
227
+ /*! SIG Record. Key Tag. Datatype: U16 */
228
+ ARES_RR_SIG_KEY_TAG = (ARES_REC_TYPE_SIG * 100 ) + 7 ,
229
+ /*! SIG Record. Signers Name. Datatype: NAME */
230
+ ARES_RR_SIG_SIGNERS_NAME = (ARES_REC_TYPE_SIG * 100 ) + 8 ,
231
+ /*! SIG Record. Signature. Datatype: BIN */
232
+ ARES_RR_SIG_SIGNATURE = (ARES_REC_TYPE_SIG * 100 ) + 9 ,
211
233
/*! AAAA Record. Address. Datatype: INADDR6 */
212
234
ARES_RR_AAAA_ADDR = (ARES_REC_TYPE_AAAA * 100 ) + 1 ,
213
235
/*! SRV Record. Priority. Datatype: U16 */
@@ -273,7 +295,7 @@ typedef enum {
273
295
/*! RAW Record. RR Type. Datatype: U16 */
274
296
ARES_RR_RAW_RR_TYPE = (ARES_REC_TYPE_RAW_RR * 100 ) + 1 ,
275
297
/*! RAW Record. RR Data. Datatype: BIN */
276
- ARES_RR_RAW_RR_DATA = (ARES_REC_TYPE_RAW_RR * 100 ) + 2 ,
298
+ ARES_RR_RAW_RR_DATA = (ARES_REC_TYPE_RAW_RR * 100 ) + 2
277
299
} ares_dns_rr_key_t ;
278
300
279
301
/*! TLSA Record ARES_RR_TLSA_CERT_USAGE known values */
@@ -353,7 +375,7 @@ typedef enum {
353
375
/*! RFC 8145. Signaling Trust Anchor Knowledge in DNSSEC */
354
376
ARES_OPT_PARAM_EDNS_KEY_TAG = 14 ,
355
377
/*! RFC 8914. Extended ERROR code and message */
356
- ARES_OPT_PARAM_EXTENDED_DNS_ERROR = 15 ,
378
+ ARES_OPT_PARAM_EXTENDED_DNS_ERROR = 15
357
379
} ares_opt_param_t ;
358
380
359
381
/*! Data type for option records for keys like ARES_RR_OPT_OPTIONS and
@@ -581,6 +603,15 @@ CARES_EXTERN void ares_dns_record_destroy(ares_dns_record_t *dnsrec);
581
603
CARES_EXTERN unsigned short
582
604
ares_dns_record_get_id (const ares_dns_record_t * dnsrec );
583
605
606
+ /*! Overwrite the DNS query id
607
+ *
608
+ * \param[in] dnsrec Initialized record object
609
+ * \param[in] id DNS query id
610
+ * \return ARES_TRUE on success, ARES_FALSE on usage error
611
+ */
612
+ CARES_EXTERN ares_bool_t ares_dns_record_set_id (ares_dns_record_t * dnsrec ,
613
+ unsigned short id );
614
+
584
615
/*! Get the DNS Record Flags
585
616
*
586
617
* \param[in] dnsrec Initialized record object
@@ -844,6 +875,34 @@ CARES_EXTERN ares_status_t ares_dns_rr_set_bin(ares_dns_rr_t *dns_rr,
844
875
const unsigned char * val ,
845
876
size_t len );
846
877
878
+ /*! Add binary array value (ABINP) data for specified resource record and key.
879
+ * Can only be used on keys with datatype ARES_DATATYPE_ABINP. The value will
880
+ * Be added as the last element in the array.
881
+ *
882
+ * \param[in] dns_rr Pointer to resource record
883
+ * \param[in] key DNS Resource Record Key
884
+ * \param[in] val Pointer to binary data.
885
+ * \param[in] len Length of binary data
886
+ * \return ARES_SUCCESS on success
887
+ */
888
+ CARES_EXTERN ares_status_t ares_dns_rr_add_abin (ares_dns_rr_t * dns_rr ,
889
+ ares_dns_rr_key_t key ,
890
+ const unsigned char * val ,
891
+ size_t len );
892
+
893
+ /*! Delete binary array value (ABINP) data for specified resource record and
894
+ * key by specified index. Can only be used on keys with datatype
895
+ * ARES_DATATYPE_ABINP. The value at the index will be deleted.
896
+ *
897
+ * \param[in] dns_rr Pointer to resource record
898
+ * \param[in] key DNS Resource Record Key
899
+ * \param[in] idx Index to delete
900
+ * \return ARES_SUCCESS on success
901
+ */
902
+ CARES_EXTERN ares_status_t ares_dns_rr_del_abin (ares_dns_rr_t * dns_rr ,
903
+ ares_dns_rr_key_t key ,
904
+ size_t idx );
905
+
847
906
/*! Set the option for the RR
848
907
*
849
908
* \param[in] dns_rr Pointer to resource record
@@ -859,6 +918,17 @@ CARES_EXTERN ares_status_t ares_dns_rr_set_opt(ares_dns_rr_t *dns_rr,
859
918
const unsigned char * val ,
860
919
size_t val_len );
861
920
921
+ /*! Delete the option for the RR by id
922
+ *
923
+ * \param[in] dns_rr Pointer to resource record
924
+ * \param[in] key DNS Resource Record Key
925
+ * \param[in] opt Option record key id.
926
+ * \return ARES_SUCCESS if removed, ARES_ENOTFOUND if not found
927
+ */
928
+ CARES_EXTERN ares_status_t ares_dns_rr_del_opt_byid (ares_dns_rr_t * dns_rr ,
929
+ ares_dns_rr_key_t key ,
930
+ unsigned short opt );
931
+
862
932
/*! Retrieve a pointer to the ipv4 address. Can only be used on keys with
863
933
* datatype ARES_DATATYPE_INADDR.
864
934
*
@@ -920,8 +990,9 @@ CARES_EXTERN unsigned int ares_dns_rr_get_u32(const ares_dns_rr_t *dns_rr,
920
990
ares_dns_rr_key_t key );
921
991
922
992
/*! Retrieve a pointer to the binary data. Can only be used on keys with
923
- * datatype ARES_DATATYPE_BIN or ARES_DATATYPE_BINP. If BINP, the data is
924
- * guaranteed to have a NULL terminator which is NOT included in the length.
993
+ * datatype ARES_DATATYPE_BIN, ARES_DATATYPE_BINP, or ARES_DATATYPE_ABINP.
994
+ * If BINP or ABINP, the data is guaranteed to have a NULL terminator which
995
+ * is NOT included in the length.
925
996
*
926
997
* \param[in] dns_rr Pointer to resource record
927
998
* \param[in] key DNS Resource Record Key
@@ -932,6 +1003,33 @@ CARES_EXTERN const unsigned char *
932
1003
ares_dns_rr_get_bin (const ares_dns_rr_t * dns_rr , ares_dns_rr_key_t key ,
933
1004
size_t * len );
934
1005
1006
+ /*! Retrieve the count of the array of stored binary values. Can only be used on
1007
+ * keys with datatype ARES_DATATYPE_ABINP.
1008
+ *
1009
+ * \param[in] dns_rr Pointer to resource record
1010
+ * \param[in] key DNS Resource Record Key
1011
+ * \return count of values
1012
+ */
1013
+ CARES_EXTERN size_t ares_dns_rr_get_abin_cnt (const ares_dns_rr_t * dns_rr ,
1014
+ ares_dns_rr_key_t key );
1015
+
1016
+ /*! Retrieve a pointer to the binary array data from the specified index. Can
1017
+ * only be used on keys with datatype ARES_DATATYPE_ABINP. If ABINP, the data
1018
+ * is guaranteed to have a NULL terminator which is NOT included in the length.
1019
+ * If want all array membersconcatenated, may use ares_dns_rr_get_bin()
1020
+ * instead.
1021
+ *
1022
+ * \param[in] dns_rr Pointer to resource record
1023
+ * \param[in] key DNS Resource Record Key
1024
+ * \param[in] idx Index of value to retrieve
1025
+ * \param[out] len Length of binary data returned
1026
+ * \return pointer binary data or NULL on error
1027
+ */
1028
+ CARES_EXTERN const unsigned char *
1029
+ ares_dns_rr_get_abin (const ares_dns_rr_t * dns_rr , ares_dns_rr_key_t key ,
1030
+ size_t idx , size_t * len );
1031
+
1032
+
935
1033
/*! Retrieve the number of options stored for the RR.
936
1034
*
937
1035
* \param[in] dns_rr Pointer to resource record
0 commit comments