List of Resource Records.
This class contains a list of RR’s (see ldns.ldns_rr).
Concatenates two ldns_rr_lists together.
This modifies rr list (to extend it and adds RRs from right).
Parameters: | right (ldns_rr_list) – The right-hand side. |
---|---|
Throws TypeError: | |
when right of non-ldns_rr_list type. | |
Returns: | (bool) True if success. |
Concatenates two ldns_rr_lists together, creates a new list of the rr’s (instead of appending the content to an existing list).
Parameters: | right (ldns_rr_list) – The right-hand side. |
---|---|
Throws TypeError: | |
when right of non-ldns_rr_list type. | |
Returns: | (ldns_rr_list) rr list with left-hand side + right-hand side concatenated, on None on error. |
Clones an rrlist.
Returns: | (ldns_rr_list) the cloned rr list, or None on error. |
---|
Returns True if the given rr is one of the rrs in the list, or if it is equal to one.
Parameters: | rr (ldns_rr) – The rr to check. |
---|---|
Throws TypeError: | |
when rr of non-ldns_rr type. | |
Returns: | (bool) True if rr_list contains rr, False otherwise. |
Checks if the rr list is a rr set.
Returns: | (bool) True if rr list is a rr set. |
---|
Creates an empty RR List object.
Parameters: | raiseException (bool) – Set to True if an exception should signal an error. |
---|---|
Throws Exception: | |
when raiseException is True and error occurs. | |
Returns: | ldns_rr_list Empty RR list. |
Creates an RR List object from file content.
Goes through a file and returns a rr list containing all the defined hosts in there.
Parameters: |
|
---|---|
Throws TypeError: | |
when filename of inappropriate type. |
|
Throws Exception: | |
when raiseException is True and error occurs. |
|
Returns: | RR List object or None. If the object can’t be created and raiseException is True, an exception occurs. |
Usage
>>> alist = ldns.ldns_rr_list.new_frm_file()
>>> print alist
localhost. 3600 IN A 127.0.0.1
...
Returns the owner domain name rdf of the first element of the RR. If there are no elements present, None is returned.
Returns: | (ldns_dname) dname of the first element, or None if the list is empty. |
---|
Pops the last rr from an rrlist.
Returns: | (ldns_rr) None if nothing to pop. Otherwise the popped RR. |
---|
Pops an rr_list of size s from an rrlist.
Parameters: | size (positive int) – The number of rr’s to pop. |
---|---|
Throws TypeError: | |
when size of inappropriate type. | |
Returns: | (ldns_rr_list) None if nothing to pop. Otherwise the popped rr list. |
Pops the first rrset from the list, the list must be sorted, so that all rr’s from each rrset are next to each other.
Returns: | (ldns_rr_list) the first rrset, or None when empty. |
---|
Print a rr_list to output.
Parameters: | output – Opened file to print to. |
---|---|
Throws TypeError: | |
when output of inappropriate type. |
Pushes an rr to an rrlist.
Parameters: | rr (ldns_rr) – The rr to push. |
---|---|
Throws TypeError: | |
when rr of non-ldns_rr type. | |
Returns: | (bool) False on error, otherwise True. |
Pushes an rr list to an rr list.
Parameters: | push_list (ldns_rr_list) – The rr_list to push. |
---|---|
Throws TypeError: | |
when push_list of non-ldns_rr_list type. | |
Returns: | (bool) False on error, otherwise True. |
Returns a specific rr of an rrlist.
Parameters: | nr (positive int) – Index of the desired rr. |
---|---|
Throws TypeError: | |
when nr of inappropriate type. | |
Returns: | (ldns_rr) The rr at position nr, or None if failed. |
Returns the number of rr’s in an rr_list.
Returns: | (int) The number of rr’s. |
---|
Returns a generator object of a list of rr records.
Returns: | (generator) generator object. |
---|
Set a rr on a specific index in a ldns_rr_list.
Parameters: |
|
---|---|
Throws TypeError: | |
when parameters of inappropriate types. |
|
Returns: | (ldns_rr) the old rr which was stored in the rr_list, or None if the index was too large to set a specific rr. |
Sets the number of rr’s in an rr_list.
Parameters: | count (positive int) – The number of rr in this list. |
---|---|
Throws TypeError: | |
when count of non-integer type. | |
Throws Exception: | |
when count out of acceptable range. |
Warning
Don’t use this method unless you really know what you are doing.
Sorts an rr_list (canonical wire format).
Return the rr_list which matches the rdf at position field.
Think type-covered stuff for RRSIG.
Parameters: |
|
---|---|
Throws TypeError: | |
when parameters of inappropriate types. |
|
Returns: | (ldns_rr_list) a new rr list with only the RRs that match, or None when nothing matches. |
Converts each dname in each rr in a rr_list to its canonical form.
Returns the type of the first element of the RR.
If there are no elements present, 0 is returned.
Returns: | (int) rr_type of the first element, or 0 if the list is empty. |
---|
Copies the rr_list data to the buffer in wire format.
Parameters: | buffer (ldns_buffer) – Output buffer to append the result to. |
---|---|
Throws TypeError: | |
when buffer of non-ldns_buffer type. | |
Returns: | (ldns_status) ldns_status |