508 | 508 |
|
509 | 509 |
/**
|
510 | 510 |
* get the length of the specified list (returned in *answer)
|
511 | |
* @param this_list list of any of the supported data types
|
|
511 |
* @param list list of any of the supported data types
|
512 | 512 |
* @param answer number of valid items in the list
|
513 | 513 |
* @return GETDNS_RETURN_GOOD on success
|
514 | 514 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if list is not valid or params are NULL
|
515 | 515 |
*/
|
516 | |
getdns_return_t getdns_list_get_length(const getdns_list *this_list,
|
|
516 |
getdns_return_t getdns_list_get_length(const getdns_list *list,
|
517 | 517 |
size_t * answer);
|
518 | 518 |
/**
|
519 | 519 |
* get the enumerated data type of the indexed list item
|
520 | |
* @param this_list the list from which to fetch the data type
|
|
520 |
* @param list the list from which to fetch the data type
|
521 | 521 |
* @param index the item in the list from which to fetch the data type
|
522 | 522 |
* @param *answer assigned the value of the data type on success
|
523 | 523 |
* @return GETDNS_RETURN_GOOD on success
|
524 | 524 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
525 | 525 |
*/
|
526 | |
getdns_return_t getdns_list_get_data_type(const getdns_list *this_list,
|
|
526 |
getdns_return_t getdns_list_get_data_type(const getdns_list *list,
|
527 | 527 |
size_t index, getdns_data_type * answer);
|
528 | 528 |
/**
|
529 | 529 |
* retrieve the dictionary value of the specified list item, the caller must not free
|
530 | 530 |
* storage associated with the return value. When the list is destroyed this
|
531 | 531 |
* dict data is also free()'d - keep this in mind when using this function.
|
532 | |
* @param this_list the list from which to fetch the value
|
|
532 |
* @param list the list from which to fetch the value
|
533 | 533 |
* @param index the item in the list from which to fetch the value
|
534 | 534 |
* @param **answer assigned a pointer to the dict value of the indexed element
|
535 | 535 |
* @return GETDNS_RETURN_GOOD on success
|
536 | 536 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
537 | 537 |
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
538 | 538 |
*/
|
539 | |
getdns_return_t getdns_list_get_dict(const getdns_list *this_list, size_t index,
|
|
539 |
getdns_return_t getdns_list_get_dict(const getdns_list *list, size_t index,
|
540 | 540 |
getdns_dict **answer);
|
541 | 541 |
|
542 | 542 |
/**
|
543 | 543 |
* retrieve the list value of the specified list item, the caller must not free
|
544 | 544 |
* storage associated with the return value. When the list is destroyed any
|
545 | 545 |
* list data is also free()'d - keep this in mind when using this function.
|
546 | |
* @param this_list the list from which to fetch the value
|
|
546 |
* @param list the list from which to fetch the value
|
547 | 547 |
* @param index the item in the list from which to fetch the value
|
548 | 548 |
* @param **answer assigned a pointer to the list value of the indexed element
|
549 | 549 |
* @return GETDNS_RETURN_GOOD on success
|
550 | 550 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
551 | 551 |
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
552 | 552 |
*/
|
553 | |
getdns_return_t getdns_list_get_list(const getdns_list *this_list, size_t index,
|
|
553 |
getdns_return_t getdns_list_get_list(const getdns_list *list, size_t index,
|
554 | 554 |
getdns_list **answer);
|
555 | 555 |
/**
|
556 | 556 |
* retrieve the binary data value of the specified list item, the caller must not
|
557 | 557 |
* free storage associated with the return value. When the list is destroyed any
|
558 | 558 |
* bindata data is also free()'d - keep this in mind when using this function.
|
559 | |
* @param this_list the list from which to fetch the value
|
|
559 |
* @param list the list from which to fetch the value
|
560 | 560 |
* @param index the item in the list from which to fetch the value
|
561 | 561 |
* @param **answer assigned a pointer to the list value of the indexed element
|
562 | 562 |
* @return GETDNS_RETURN_GOOD on success
|
563 | 563 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
564 | 564 |
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
565 | 565 |
*/
|
566 | |
getdns_return_t getdns_list_get_bindata(const getdns_list *this_list, size_t index,
|
|
566 |
getdns_return_t getdns_list_get_bindata(const getdns_list *list, size_t index,
|
567 | 567 |
getdns_bindata **answer);
|
568 | 568 |
/**
|
569 | 569 |
* retrieve the integer value of the specified list item
|
570 | |
* @param this_list the list from which to fetch the item
|
|
570 |
* @param list the list from which to fetch the item
|
571 | 571 |
* @param index the index of the element in the list to fetch from
|
572 | 572 |
* @param *answer assigned the integer value of the indexed element
|
573 | 573 |
* @return GETDNS_RETURN_GOOD on success
|
574 | 574 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if the index is out of range or the list is NULL
|
575 | 575 |
* @return GETDNS_RETURN_WRONG_TYPE_REQUESTED if the data type does not match the contents of the indexed item
|
576 | 576 |
*/
|
577 | |
getdns_return_t getdns_list_get_int(const getdns_list *this_list, size_t index,
|
|
577 |
getdns_return_t getdns_list_get_int(const getdns_list *list, size_t index,
|
578 | 578 |
uint32_t * answer);
|
579 | 579 |
|
580 | 580 |
/**
|
581 | 581 |
* fetch a list of names from the dictionary, this list must be freed by the caller
|
582 | 582 |
* via a call to getdns_list_destroy
|
583 | |
* @param this_dict dictionary from which to produce the list of names
|
|
583 |
* @param dict dictionary from which to produce the list of names
|
584 | 584 |
* @param **answer a pointer to the new list will be assigned to *answer
|
585 | 585 |
* @return GETDNS_RETURN_GOOD on success
|
586 | 586 |
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or empty
|
587 | 587 |
*/
|
588 | |
getdns_return_t getdns_dict_get_names(const getdns_dict *this_dict,
|
|
588 |
getdns_return_t getdns_dict_get_names(const getdns_dict *dict,
|
589 | 589 |
getdns_list **answer);
|
590 | 590 |
/**
|
591 | 591 |
* fetch the data type for the data associated with the specified name
|
592 | |
* @param this_dict dictionary from which to fetch the data type
|
|
592 |
* @param dict dictionary from which to fetch the data type
|
593 | 593 |
* @param name a name/key value to look up in the dictionary
|
594 | 594 |
* @param *answer data type will be stored at this address
|
595 | 595 |
* @return GETDNS_RETURN_GOOD on success
|
596 | 596 |
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
597 | 597 |
*/
|
598 | |
getdns_return_t getdns_dict_get_data_type(const getdns_dict *this_dict,
|
|
598 |
getdns_return_t getdns_dict_get_data_type(const getdns_dict *dict,
|
599 | 599 |
const char *name, getdns_data_type * answer);
|
600 | 600 |
/**
|
601 | 601 |
* fetch the dictionary associated with the specified name, the dictionary should
|
602 | 602 |
* not be free()'d by the caller, it will be freed when the parent dictionary is
|
603 | 603 |
* free()'d
|
604 | |
* @param this_dict dictionary from which to fetch the dictionary
|
|
604 |
* @param dict dictionary from which to fetch the dictionary
|
605 | 605 |
* @param name a name/key value to look up in the dictionary
|
606 | 606 |
* @param **answer a copy of the dictionary will be stored at this address
|
607 | 607 |
* @return GETDNS_RETURN_GOOD on success
|
608 | 608 |
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
609 | 609 |
*/
|
610 | |
getdns_return_t getdns_dict_get_dict(const getdns_dict *this_dict,
|
|
610 |
getdns_return_t getdns_dict_get_dict(const getdns_dict *dict,
|
611 | 611 |
const char *name, getdns_dict **answer);
|
612 | 612 |
/**
|
613 | 613 |
* fetch the list associated with the specified name
|
614 | 614 |
* the list should not be free()'d by the caller, when the dictionary is destroyed
|
615 | 615 |
* the list will also be destroyed
|
616 | |
* @param this_dict dictionary from which to fetch the list
|
|
616 |
* @param dict dictionary from which to fetch the list
|
617 | 617 |
* @param name a name/key value to look up in the dictionary
|
618 | 618 |
* @param **answer a copy of the list will be stored at this address
|
619 | 619 |
* @return GETDNS_RETURN_GOOD on success
|
620 | 620 |
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
621 | 621 |
*/
|
622 | |
getdns_return_t getdns_dict_get_list(const getdns_dict *this_dict,
|
|
622 |
getdns_return_t getdns_dict_get_list(const getdns_dict *dict,
|
623 | 623 |
const char *name, getdns_list **answer);
|
624 | 624 |
/**
|
625 | 625 |
* fetch the bindata associated with the specified name, the bindata should not be
|
626 | 626 |
* free()'d by the caller
|
627 | |
* @param this_dict dictionary from which to fetch the bindata
|
|
627 |
* @param dict dictionary from which to fetch the bindata
|
628 | 628 |
* @param name a name/key value to look up in the dictionary
|
629 | 629 |
* @param **answer a copy of the bindata will be stored at this address
|
630 | 630 |
* @return GETDNS_RETURN_GOOD on success
|
631 | 631 |
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
632 | 632 |
*/
|
633 | |
getdns_return_t getdns_dict_get_bindata(const getdns_dict *this_dict,
|
|
633 |
getdns_return_t getdns_dict_get_bindata(const getdns_dict *dict,
|
634 | 634 |
const char *name, getdns_bindata **answer);
|
635 | 635 |
/**
|
636 | 636 |
* fetch the integer value associated with the specified name
|
637 | |
* @param this_dict dictionary from which to fetch the integer
|
|
637 |
* @param dict dictionary from which to fetch the integer
|
638 | 638 |
* @param name a name/key value to look up in the dictionary
|
639 | 639 |
* @param *answer the integer will be stored at this address
|
640 | 640 |
* @return GETDNS_RETURN_GOOD on success
|
641 | 641 |
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
642 | 642 |
*/
|
643 | |
getdns_return_t getdns_dict_get_int(const getdns_dict *this_dict,
|
|
643 |
getdns_return_t getdns_dict_get_int(const getdns_dict *dict,
|
644 | 644 |
const char *name, uint32_t * answer);
|
645 | 645 |
|
646 | 646 |
/**
|
|
668 | 668 |
* you MUST copy those instances BEFORE you destroy the list else
|
669 | 669 |
* unpleasant things will happen at run-time
|
670 | 670 |
*/
|
671 | |
void getdns_list_destroy(getdns_list *this_list);
|
|
671 |
void getdns_list_destroy(getdns_list *list);
|
672 | 672 |
|
673 | 673 |
/**
|
674 | 674 |
* assign the child_dict to an item in a parent list, the parent list copies
|
675 | 675 |
* the child dict and will free the copy when the list is destroyed
|
676 | |
* @param this_list list containing the item to which child_list is to be assigned
|
|
676 |
* @param list list containing the item to which child_list is to be assigned
|
677 | 677 |
* @param index index of the item within list to which child_list is to be assigned
|
678 | 678 |
* @param *child_dict dict to assign to the item
|
679 | 679 |
* @return GETDNS_RETURN_GOOD on success
|
680 | 680 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if index is out of range, or list is NULL
|
681 | 681 |
*/
|
682 | |
getdns_return_t getdns_list_set_dict(getdns_list *this_list, size_t index,
|
|
682 |
getdns_return_t getdns_list_set_dict(getdns_list *list, size_t index,
|
683 | 683 |
const getdns_dict *child_dict);
|
684 | 684 |
|
685 | 685 |
/**
|
686 | 686 |
* assign the child_list to an item in a parent list, the parent list copies
|
687 | 687 |
* the child list and will free the copy when the list is destroyed
|
688 | |
* @param this_list list containing the item to which child_list is to be assigned
|
|
688 |
* @param list list containing the item to which child_list is to be assigned
|
689 | 689 |
* @param index index of the item within list to which child_list is to be assigned
|
690 | 690 |
* @param *child_list list to assign to the item
|
691 | 691 |
* @return GETDNS_RETURN_GOOD on success
|
692 | 692 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if index is out of range, or list is NULL
|
693 | 693 |
*/
|
694 | |
getdns_return_t getdns_list_set_list(getdns_list *this_list, size_t index,
|
|
694 |
getdns_return_t getdns_list_set_list(getdns_list *list, size_t index,
|
695 | 695 |
const getdns_list *child_list);
|
696 | 696 |
/**
|
697 | 697 |
* assign the child_bindata to an item in a parent list, the parent list copies
|
698 | 698 |
* the child data and will free the copy when the list is destroyed
|
699 | |
* @param this_list list contiaining the item to which child_list is to be assigned
|
|
699 |
* @param list list contiaining the item to which child_list is to be assigned
|
700 | 700 |
* @param index index of the item within list to which child_list is to be assigned
|
701 | 701 |
* @param *child_bindata data to assign to the item
|
702 | 702 |
* @return GETDNS_RETURN_GOOD on success
|
703 | 703 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if index is out of range, or list is NULL
|
704 | 704 |
*/
|
705 | |
getdns_return_t getdns_list_set_bindata(getdns_list *this_list, size_t index,
|
|
705 |
getdns_return_t getdns_list_set_bindata(getdns_list *list, size_t index,
|
706 | 706 |
const getdns_bindata *child_bindata);
|
707 | 707 |
/**
|
708 | 708 |
* set the integer value of the indexed item (zero based index)
|
709 | 709 |
* @return GETDNS_RETURN_GOOD on success
|
710 | 710 |
* @return GETDNS_RETURN_NO_SUCH_LIST_ITEM if index is out of range, or list is NULL
|
711 | 711 |
*/
|
712 | |
getdns_return_t getdns_list_set_int(getdns_list *this_list, size_t index,
|
|
712 |
getdns_return_t getdns_list_set_int(getdns_list *list, size_t index,
|
713 | 713 |
uint32_t child_uint32);
|
714 | 714 |
|
715 | 715 |
/**
|
|
735 | 735 |
* be aware that if you have fetched any data from the dictionary it will
|
736 | 736 |
* no longer be available (you are likely to experience bad things if you try)
|
737 | 737 |
*/
|
738 | |
void getdns_dict_destroy(getdns_dict *this_dict);
|
739 | |
|
740 | |
getdns_return_t getdns_dict_set_dict(getdns_dict *this_dict,
|
|
738 |
void getdns_dict_destroy(getdns_dict *dict);
|
|
739 |
|
|
740 |
getdns_return_t getdns_dict_set_dict(getdns_dict *dict,
|
741 | 741 |
const char *name, const getdns_dict *child_dict);
|
742 | 742 |
/**
|
743 | 743 |
* create a new entry in the dictionary, or replace the value of an existing entry
|
744 | 744 |
* this routine makes a copy of the child_list
|
745 | |
* @param this_dict dictionary in which to add or change the value
|
|
745 |
* @param dict dictionary in which to add or change the value
|
746 | 746 |
* @param name key that identifies which item in the dictionary to add/change
|
747 | 747 |
* @param child_list value to assign to the node identified by name
|
748 | 748 |
* @return GETDNS_RETURN_GOOD on success
|
749 | 749 |
*/
|
750 | |
getdns_return_t getdns_dict_set_list(getdns_dict *this_dict,
|
|
750 |
getdns_return_t getdns_dict_set_list(getdns_dict *dict,
|
751 | 751 |
const char *name, const getdns_list *child_list);
|
752 | 752 |
/**
|
753 | 753 |
* create a new entry in the dictionary, or replace the value of an existing entry
|
754 | 754 |
* this routine makes a copy of the child_bindata
|
755 | |
* @param this_dict dictionary in which to add or change the value
|
|
755 |
* @param dict dictionary in which to add or change the value
|
756 | 756 |
* @param name key that identifies which item in the dictionary to add/change
|
757 | 757 |
* @param child_bindata value to assign to the node identified by name
|
758 | 758 |
* @return GETDNS_RETURN_GOOD on success
|
759 | 759 |
*/
|
760 | |
getdns_return_t getdns_dict_set_bindata(getdns_dict *this_dict,
|
|
760 |
getdns_return_t getdns_dict_set_bindata(getdns_dict *dict,
|
761 | 761 |
const char *name, const getdns_bindata *child_bindata);
|
762 | 762 |
/**
|
763 | 763 |
* create a new entry in the dictionary, or replace the value of an existing entry
|
764 | |
* @param this_dict dictionary in which to add or change the value
|
|
764 |
* @param dict dictionary in which to add or change the value
|
765 | 765 |
* @param name key that identifies which item in the dictionary to add/change
|
766 | 766 |
* @param child_uint32 value to assign to the node identified by name
|
767 | 767 |
* @return GETDNS_RETURN_GOOD on success
|
768 | 768 |
*/
|
769 | |
getdns_return_t getdns_dict_set_int(getdns_dict *this_dict, const char *name,
|
|
769 |
getdns_return_t getdns_dict_set_int(getdns_dict *dict, const char *name,
|
770 | 770 |
uint32_t child_uint32);
|
771 | 771 |
|
772 | 772 |
/**
|
773 | 773 |
* remove the value associated with the specified name
|
774 | |
* @param this_dict dictionary from which to fetch the integer
|
|
774 |
* @param dict dictionary from which to fetch the integer
|
775 | 775 |
* @param name a name/key value to look up in the dictionary
|
776 | 776 |
* @return GETDNS_RETURN_GOOD on success
|
777 | 777 |
* @return GETDNS_RETURN_NO_SUCH_DICT_NAME if dict is invalid or name does not exist
|
778 | 778 |
*/
|
779 | |
getdns_return_t getdns_dict_remove_name(getdns_dict *this_dict, const char *name);
|
|
779 |
getdns_return_t getdns_dict_remove_name(getdns_dict *dict, const char *name);
|
780 | 780 |
|
781 | 781 |
/* Callback arguments */
|
782 | 782 |
typedef void (*getdns_callback_t) (getdns_context *context,
|