Dear list, I am writing a daemon in Python that listens on AF_NETLINK and processes RTM_NETLINK messages. FWIW, code is below since there is hardly any reference on the net yet.
As you can see from the code, the NETLINK message is all binary/hex. Before I go about wrapping it in a Python class, I was wondering whether such a class already existed or if someone is already working on this. Please let me know if you are or have any hints, and please keep me on CC. Thanks, m Python 2.5.1 (r251:54863, Apr 25 2007, 22:53:30) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from socket import * >>> from select import * >>> s = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE) >>> from os import getpid >>> RTMGRP_LINK = 1 >>> s.bind((getpid(), RTMGRP_LINK)) >>> p = select((s,), (), (), 0) >>> p ([], [], []) >>> # connect device ... >>> p = select((s,), (), (), 0) >>> p ([<socket._socketobject object at 0xb7d9b374>], [], []) >>> s2 = p[0][0] >>> d = s2.recv(4096) >>> d '\xf8\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x0c\x00\x00\x00\x02\x10\x00\x00\xff\xff\xff\xff\t\x00\x03\x00eth0\x00\x00\x00\x00\x08\x00\r\x00\xe8\x03\x00\x00\x08\x00\x0f\x00\x00\x00\x00\x00\x05\x00\x10\x00\x02\x00\x00\x00\x05\x00\x11\x00\x00\x00\x00\x00\x08\x00\x04\x00\xdc\x05\x00\x00\t\x00\x06\x00noop\x00\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x01\x00N\x80\xba~4\x14\x00\x00\n\x00\x02\x00\xff\xff\xff\xff\xff\xff\x00\x00`\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" [EMAIL PROTECTED] spamtraps: [EMAIL PROTECTED] "men always want to be a woman's first love. women have a more subtle instinct: what they like is to be a man's last romance." -- oscar wilde
signature.asc
Description: Digital signature (GPG/PGP)
-- http://mail.python.org/mailman/listinfo/python-list