static int
sldns_str2wire_svcbparam_ipv4hint(const char* val, uint8_t* rd, size_t* rd_len)
{
-
int count;
char ip_str[INET_ADDRSTRLEN+1];
char *next_ip_str;
return LDNS_WIREPARSE_ERR_SVCB_MANDATORY_IN_MANDATORY;
/* Guarantee key uniqueness. After the sort we only need to
- * compare neighbours */
+ * compare neighbouring keys */
if (count > 1) {
for (i = 0; i < count - 1; i++) {
uint8_t* current_pos = (rd + 4 + (sizeof(uint16_t) * i));
if (!next_str)
break;
- /* skip the comma for the next iteration */
+ /* skip the comma in the next iteration */
val_len -= next_str - val + 1;
val = next_str + 1;
}
return LDNS_WIREPARSE_ERR_SVCB_UNKNOWN_KEY;
}
- /* key and no value case*/
+ /* key without value */
if (val == NULL) {
switch (svcparamkey) {
case SVCB_KEY_MANDATORY:
sldns_write_uint16(rd + 2, str_len);
memcpy(rd + 4, val, str_len);
*rd_len = 4 + str_len;
-
+
return LDNS_WIREPARSE_ERR_OK;
}
- // @TODO is this supposed to be an error?
+ // @TODO think about if this is supposed to be an error?
return LDNS_WIREPARSE_ERR_GENERAL;
}
eq_pos = strchr(str, '=');
- if (eq_pos != NULL && eq_pos[1]) { /* case: key=value */
+ /* case: key=value */
+ if (eq_pos != NULL && eq_pos[1]) {
val_in = eq_pos + 1;
/* unescape characters and "" blocks */
return sldns_str2wire_svcparam_value(str, eq_pos - str,
unescaped_val[0] ? unescaped_val : NULL, rd, rd_len);
- } else if (eq_pos != NULL && !(eq_pos[1])) { /* case: key= */
+ }
+ /* case: key= */
+ else if (eq_pos != NULL && !(eq_pos[1])) {
return sldns_str2wire_svcparam_value(str, eq_pos - str, NULL, rd, rd_len);
- } else { /* case: key */
+ }
+ /* case: key */
+ else {
return sldns_str2wire_svcparam_value(str, strlen(str), NULL, rd, rd_len);
}