A multi-platform programming interface for protocol development Carlos Miguel Tavares Calafate, Pietro Manzoni Polytechnic University of Valencia (Spain)
Our area of research: Requirements: Network interface card control Strong interaction with packet flows – Sending / receiving process – Queue management – Routing table and forwarding process High level of kernel integration Communication protocols for wireless ad-hoc networks. Ex: AODV, DSR, OLSR
Problem Usually developed in Linux using ANSI C. Implementation is too bound to the type of the Operating System Conversion to other operating systems requires re-writing almost from scratch. Result: Windows 2000 and Windows CE users usually have to wait for a long time before these implementations are available.
Solution A library (PICA) that: –Is written in ANSI C –Makes available the required basic functions. –Targets the Linux, Windows NT & Windows CE platforms simultaneously. –Does not introduce great overhead. –Has self-explaining API
management IP Forwarding Threads Logging Privileges Timers Synchronization Sockets PICA NICs Routing table Packet System management primitives Network management primitives
Linux Windows NT Windows CE Common source code Other platforms PICA, PCAP & Std. C Libraries Platform specific binary Compiler
What is achieved? C code that only uses PICA library and standard C functions can be compiled directly on other supported platforms. Conversion of existing protocols to other Operating Systems is faster. New protocols can be created in a shorter period, and be available for all supported O.S. simultaneously.
Implementations with PICA Optimized Link State Routing (OLSR) protocol – Original implementation from INRIA (France) for the Linux platform. – Windows NT and Windows CE versions required only 3 weeks work with PICA. – Enhancements were easy and straightforward.
Example if (PICAgetAvailableDevices(&devs) == 0) { fprintf(stderr,"Error getting available devices\n"); exit(-1); } for (i=0;i<devs.num_devices;i++) { } if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { sprintf(logdata, "socket: %s\n", strerror(errno)); close(s); return; } ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) { sprintf(logdata, "ioctl (get interface configuration)\n", strerror(errno)); close(s); return; } ifr = ifc.ifc_req; cplim = buf + ifc.ifc_len; for (cp = buf; cp ifr_name) + size(ifr->ifr_addr)) { } Original (Linux) With PICA (multiplatform)
Other applications Even though PICA’s originally biased towards ad- hoc routing protocols, it turned out to be quite general purposed: – Network analyzers and sniffers – Software switches – Traffic shapers – Educational programs – etc.
Web page:
Questions?