2 -- Copyright (C) 2012 Reto Buerki
3 -- Copyright (C) 2012 Adrian-Ken Rueegsegger
5 -- Copyright (C) secunet Security Networks AG
7 -- This program is free software; you can redistribute it and/or modify it
8 -- under the terms of the GNU General Public License as published by the
9 -- Free Software Foundation; either version 2 of the License, or (at your
10 -- option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 -- This program is distributed in the hope that it will be useful, but
13 -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 with Anet.Sockets.Unix;
19 with Anet.Receivers.Stream;
21 with Tkmrpc.Dispatchers.Ees;
22 with Tkmrpc.Process_Stream;
24 pragma Elaborate_All (Anet.Receivers.Stream);
25 pragma Elaborate_All (Tkmrpc.Process_Stream);
27 package body Esa_Event_Service
30 package Unix_TCP_Receiver is new Anet.Receivers.Stream
31 (Socket_Type => Anet.Sockets.Unix.TCP_Socket_Type,
32 Address_Type => Anet.Sockets.Unix.Full_Path_Type,
33 Accept_Connection => Anet.Sockets.Unix.Accept_Connection);
35 procedure Dispatch is new Tkmrpc.Process_Stream
36 (Dispatch => Tkmrpc.Dispatchers.Ees.Dispatch,
37 Address_Type => Anet.Sockets.Unix.Full_Path_Type);
39 Sock : aliased Anet.Sockets.Unix.TCP_Socket_Type;
40 Receiver : Unix_TCP_Receiver.Receiver_Type (S => Sock'Access);
42 -------------------------------------------------------------------------
50 -------------------------------------------------------------------------
52 procedure Init (Address : Interfaces.C.Strings.chars_ptr)
54 Path : constant String := Interfaces.C.Strings.Value (Address);
57 Sock.Bind (Path => Anet.Sockets.Unix.Path_Type (Path));
58 Receiver.Listen (Callback => Dispatch'Access);
61 end Esa_Event_Service;