1.6.14
+ * Added rich comparison methods for ldns_dname, ldns_rdf, ldns_rr and
+ ldns_rr_list classes.
* Added deprecation warnings into ldns_rr.new_frm_fp() and
ldns_rr.new_frm_fp_l() and others.
* Fixed ldns_rr.set_rdf(), which may cause memory leaks, because it
set_error()
+#if not error_detected:
+if True:
+ method_name = class_name + ".[comparison operators]"
+ dn1 = ldns.ldns_dname("a.test")
+ dn2 = ldns.ldns_dname("b.test")
+ try:
+ ret = dn1 < dn2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn2 < dn1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn1 <= dn2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn2 <= dn1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn1 == dn2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn1 == dn1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn1 != dn2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn1 != dn1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn1 > dn2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn2 > dn1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn1 >= dn2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = dn2 >= dn1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+
+
#if not error_detected:
if True:
method_name = class_name + ".absolute()"
pass
+#if not error_detected:
+if True:
+ method_name = class_name + ".[comparison operators]"
+ rdf1 = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)
+ rdf2 = ldns.ldns_rdf.new_frm_str("1.1.1.1", ldns.LDNS_RDF_TYPE_A)
+ try:
+ ret = rdf1 < rdf2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf2 < rdf1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf1 <= rdf2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf2 <= rdf1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf1 == rdf2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf1 == rdf1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf1 != rdf2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf1 != rdf1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf1 > rdf2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf2 > rdf1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf1 >= rdf2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rdf2 >= rdf1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+
+
#if not error_detected:
if True:
method_name = "ldns_rdf_new()"
(inspect.currentframe().f_back.f_lineno, method_name))
+
#if not error_detected:
-#if True:
-# method_name = class_name + ".__cmp__()"
-# rr1 = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")
-# rr2 = ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1")
-# try:
-# ret = rr1 < rr2
-# if ret != True:
-# set_error()
-# except:
-# set_error()
-# try:
-# ret = rr1 == rr2
-# if ret != False:
-# set_error()
-# except:
-# set_error()
-# try:
-# ret = rr1 > rr2
-# if ret != False:
-# set_error()
-# except:
-# set_error()
-# try:
-# ret = rr1 != ""
-# set_error()
-# except TypeError:
-# pass
-# except:
-# set_error()
+if True:
+ method_name = class_name + ".[comparison operators]"
+ rr1 = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")
+ rr2 = ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1")
+ try:
+ ret = rr1 < rr2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr2 < rr1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr1 <= rr2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr2 <= rr1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr1 == rr2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr1 == rr1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr1 != rr2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr1 != rr1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr1 > rr2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr2 > rr1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr1 >= rr2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rr2 >= rr1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
#if not error_detected:
#if not error_detected:
-#if True:
-# method_name = class_name + ".__cmp__()"
-# rrl1 = ldns.ldns_rr_list.new()
-# rrl1.push_rr(ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0"))
-# rrl2 = ldns.ldns_rr_list.new()
-# rrl2.push_rr(ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1"))
-# try:
-# ret = rrl1 < rrl2
-# if ret != True:
-# set_error()
-# except:
-# set_error()
-# try:
-# ret = rrl1 == rrl2
-# if ret != False:
-# set_error()
-# except:
-# set_error()
-# try:
-# ret = rrl1 > rrl2
-# if ret != False:
-# set_error()
-# except:
-# set_error()
-# try:
-# ret = rrl1 != ""
-# set_error()
-# except TypeError:
-# pass
-# except:
-# set_error()
+if True:
+ method_name = class_name + ".[comparison operators]"
+ rrl1 = ldns.ldns_rr_list.new()
+ rrl1.push_rr(ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0"))
+ rrl2 = ldns.ldns_rr_list.new()
+ rrl2.push_rr(ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1"))
+ try:
+ ret = rrl1 < rrl2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl2 < rrl1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl1 <= rrl2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl2 <= rrl1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl1 == rrl2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl1 == rrl1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl1 != rrl2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl1 != rrl1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl1 > rrl2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl2 > rrl1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl1 >= rrl2
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != False:
+ set_error()
+ except:
+ set_error()
+ try:
+ ret = rrl2 >= rrl1
+ if not isinstance(ret, bool):
+ set_error()
+ if ret != True:
+ set_error()
+ except:
+ set_error()
#if not error_detected:
def __cmp__(self, other):
"""
- Compares the two dname rdf's according to the algorithm for
+ Compares two dname rdf according to the algorithm for
ordering in RFC4034 Section 6.
:param other: The second dname rdf to compare.
raise Exception("Operands must be ldns_dname.")
return _ldns.ldns_dname_compare(self, other)
+ def __lt__(self, other):
+ """
+ Compares two dname rdf according to the algorithm for
+ ordering in RFC4034 Section 6.
+
+ :param other: The second dname rdf to compare.
+ :type other: :class:`ldns_dname`
+ :throws TypeError: When `other` of invalid type.
+ :return: (bool) True when `self` is less than 'other'.
+
+ .. note::
+ The type checking of parameter `other` is benevolent.
+ It allows also to pass a dname :class:`ldns_rdf` object.
+ This will probably change in future.
+ """
+ #
+ # The wrapped function generates asserts instead of setting
+ # error status. They cannot be caught from Python so a check
+ # is necessary.
+ #
+ if (not isinstance(other, ldns_dname)) and \
+ isinstance(other, ldns_rdf) and \
+ other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+ warnings.warn("The ldns_dname.__lt__() method will" +
+ " drop the possibility to compare ldns_rdf." +
+ " Convert arguments to ldns_dname.",
+ PendingDeprecationWarning, stacklevel=2)
+ if not isinstance(other, ldns_rdf):
+ raise TypeError("Parameter must be derived from ldns_rdf.")
+ if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+ raise Exception("Operands must be ldns_dname.")
+ return _ldns.ldns_dname_compare(self, other) == -1
+
+ def __le__(self, other):
+ """
+ Compares two dname rdf according to the algorithm for
+ ordering in RFC4034 Section 6.
+
+ :param other: The second dname rdf to compare.
+ :type other: :class:`ldns_dname`
+ :throws TypeError: When `other` of invalid type.
+ :return: (bool) True when `self` is less than or equal to
+ 'other'.
+
+ .. note::
+ The type checking of parameter `other` is benevolent.
+ It allows also to pass a dname :class:`ldns_rdf` object.
+ This will probably change in future.
+ """
+ #
+ # The wrapped function generates asserts instead of setting
+ # error status. They cannot be caught from Python so a check
+ # is necessary.
+ #
+ if (not isinstance(other, ldns_dname)) and \
+ isinstance(other, ldns_rdf) and \
+ other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+ warnings.warn("The ldns_dname.__le__() method will" +
+ " drop the possibility to compare ldns_rdf." +
+ " Convert arguments to ldns_dname.",
+ PendingDeprecationWarning, stacklevel=2)
+ if not isinstance(other, ldns_rdf):
+ raise TypeError("Parameter must be derived from ldns_rdf.")
+ if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+ raise Exception("Operands must be ldns_dname.")
+ return _ldns.ldns_dname_compare(self, other) != 1
+
+ def __eq__(self, other):
+ """
+ Compares two dname rdf according to the algorithm for
+ ordering in RFC4034 Section 6.
+
+ :param other: The second dname rdf to compare.
+ :type other: :class:`ldns_dname`
+ :throws TypeError: When `other` of invalid type.
+ :return: (bool) True when `self` is equal to 'other'.
+
+ .. note::
+ The type checking of parameter `other` is benevolent.
+ It allows also to pass a dname :class:`ldns_rdf` object.
+ This will probably change in future.
+ """
+ #
+ # The wrapped function generates asserts instead of setting
+ # error status. They cannot be caught from Python so a check
+ # is necessary.
+ #
+ if (not isinstance(other, ldns_dname)) and \
+ isinstance(other, ldns_rdf) and \
+ other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+ warnings.warn("The ldns_dname.__eq__() method will" +
+ " drop the possibility to compare ldns_rdf." +
+ " Convert arguments to ldns_dname.",
+ PendingDeprecationWarning, stacklevel=2)
+ if not isinstance(other, ldns_rdf):
+ raise TypeError("Parameter must be derived from ldns_rdf.")
+ if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+ raise Exception("Operands must be ldns_dname.")
+ return _ldns.ldns_dname_compare(self, other) == 0
+
+ def __ne__(self, other):
+ """
+ Compares two dname rdf according to the algorithm for
+ ordering in RFC4034 Section 6.
+
+ :param other: The second dname rdf to compare.
+ :type other: :class:`ldns_dname`
+ :throws TypeError: When `other` of invalid type.
+ :return: (bool) True when `self` is not equal to 'other'.
+
+ .. note::
+ The type checking of parameter `other` is benevolent.
+ It allows also to pass a dname :class:`ldns_rdf` object.
+ This will probably change in future.
+ """
+ #
+ # The wrapped function generates asserts instead of setting
+ # error status. They cannot be caught from Python so a check
+ # is necessary.
+ #
+ if (not isinstance(other, ldns_dname)) and \
+ isinstance(other, ldns_rdf) and \
+ other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+ warnings.warn("The ldns_dname.__ne__() method will" +
+ " drop the possibility to compare ldns_rdf." +
+ " Convert arguments to ldns_dname.",
+ PendingDeprecationWarning, stacklevel=2)
+ if not isinstance(other, ldns_rdf):
+ raise TypeError("Parameter must be derived from ldns_rdf.")
+ if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+ raise Exception("Operands must be ldns_dname.")
+ return _ldns.ldns_dname_compare(self, other) != 0
+
+ def __gt__(self, other):
+ """
+ Compares two dname rdf according to the algorithm for
+ ordering in RFC4034 Section 6.
+
+ :param other: The second dname rdf to compare.
+ :type other: :class:`ldns_dname`
+ :throws TypeError: When `other` of invalid type.
+ :return: (bool) True when `self` is greater than 'other'.
+
+ .. note::
+ The type checking of parameter `other` is benevolent.
+ It allows also to pass a dname :class:`ldns_rdf` object.
+ This will probably change in future.
+ """
+ #
+ # The wrapped function generates asserts instead of setting
+ # error status. They cannot be caught from Python so a check
+ # is necessary.
+ #
+ if (not isinstance(other, ldns_dname)) and \
+ isinstance(other, ldns_rdf) and \
+ other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+ warnings.warn("The ldns_dname.__gt__() method will" +
+ " drop the possibility to compare ldns_rdf." +
+ " Convert arguments to ldns_dname.",
+ PendingDeprecationWarning, stacklevel=2)
+ if not isinstance(other, ldns_rdf):
+ raise TypeError("Parameter must be derived from ldns_rdf.")
+ if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+ raise Exception("Operands must be ldns_dname.")
+ return _ldns.ldns_dname_compare(self, other) == 1
+
+ def __ge__(self, other):
+ """
+ Compares two dname rdf according to the algorithm for
+ ordering in RFC4034 Section 6.
+
+ :param other: The second dname rdf to compare.
+ :type other: :class:`ldns_dname`
+ :throws TypeError: When `other` of invalid type.
+ :return: (bool) True when `self` is greater than or equal to
+ 'other'.
+
+ .. note::
+ The type checking of parameter `other` is benevolent.
+ It allows also to pass a dname :class:`ldns_rdf` object.
+ This will probably change in future.
+ """
+ #
+ # The wrapped function generates asserts instead of setting
+ # error status. They cannot be caught from Python so a check
+ # is necessary.
+ #
+ if (not isinstance(other, ldns_dname)) and \
+ isinstance(other, ldns_rdf) and \
+ other.get_type() == _ldns.LDNS_RDF_TYPE_DNAME:
+ warnings.warn("The ldns_dname.__ge__() method will" +
+ " drop the possibility to compare ldns_rdf." +
+ " Convert arguments to ldns_dname.",
+ PendingDeprecationWarning, stacklevel=2)
+ if not isinstance(other, ldns_rdf):
+ raise TypeError("Parameter must be derived from ldns_rdf.")
+ if (other.get_type() != _ldns.LDNS_RDF_TYPE_DNAME):
+ raise Exception("Operands must be ldns_dname.")
+ return _ldns.ldns_dname_compare(self, other) != -1
+
def cat(self, rd2):
"""
Concatenates rd2 after this dname (`rd2` is copied,
def __cmp__(self, other):
"""
- Compares two rdf's on their wire formats.
+ Compares two rdfs on their wire formats.
(To order dnames according to rfc4034, use ldns_dname_compare.)
:param other: The second one RDF.
:type other: :class:`ldns_rdf`
- :throws TypeError: When other of non-:class:`ldns_rdf` type.
+ :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
:return: (int) -1, 0 or 1 if self comes before other,
is equal or self comes after other respectively.
"""
return _ldns.ldns_rdf_compare(self, other)
-
+
+ def __lt__(self, other):
+ """
+ Compares two rdfs on their formats.
+
+ :param other: The socond one RDF.
+ :type other: :class:`ldns_rdf`
+ :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+ :return: (bool) True when `self` is less than 'other'.
+ """
+ return _ldns.ldns_rdf_compare(self, other) == -1
+
+ def __le__(self, other):
+ """
+ Compares two rdfs on their formats.
+
+ :param other: The socond one RDF.
+ :type other: :class:`ldns_rdf`
+ :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+ :return: (bool) True when `self` is less than or equal to
+ 'other'.
+ """
+ return _ldns.ldns_rdf_compare(self, other) != 1
+
+ def __eq__(self, other):
+ """
+ Compares two rdfs on their formats.
+
+ :param other: The socond one RDF.
+ :type other: :class:`ldns_rdf`
+ :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+ :return: (bool) True when `self` is equal to 'other'.
+ """
+ return _ldns.ldns_rdf_compare(self, other) == 0
+
+ def __ne__(self, other):
+ """
+ Compares two rdfs on their formats.
+
+ :param other: The socond one RDF.
+ :type other: :class:`ldns_rdf`
+ :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+ :return: (bool) True when `self` is not equal to 'other'.
+ """
+ return _ldns.ldns_rdf_compare(self, other) != 0
+
+ def __gt__(self, other):
+ """
+ Compares two rdfs on their formats.
+
+ :param other: The socond one RDF.
+ :type other: :class:`ldns_rdf`
+ :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+ :return: (bool) True when `self` is greater than 'other'.
+ """
+ return _ldns.ldns_rdf_compare(self, other) == 1
+
+ def __ge__(self, other):
+ """
+ Compares two rdfs on their formats.
+
+ :param other: The socond one RDF.
+ :type other: :class:`ldns_rdf`
+ :throws TypeError: When `other` of non-:class:`ldns_rdf` type.
+ :return: (bool) True when `self` is greater than or equal to
+ 'other'.
+ """
+ return _ldns.ldns_rdf_compare(self, other) != -1
+
def print_to_file(self, output):
"""
Prints the data in the rdata field to the given `output` file
def dname_compare(self, other):
"""
- Compares the two dname rdf's according to the algorithm
+ Compares two dname rdf according to the algorithm
for ordering in RFC4034 Section 6.
:param other: The second dname rdf to compare.
:type other: :class:`ldns_rdf`
:throws TypeError: When not a :class:`ldns_rdf` used.
:throws Exception: When not dnames compared.
- :return: (int) -1, 0 or 1 if self comes before other,
- self is equal or self comes after other respectively.
+ :return: (int) -1, 0 or 1 if `self` comes before `other`,
+ `self` is equal or `self` comes after `other` respectively.
.. warning::
# _LDNS_RR_CONSTRUCTORS
#
-
def __str__(self):
"""
Converts the data in the resource record to presentation format.
"""
return _ldns.ldns_rr_compare(self, other)
+ def __lt__(self, other):
+ """
+ Compares two rrs.
+
+ The TTL is not looked at.
+
+ :param other: The second RR one.
+ :type other: :class:`ldns_rr`
+ :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+ :return: (bool) True when `self` is less than 'other'.
+ """
+ return _ldns.ldns_rr_compare(self, other) == -1
+
+ def __le__(self, other):
+ """
+ Compares two rrs.
+
+ The TTL is not looked at.
+
+ :param other: The second RR one.
+ :type other: :class:`ldns_rr`
+ :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+ :return: (bool) True when `self` is less than or equal to
+ 'other'.
+ """
+ return _ldns.ldns_rr_compare(self, other) != 1
+
+ def __eq__(self, other):
+ """
+ Compares two rrs.
+
+ The TTL is not looked at.
+
+ :param other: The second RR one.
+ :type other: :class:`ldns_rr`
+ :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+ :return: (bool) True when `self` is equal to 'other'.
+ """
+ return _ldns.ldns_rr_compare(self, other) == 0
+
+ def __ne__(self, other):
+ """
+ Compares two rrs.
+
+ The TTL is not looked at.
+
+ :param other: The second RR one.
+ :type other: :class:`ldns_rr`
+ :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+ :return: (bool) True when `self` is not equal to 'other'.
+ """
+ return _ldns.ldns_rr_compare(self, other) != 0
+
+ def __gt__(self, other):
+ """
+ Compares two rrs.
+
+ The TTL is not looked at.
+
+ :param other: The second RR one.
+ :type other: :class:`ldns_rr`
+ :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+ :return: (bool) True when `self` is greater than 'other'.
+ """
+ return _ldns.ldns_rr_compare(self, other) == 1
+
+ def __ge__(self, other):
+ """
+ Compares two rrs.
+
+ The TTL is not looked at.
+
+ :param other: The second RR one.
+ :type other: :class:`ldns_rr`
+ :throws TypeError: When `other` of non-:class:`ldns_rr` type.
+ :return: (bool) True when `self` is greater than or equal to
+ 'other'.
+ """
+ return _ldns.ldns_rr_compare(self, other) != -1
+
@staticmethod
def class_by_name(string):
"""
"""
return _ldns.ldns_rr_list_compare(self, rrl2)
+ def __lt__(self, other):
+ """
+ Compares two rr lists.
+
+ :param other: The second one.
+ :type other: :class:`ldns_rr_list`
+ :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+ type.
+ :return: (bool) True when `self` is less than 'other'.
+ """
+ return _ldns.ldns_rr_list_compare(self, other) == -1
+
+ def __le__(self, other):
+ """
+ Compares two rr lists.
+
+ :param other: The second one.
+ :type other: :class:`ldns_rr_list`
+ :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+ type.
+ :return: (bool) True when `self` is less than or equal to
+ 'other'.
+ """
+ return _ldns.ldns_rr_list_compare(self, other) != 1
+
+ def __eq__(self, other):
+ """
+ Compares two rr lists.
+
+ :param other: The second one.
+ :type other: :class:`ldns_rr_list`
+ :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+ type.
+ :return: (bool) True when `self` is equal to 'other'.
+ """
+ return _ldns.ldns_rr_list_compare(self, other) == 0
+
+ def __ne__(self, other):
+ """
+ Compares two rr lists.
+
+ :param other: The second one.
+ :type other: :class:`ldns_rr_list`
+ :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+ type.
+ :return: (bool) True when `self` is not equal to 'other'.
+ """
+ return _ldns.ldns_rr_list_compare(self, other) != 0
+
+ def __gt__(self, other):
+ """
+ Compares two rr lists.
+
+ :param other: The second one.
+ :type other: :class:`ldns_rr_list`
+ :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+ type.
+ :return: (bool) True when `self` is greater than 'other'.
+ """
+ return _ldns.ldns_rr_list_compare(self, other) == 1
+
+ def __ge__(self, other):
+ """
+ Compares two rr lists.
+
+ :param other: The second one.
+ :type other: :class:`ldns_rr_list`
+ :throws TypeError: when `other` of non-:class:`ldns_rr_list`
+ type.
+ :return: (bool) True when `self` is greater than or equal to
+ 'other'.
+ """
+ return _ldns.ldns_rr_list_compare(self, other) != -1
+
def write_to_buffer(self, buffer):
"""
Copies the rr_list data to the buffer in wire format.