diff --git a/zig-impl/apps/ipcd.zig b/zig-impl/apps/ipcd.zig index 55468dc..1ed09f1 100644 --- a/zig-impl/apps/ipcd.zig +++ b/zig-impl/apps/ipcd.zig @@ -107,7 +107,7 @@ fn create_service() !void { break; }, - .MESSAGE => { + .MESSAGE_RX => { print("Client asking for a service through ipcd.\n", .{}); defer ctx.close_fd (some_event.origin) catch {}; if (some_event.m) |m| { @@ -206,7 +206,7 @@ fn create_service() !void { } }, - .TX => { + .MESSAGE_TX => { print("Message sent.\n", .{}); }, diff --git a/zig-impl/apps/pong.zig b/zig-impl/apps/pong.zig index 4074bb5..9553b68 100644 --- a/zig-impl/apps/pong.zig +++ b/zig-impl/apps/pong.zig @@ -43,7 +43,7 @@ pub fn main() !u8 { print("Timer!\n", .{}); }, - .MESSAGE => { + .MESSAGE_RX => { if (some_event.m) |m| { print("message has been bounced: {}\n", .{m}); m.deinit(); @@ -55,7 +55,7 @@ pub fn main() !u8 { } }, - .TX => { + .MESSAGE_TX => { print("Message sent.\n", .{}); }, diff --git a/zig-impl/apps/pongd.zig b/zig-impl/apps/pongd.zig index 32e509b..d7fd420 100644 --- a/zig-impl/apps/pongd.zig +++ b/zig-impl/apps/pongd.zig @@ -79,7 +79,7 @@ fn create_service() !void { , .{some_event.origin, ctx.pollfd.items.len}); }, - .MESSAGE => { + .MESSAGE_RX => { if (some_event.m) |m| { print("New message ({} bytes)\n", .{m.payload.len}); util.print_message ("RECEIVED MESSAGE", m); @@ -92,7 +92,7 @@ fn create_service() !void { } }, - .TX => { + .MESSAGE_TX => { print("Message sent.\n", .{}); }, diff --git a/zig-impl/apps/tcpd.zig b/zig-impl/apps/tcpd.zig index cdae618..7505cf3 100644 --- a/zig-impl/apps/tcpd.zig +++ b/zig-impl/apps/tcpd.zig @@ -185,7 +185,7 @@ fn create_service() !void { print ("Message has been sent (SWITCH fd {}).\n", .{some_event.origin}); }, - .MESSAGE => { + .MESSAGE_RX => { print ("Client asking for a service through TCPd.\n", .{}); errdefer ctx.close (some_event.index) catch {}; if (some_event.m) |m| { @@ -240,7 +240,7 @@ fn create_service() !void { } }, - .TX => { + .MESSAGE_TX => { print ("Message sent.\n", .{}); }, diff --git a/zig-impl/libipc.h b/zig-impl/libipc.h index 7250ca1..717fb24 100644 --- a/zig-impl/libipc.h +++ b/zig-impl/libipc.h @@ -5,14 +5,14 @@ enum event_types { ERROR = 0 // A problem occured. - , EXTERNAL = 1 // Message received from a non IPC socket. - , SWITCH_RX = 2 // Message received from a switched FD. - , SWITCH_TX = 3 // Message sent to a switched fd. - , CONNECTION = 4 // New user. - , DISCONNECTION = 5 // User disconnected. - , MESSAGE = 6 // New message. - , TIMER = 7 // Timeout in the poll(2) function. - , TX = 8 // Message sent. + , CONNECTION = 1 // New user. + , DISCONNECTION = 2 // User disconnected. + , MESSAGE_RX = 3 // New message. + , MESSAGE_TX = 4 // Message sent. + , TIMER = 5 // Timeout in the poll(2) function. + , EXTERNAL = 6 // Message received from a non IPC socket. + , SWITCH_RX = 7 // Message received from a switched FD. + , SWITCH_TX = 8 // Message sent to a switched fd. }; // Return type of callback functions when switching. diff --git a/zig-impl/src/context.zig b/zig-impl/src/context.zig index bd900d0..235137c 100644 --- a/zig-impl/src/context.zig +++ b/zig-impl/src/context.zig @@ -439,7 +439,7 @@ pub const Context = struct { }; if (maybe_message) |m| { - return Event.init(Event.Type.MESSAGE, i, fd.fd, m); + return Event.init(Event.Type.MESSAGE_RX, i, fd.fd, m); } try self.close(i); @@ -486,7 +486,7 @@ pub const Context = struct { // otherwise = write message for the msg.fd try self.write (m); m.deinit(); - return Event.init(Event.Type.TX, i, fd.fd, null); + return Event.init(Event.Type.MESSAGE_TX, i, fd.fd, null); } } // .revent is POLLHUP diff --git a/zig-impl/src/event.zig b/zig-impl/src/event.zig index 001b71e..2b82ac2 100644 --- a/zig-impl/src/event.zig +++ b/zig-impl/src/event.zig @@ -35,14 +35,14 @@ pub const Event = struct { pub const Type = enum { ERROR, // A problem occured. + CONNECTION, // New user. + DISCONNECTION, // User disconnected. + MESSAGE_RX, // New message. + MESSAGE_TX, // Message sent. + TIMER, // Timeout in the poll(2) function. EXTERNAL, // Message received from a non IPC socket. SWITCH_RX, // Message received from a switched FD. SWITCH_TX, // Message sent to a switched fd. - CONNECTION, // New user. - DISCONNECTION, // User disconnected. - MESSAGE, // New message. - TIMER, // Timeout in the poll(2) function. - TX, // Message sent. }; t: Event.Type,