Copyright update for 2011
[bcusdk.git] / eibd / backend / eibnetrouter.h
blobdb2d2cd7b683c069d46141792f95d067196de456
1 /*
2 EIBD eib bus access and management daemon
3 Copyright (C) 2005-2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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