Better presentation, for the ones only reading it online.
parent
bf600e0889
commit
513348652e
|
@ -137,6 +137,7 @@ LibIPC has a high level API for the user
|
||||||
listening to file descriptors (libIPC ones or not)
|
listening to file descriptors (libIPC ones or not)
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
wait_event (context, &event, &timer)
|
wait_event (context, &event, &timer)
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
@ -153,14 +154,15 @@ LibIPC has a high level API for the user
|
||||||
|
|
||||||
3. send messages
|
3. send messages
|
||||||
|
|
||||||
|
```c
|
||||||
struct ipc_message m
|
struct ipc_message m
|
||||||
m.payload = ...
|
m.payload = ...
|
||||||
m.length = strlen(m.payload)
|
m.length = strlen(m.payload)
|
||||||
m.fd = event.fd
|
m.fd = event.fd
|
||||||
m.type = ...
|
m.type = ...
|
||||||
m.user_type = ...
|
m.user_type = ...
|
||||||
|
|
||||||
ipc_write (context, &m)
|
ipc_write (context, &m)
|
||||||
|
```
|
||||||
|
|
||||||
#pause
|
#pause
|
||||||
4. add and remove fd from the context
|
4. add and remove fd from the context
|
||||||
|
@ -194,6 +196,7 @@ Main goal: simplest possible structures
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
Message
|
Message
|
||||||
|
|
||||||
struct ipc_message {
|
struct ipc_message {
|
||||||
char type; => Internal message type, used by protocol daemons.
|
char type; => Internal message type, used by protocol daemons.
|
||||||
char user_type; => User-defined message type (arbitrary).
|
char user_type; => User-defined message type (arbitrary).
|
||||||
|
@ -203,6 +206,7 @@ Examples:
|
||||||
};
|
};
|
||||||
|
|
||||||
Context of the whole networking state
|
Context of the whole networking state
|
||||||
|
|
||||||
struct ipc_ctx {
|
struct ipc_ctx {
|
||||||
struct ipc_connection_info *cinfos; => Keeps track of connections.
|
struct ipc_connection_info *cinfos; => Keeps track of connections.
|
||||||
struct pollfd *pollfd; => List of "pollfd" structures within cinfos,
|
struct pollfd *pollfd; => List of "pollfd" structures within cinfos,
|
||||||
|
|
Reference in New Issue