开发者

TIPC networking protocol in Linux

开发者 https://www.devze.com 2022-12-31 22:09 出处:网络
How should I program to use TIPC networking protocol, that comes with linux kernel (CONFIG_TIPC xconfig parameter) ?开发者_JAVA百科

How should I program to use TIPC networking protocol, that comes with linux kernel (CONFIG_TIPC xconfig parameter) ?

开发者_JAVA百科

Is there any applications, which uses TIPC?


TIPC is intended for communication in high availability computer clusters. The main addressing sheme is focused on service rather than location. TIPC can also use several "bearers" for redundancy and provides functions for link and processor supervision.

Unless you are working with computer clusters you should probably not use TIPC.

TIPC uses the standard socket interface. You must configure the processors in the cluster before you can use TIPC between processors.

One application using TIPC is "Open SAF" http://www.opensaf.org/. Not suprisingly a high availability cluster sw.


While evaluating TIPC(i am also new to this), I found some excellent demo examples here. may be someone will find them useful too


TIPC stands for “Transparent Inter-Process Communication”.

Before using it, you should check your linux kernel version to be sure it enabled on your system (anyway you can add it).

Basically, if you do want to communicate between two or more process/threads in linux, you should use the TIPC (if you need the IP layer, or any other layer, I’m not sure TIPC is the best option).

Using TIPC protocol type, you should use “struct sockaddr_tipc” that contain the following fields:

.family = AF_TIPC;

.addrtype = TIPC_ADDR_NAMESEQ; (or …_MCAST, … _NAME,… _ID)

.scope = TIPC_ZONE_SCOPE;  (or …CLUSTER…, …NODE…)

.addr.nameseq.type = TIPC_APP_TYPE_ANY_NUMBER_IS_GOOD;

.addr.nameseq.lower = 1;

.addr.nameseq.upper = 1024;


I had no idea what TIPC was, but I Googled an indication that it could be accessed as "sockets of the AF_TIPC address family".

In this case, you should be able to access it through the regular socket mechanism, like any other socket type:

  struct sockaddr_in Foo;
  ...
  memset(&Foo, 0, sizeof(Foo));     // Init address struct.
  Foo.sin_family = AF_TIPC;         // Instead of the usual AF_INET
  etc.

Documentation (that includes examples) is there. And the documentation mentions that TIPC has a "native" API as well.


TIPC is a pretty amazing protocol for cluster-like environments.

It deserves a lot more attention than it's currently getting (it was recently in the news for some security incident in the Linux kernel).

In my opinion, TIPC's main selling points are:

  1. Service-type addressing

    You want to talk to a service, not some machine that may or may not respond. TIPC takes care of a lot of the housekeeping.

  2. Quick, transparent failover

    TIPC detects if a participating node no longer responds, and another one takes over. Nothing to worry about yourself.

  3. Service ranges

    Nodes can listen on a range of service IDs. So if you have something that can be divided among different service workers, TIPC allows you to call the desired service address, and TIPC and the worker nodes figure out who responds to it.

  4. Bare metal or UDP/IP

    TIPC runs either on top of Ethernet, Infiniband or an arbitrary UDP IP connection, almost reaching the performance of TCP/IP. It supports both "reliable" (guaranteed delivery) as well as "unreliable" messaging (messages may drop)

Some downsides:

  1. Not enough users, small community

    Not many people know about TIPC, let alone use it. You won't find many tutorials, and there are still some bugs to iron out.

  2. Outdated documentation, implementation

    There's still some outdated documentation floating around mentioning cluster zones, which are no longer a thing. The command-line tools also got a refresher (tipc is the right tool now).

    You should really use a new Linux kernel, something like 5.15 or newer seems to be work well.

  3. Setup

    In order to start playing with TIPC, you not only need to load a kernel module, you also need to tell TIPC where to communicate.

    To enable it on eth0, for example, use:

     sudo tipc bearer enable media eth device eth0
    
  4. Tooling, addressing

    Many tools know how to talk to IP sockets (AF_INET), most don't know about AF_TIPC. It's actually quite hard to modify existing code because there's no trivial mapping from, say, a hostname to a TIPC address.

I've written two tools that simplify working with TIPC (and other socket types). You may find them useful, one way or the other:

  1. unsock — shim to automatically change AF_INET sockets to AF_UNIX, AF_VSOCK, AF_TIPC, etc.

    Examples: Python HTTP server via TIPC

  2. junixsocket — Java library to natively talk to AF_TIPC, AF_UNIX, AF_VSOCK, etc.

    Examples: Introduction to TIPC, High-availability HTTP server


Software:

http://www.google.com/codesearch?ie=UTF-8&q=AF_TIPC

CodeResults 1 - 10 of 587. (0.36 seconds)

0

精彩评论

暂无评论...
验证码 换一张
取 消