예제 #1
0
 def __init__(self, bytes=None, **kv):
     """The actual message is a set of key/value pairs encoded
     after the header.
     """
     key = pcs.LengthValueField("key", 16)
     value = pcs.LengthValueField("value", 16)
     pcs.Packet.__init__(self, [key, value], bytes=bytes, **kv)
예제 #2
0
    def __init__(self, bytes=None):
        """initialize a DNS resource record, which encodes data returned from a query"""
        name = pcs.LengthValueField("name", 8)
        type = pcs.Field("type", 16)
        qclass = pcs.Field("query_class", 16)
        ttl = pcs.Field("ttl", 16)
        rdata = pcs.LengthValueField("rdata", 16)

        pcs.Packet.__init__(self, [name, type, qclass, ttl, rdata],
                            bytes=bytes)

        self.description = "DNS Resource Record"
예제 #3
0
파일: dns.py 프로젝트: victorlawn/PCS
    def __init__(self, bytes=None):
        """initialize a DNS resource record, which encodes data returned from a query"""
        #name = pcs.LengthValueField("name", pcs.Field("", 8),
        #                             pcs.StringField("", (2 ** 8) * 8))
        name = pcs.LengthValueField("name", pcs.Field("", 8),
                                    pcs.StringField("", 2**4 * 8))  # XXX
        type = pcs.Field("type", 16)
        qclass = pcs.Field("query_class", 16)
        ttl = pcs.Field("ttl", 32)
        #rdata = pcs.LengthValueField("rdata", pcs.Field("", 16),
        #                             pcs.StringField("", (2 ** 16) * 8))
        rdata = pcs.LengthValueField("rdata", pcs.Field("", 16),
                                     pcs.StringField("", 2**4 * 8))  # XXX

        pcs.Packet.__init__(self, [name, type, qclass, ttl, rdata],
                            bytes=bytes)

        self.description = "DNS Resource Record"
예제 #4
0
    def __init__(self, bytes=None):
        """initialize a DNS label, which is a component of a domain name"""
        name = pcs.LengthValueField("name", 8)
        pcs.Packet.__init__(self, [name], bytes=bytes)

        self.description = "DNS Label"