Lines Matching defs:name

23 #define dns_name_foreach_label_safe(label, name, next, maxlen) \
24 for ((label) = (name), (next) = (char *)((name) + *(unsigned char*)(name) + 1); \
25 (*(label) != '\0') && ((uint16_t)((label) - (name)) < (maxlen)); \
29 * Checks if the DNS name doesn't exceed 256 bytes including zero-byte.
31 * @param namelen Length of the DNS name-string including zero-byte
41 * Returns the length of a name in a DNS-packet as if DNS name compression
44 * @param name Compressed name you want the calculate the strlen from
45 * @return Returns strlen of a compressed name, takes the first byte of compr-
50 pico_dns_namelen_comp( char *name )
56 if (!name) {
62 dns_name_foreach_label_safe(label, name, next, 255) {
68 len = (uint16_t)(label - name);
76 * Returns the uncompressed name in DNS name format when DNS name compression
79 * @param name Compressed name, should be in the bounds of the actual packet
80 * @param packet Packet that contains the compressed name
81 * @return Returns the decompressed name, NULL on failure.
84 pico_dns_decompress_name( char *name, pico_dns_packet *packet )
95 iterator = (uint8_t *) name;
116 /* Provide storage for the name to return */
129 * Determines the length of a given url as if it where a DNS name in reverse
132 * @param url URL wanted to create a reverse resolution name from.
137 * @return Returns the length of the reverse name
167 * Converts a DNS name in URL format to a reverse name in DNS name format.
168 * Provides space for the DNS name as well. PICO_FREE() should be called on the
169 * returned string buffer that contains the reverse DNS name.
171 * @param url DNS name in URL format to convert to reverse name
173 * @return Returns a pointer to a string-buffer with the reverse DNS name.
188 /* Provide space for the reverse name */
219 * Converts a DNS name in DNS name format to a name in URL format. Provides
220 * space for the name in URL format as well. PICO_FREE() should be called on
221 * the returned string buffer that contains the name in URL format.
223 * @param qname DNS name in DNS name format to convert
224 * @return Returns a pointer to a string-buffer with the URL name on success.
256 * Converts a DNS name in URL format to a name in DNS name format. Provides
257 * space for the DNS name as well. PICO_FREE() should be called on the returned
258 * string buffer that contains the DNS name.
260 * @param url DNS name in URL format to convert
261 * @return Returns a pointer to a string-buffer with the DNS name on success.
301 * Replaces .'s in a DNS name in URL format by the label lengths. So it
302 * actually converts a name in URL format to a name in DNS name format.
305 * @param url Location to buffer with name in URL format. The URL needs to
337 * Replaces the label lengths in a DNS-name by .'s. So it actually converts a
338 * name in DNS format to a name in URL format.
341 * @param ptr Location to buffer with name in DNS name format
358 * Determines the length of the first label of a DNS name in URL-format
360 * @param url DNS name in URL-format
361 * @return Length of the first label of DNS name in URL-format
541 * Fills in the name of the DNS question.
543 * @param qname Pointer-pointer to the name-member of the DNS-question
544 * @param url Name in URL format you want to convert to a name in DNS name
550 * @param proto When reverse is true the reverse resolution name will be
553 * @param reverse When this is true a reverse resolution name will be generated
555 * @return The eventual length of the generated name, 0 on failure.
582 * Creates a standalone DNS Question with a given name and type.
584 * @param url DNS question name in URL format. Will be converted to DNS
585 * name notation format.
591 * @param reverse When this is true, a reverse resolution name will be
620 /* Fill name field */
641 * Decompresses the name of a single DNS question.
643 * @param question Question you want to decompress the name of
645 * @return Pointer to original name of the DNS question before decompressing.
653 /* Try to decompress the question name */
852 * data should contain a DNS name, the name in the databuffer
855 * record should contain a DNS name, datalen needs to be
869 /* If type is PTR, rdata will be a DNS name in URL format */
895 * Create a standalone DNS Resource Record with a given name.
897 * @param url DNS rrecord name in URL format. Will be converted to DNS
898 * name notation format.
900 * data should contain a DNS name, the name in the databuffer
903 * record should contain a DNS name, datalen needs to be
936 /* Provide space and convert the URL to a DNS name */
960 * Decompresses the name of single DNS record.
962 * @param record DNS record to decompress the name of.
964 * @return Pointer to original name of the DNS record before decompressing.
972 /* Try to decompress the record name */
1079 * Compares 2 DNS records by type and name only
1083 * @return 0 when name and type of records are equal, returns difference when
1114 * Compares 2 DNS records by type, name AND rdata for a truly unique result
1134 /* Compare type and name */
1236 * Deletes all the questions with given DNS name from a pico_tree
1239 * @param name Name of the questions you want to delete
1244 const char *name )
1250 if (!qtree || !name) {
1255 /* Iterate over tree and delete every node with given name */
1258 if ((question) && (strcasecmp(question->qname, name) == 0)) {
1268 * Checks whether a question with given name is in the tree or not.
1271 * @param name Name you want to check for
1272 * @return 1 when the name is present in the qtree, 0 when it's not.
1276 const char *name )
1282 if (!qtree || !name) {
1290 if ((question) && (strcasecmp(question->qname, name) == 0))
1442 /* Copy the name */
1460 * Looks for a name somewhere else in packet, more specifically between the
1461 * beginning of the data buffer and the name itself.
1464 pico_dns_packet_compress_find_ptr( uint8_t *name,
1471 if (!name || !data || !len)
1474 if ((name < data) || (name > (data + len)))
1479 /* Iterate from the beginning of data up until the name-ptr */
1480 while (iterator < name) {
1481 /* Compare in each iteration of current name is equal to a section of
1483 if (memcmp((void *)iterator++, (void *)name,
1484 pico_dns_strlen((char *)name) + 1u) == 0)
1491 * Compresses a single name by looking for the same name somewhere else in the
1495 pico_dns_packet_compress_name( uint8_t *name,
1509 if (!name || !packet || !len) {
1514 if ((name < packet) || (name > (packet + *len))) {
1515 dns_dbg("Name ptr OOB. name: %p max: %p\n", name, packet + *len);
1520 /* Try to compress name */
1521 lbl_iterator = name;
1523 /* Try to find a compression pointer with current name */
1526 /* If name can be compressed */
1596 * Applies DNS name compression to an entire DNS packet