# Connector - unified userspace <-> kernelspace linker

## ConiKost

Hallo!

Kann mir jemand sagen wofür diese Option im Kernel gut sein soll?!

```

Connector - unified userspace <-> kernelspace linker

```

----------

## ConiKost

Niemand ne Idee?

----------

## ruth

Doch...  :Wink: 

Schau mal:

```

From: Evgeniy Polyakov

Date: Thu Sep 23 2004 - 14:55:18 EST

[...]

Connector driver adds possibility to connect various agents using

netlink based network.

One must register callback and identificator. When driver receives

special netlink message with appropriate identificator, appropriate

callback will be called.

>From the userspace point of view it's quite straightforward:

socket();

bind();

send();

recv();

But if kernespace want to use full power of such connections, driver

writer must create special sockets, must know about struct skbuff

handling...

Following driver allows any kernelspace agents to use netlink based

networking for inter-process communication in a significantly easier

way:

register_callback(id, callback_function);

cn_connector_send();

where id is currently two 32bit values which can be considered as

name + id.

Current driver offers just transport layer but with fixed header.

Recommended protocol using such header is following:

msg->seq and msg->ack are used to determine message genealogy.

When someone sends message it puts there locally unique sequence

and random acknowledge numbers.

Sequence number may be copied into nlmsghdr->nlmsg_seq too.

Sequence number is incremented with each message to be sent.

If we expect reply to our message, then sequence number in received

message MUST be the same as in original message, and acknowledge

number MUST be the same + 1.

If we receive message and it's sequence number is not equal to one

we are expecting, then it is new message.

If we receive message and it's sequence number is the same as one we

are expecting, but it's acknowledge is not equal acknowledge number

in original message + 1, then it is new message.

Obviously, protocol header contains above id.

As a bonus, suggested by Jamal Hadi Salim in netdev@ maillist,

connector driver allows event notification in the following form:

kernel driver or userspace process can ask connector to notify it

when selected id's will be turned on or off(registered or unregistered

it's callback). It is done by sending special command to connector

driver(it also registers itself with id={-1, -1}).

Created schema contains large reserve for different future extensions.

All previous mentioned problems are successfully resolved.

[...]

```

Alles gut?

Gruss,

ruth

----------

