C implementation: new LibIPC API.

master
Philippe PITTOLI 2024-06-16 01:15:54 +02:00
parent 2a8b4a198f
commit 6b9c65a549
2 changed files with 5 additions and 3 deletions

View File

@ -26,6 +26,7 @@ int main(void) {
char event_type;
size_t index = 0;
int originfd = 0;
int newfd = 0;
void *ctx = NULL;
printf ("Init context.\n");
@ -58,7 +59,7 @@ int main(void) {
size_t count = 0;
while(should_continue) {
size = MAX_MSG_SIZE;
ret = ipc_wait_event (ctx, &event_type, &index, &originfd, message, &size);
ret = ipc_wait_event (ctx, &event_type, &index, &originfd, &newfd, message, &size);
if (ret != 0) {
return err(ctx, "Error while waiting for an event.");
}

View File

@ -23,6 +23,7 @@ int main(int argc, char**argv) {
char event_type;
size_t index = 0;
int originfd = 0;
int newfd = 0;
void *ctx = NULL;
int max_count = 0;
@ -56,7 +57,7 @@ int main(int argc, char**argv) {
size_t count_timer = 0;
while(should_continue) {
size = MAX_MSG_SIZE;
ret = ipc_wait_event (ctx, &event_type, &index, &originfd, message, &size);
ret = ipc_wait_event (ctx, &event_type, &index, &originfd, &newfd, message, &size);
if (ret != 0) {
return err (ctx, "Error while waiting for an event.");
}
@ -70,7 +71,7 @@ int main(int argc, char**argv) {
case EXTERNAL: return err(ctx, "External (shouldn't happen).");
case SWITCH_RX: return err(ctx, "Switch RX (shouldn't happen).");
case SWITCH_TX: return err(ctx, "Switch TX (shouldn't happen).");
case CONNECTION: { printf ("New connection.\n"); break; }
case CONNECTION: { printf ("New connection (%d).\n", newfd); break; }
case DISCONNECTION: { printf ("User disconnected.\n"); break; }
case TIMER: {