tvnet - Take Vos's network library ================================== This library is a base for running TIPC services. Cluster ID ---------- A 64 bit signed integer which is unique inside the cluster. The number is based on the time created by the tvu_time(). The lower 12 bits are replaced by the TIPC node id. If two ids are retrieved in close succession, the time will be incremented beyond the current time. tvn_cuid() is implemented as a wait-free algorithm. However tvu_time() uses clock_gettime() which is implemented as a lock-free algorithm, however practically it is wait-free since only the kernel clock synchronization can cause a retry. Service ------- The service calls are for opening a TIPC socket for both server and client side. Most calls require a 64 bit service_nr. A positive number is translated into a well known port name, while negative numbers represent port numbers for direct communication to the process. On operating systems which do not support TIPC, these functions will fall back to using UNIX domain sockets which only work on a single host. The UNIX domain fallback is only supposed to be used for development. Pickleling format ------------------ null, integers, reals, strings, byte arrays, lists and dictionaries can be serialized using a simple byte oriented format. It was designed to be a compact binary version of JSON. All code points have been used, so that it can not be extended in the future, this was by design. Numbers are automatically converted from double->float->integer when there is no loss in precision. 0VVVVVVV 7 bit signed integer value. (-16 values at negative end) 01000101 2 x VVVVVVVV Big-Endian 16-bit signed integer value -59 -x45 01000000 4 x VVVVVVVV Big-Endian 32-bit signed integer value -60 0x44 01000011 8 x VVVVVVVV Big-Endian 64-bit signed integer value -61 0x43 01000010 4 x VVVVVVVV Big-Endian 32 Bit float -62 0x42 01000001 8 x VVVVVVVV Big-Endian 64 Bit float -63 0x41 01000000 NULL -64 0x40 100SSSSS UTF-8 string with 5 bit length (-3 size at end) (excluding the nul) 10011101 1 x SSSSSSSS UTF-8 string with 8 bit length (excluding the nul) 10011110 2 x SSSSSSSS UTF-8 string with 16 bit length (excluding the nul) 10011111 4 x SSSSSSSS UTF-8 string with 32 bit length (excluding the nul) 101SSSSS Binary string with 5 bit length (-3 size at end) 10111101 1 x SSSSSSSS Binary string with 8 bit length 10111110 2 x SSSSSSSS Binary string with 16 bit length 10111111 4 x SSSSSSSS Binary string with 32 bit length 110LLLLL List with 5 bit nr of items (-3 values at end) 11011101 1 x LLLLLLLL List with 8 bit nr of items 11011110 2 x LLLLLLLL List with 16 bit nr of items 11011111 4 x LLLLLLLL List with 32 bit nr of items 111LLLLL Dictionary with 5 bit nr of key-value pairs (-3 values at end) 11111101 1 x LLLLLLLL Dictionary with 8 bit nr of key-value pairs 11111110 2 x LLLLLLLL Dictionary with 16 bit nr of key-value pairs 11111111 4 x LLLLLLLL Dictionary with 32 bit nr of key-value pairs Logging ------- The main macros for logging information in your applications are: - TVNL_FATAL(fmt, ...) - TVNL_ERROR(fmt, ...) - TVNL_WARNING(fmt, ...) - TVNL_INFO(fmt, ...) - TVNL_DEBUG(fmt, ...) Log messages are stored unformated in shared-memory ring buffer. The log server will dump the messages into files after formatting.