Hello, I get it building after I found the reason: type is an reserved word now. After modify type to type2 all is fine.
A patch is attached. Please build the python bindings as package now. Best regards Christoph -- Linux User Group Wernigerode http://www.lug-wr.de/
--- python/dnet.pyx.orig 2006-01-19 07:09:01.000000000 +0100 +++ python/dnet.pyx 2008-10-27 08:33:30.000000000 +0100 @@ -70,7 +70,7 @@ char *__eth_ntoa "eth_ntoa" (eth_addr_t *buf) int __eth_aton "eth_aton" (char *src, eth_addr_t *dst) void __eth_pack_hdr "eth_pack_hdr" (char *h, - eth_addr_t dst, eth_addr_t src, int type) + eth_addr_t dst, eth_addr_t src, int type2) ETH_ADDR_LEN = 6 ETH_ADDR_BITS = 48 @@ -159,20 +159,19 @@ raise ValueError, "invalid Ethernet address" return PyString_FromStringAndSize(ea.data, 6) -def eth_pack_hdr(dst=ETH_ADDR_BROADCAST, src=ETH_ADDR_BROADCAST, - type=ETH_TYPE_IP): +def eth_pack_hdr(dst=ETH_ADDR_BROADCAST, src=ETH_ADDR_BROADCAST,type2=ETH_TYPE_IP): """Return a packed binary string representing an Ethernet header. Keyword arguments: dst -- destination address (6-byte binary string) src -- source address (6-byte binary string) - type -- Ethernet payload type (ETH_TYPE_*) (16-bit integer) + type2 -- Ethernet payload type (ETH_TYPE_*) (16-bit integer) """ cdef char hdr[14] cdef eth_addr_t s, d __memcpy(s.data, src, 6) __memcpy(d.data, dst, 6) - __eth_pack_hdr(hdr, d, s, type) + __eth_pack_hdr(hdr, d, s, type2) return PyString_FromStringAndSize(hdr, 14) # @@ -434,14 +433,14 @@ ADDR_TYPE_IP6 = 3 cdef class addr: - """addr(addrtxt=None, type=ADDR_TYPE_NONE) -> network address object + """addr(addrtxt=None, type2=ADDR_TYPE_NONE) -> network address object Create a network address object, optionally initialized from a human-readable Ethernet, IP, or IPv6 address string. """ cdef addr_t _addr - def __init__(self, addrtxt=None, type=ADDR_TYPE_NONE): + def __init__(self, addrtxt=None, type2=ADDR_TYPE_NONE): if addrtxt != None and addr_aton(addrtxt, &self._addr) < 0: if PyString_Size(addrtxt) == 4: self._addr.addr_type = ADDR_TYPE_IP @@ -450,7 +449,7 @@ else: raise ValueError, "invalid network address" - property type: + property type2: """Address type (ADDR_TYPE_*) integer.""" def __get__(self): return self._addr.addr_type @@ -783,17 +782,17 @@ # icmp.h # cdef extern from *: - void __icmp_pack_hdr "icmp_pack_hdr" (char *hdr, int type, int code) + void __icmp_pack_hdr "icmp_pack_hdr" (char *hdr, int type2, int code) -def icmp_pack_hdr(type, code): +def icmp_pack_hdr(type2, code): """Return a packed binary string representing an ICMP header. Keyword arguments: - type -- ICMP type (8-bit integer) + type2 -- ICMP type (8-bit integer) code -- ICMP code (8-bit integer) """ cdef char buf[4] - __icmp_pack_hdr(buf, type, code) + __icmp_pack_hdr(buf, type2, code) return PyString_FromStringAndSize(buf, sizeof(buf)) # @@ -925,7 +924,7 @@ cdef object ifent_to_dict(intf_entry *entry): d = {} d['name'] = entry.intf_name - d['type'] = entry.intf_type + d['type2'] = entry.intf_type d['flags'] = entry.intf_flags d['mtu'] = entry.intf_mtu if entry.intf_addr.addr_type != ADDR_TYPE_NONE:
signature.asc
Description: This is a digitally signed message part.