Implement connectionless management client
[bcusdk.git] / eibd / backend / eibnetrouter.h
blobbd2f9547685d2e85d2723e0a93f212f7b41e2aec
1 /*
2 EIBD eib bus access and management daemon
3 Copyright (C) 2005-2009 Martin Koegler <mkoegler@auto.tuwien.ac.at>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef EIBNET_ROUTER_H
21 #define EIBNET_ROUTER_H
23 #include "layer2.h"
24 #include "eibnetip.h"
26 /** EIBnet/IP routing backend */
27 class EIBNetIPRouter:public Layer2Interface, private Thread
29 /** debug output */
30 Trace *t;
31 /** default address */
32 eibaddr_t addr;
33 /** EIBnet/IP socket */
34 EIBNetIPSocket *sock;
35 /** state */
36 int mode;
37 /** vbusmonitor */
38 int vmode;
39 /** semaphore for outqueue */
40 pth_sem_t out_signal;
41 /** output queue */
42 Queue < LPDU * >outqueue;
43 /** event to wait for outqueue */
44 pth_event_t getwait;
46 void Run (pth_sem_t * stop);
47 public:
48 EIBNetIPRouter (const char *multicastaddr, int port, eibaddr_t a,
49 Trace * tr);
50 virtual ~ EIBNetIPRouter ();
51 bool init ();
53 void Send_L_Data (LPDU * l);
54 LPDU *Get_L_Data (pth_event_t stop);
56 bool addAddress (eibaddr_t addr);
57 bool addGroupAddress (eibaddr_t addr);
58 bool removeAddress (eibaddr_t addr);
59 bool removeGroupAddress (eibaddr_t addr);
61 bool enterBusmonitor ();
62 bool leaveBusmonitor ();
63 bool openVBusmonitor ();
64 bool closeVBusmonitor ();
66 bool Open ();
67 bool Close ();
68 eibaddr_t getDefaultAddr ();
69 bool Connection_Lost ();
70 bool Send_Queue_Empty ();
73 #endif