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.
25 /** stores a registered busmonitor callback */
28 L_Busmonitor_CallBack
*cb
;
31 /** stores a registered broadcast callback */
37 /** stores a registered group callback */
41 /** group address, for which the frames should be delivered */
47 /** perform no locking */
49 /** pervent other connections of Individual_Lock_Connection */
50 Individual_Lock_Connection
53 /** stores a registered individual callback */
57 /** source address, from which the frames should be delivered */
59 /** destiation address, for which the frames should be delivered */
61 /** lock of the connection */
72 /** Layer 3 frame dispatches */
73 class Layer3
:private Thread
75 /** Layer 2 interface */
76 Layer2Interface
*layer2
;
79 /** working mode (bus monitor/normal operation) */
81 Array
< IgnoreInfo
> ignore
;
83 /** busmonitor callbacks */
84 Array
< Busmonitor_Info
> busmonitor
;
85 /** vbusmonitor callbacks */
86 Array
< Busmonitor_Info
> vbusmonitor
;
87 /** broadcast callbacks */
88 Array
< Broadcast_Info
> broadcast
;
89 /** group callbacks */
90 Array
< Group_Info
> group
;
91 /** individual callbacks */
92 Array
< Individual_Info
> individual
;
94 void Run (pth_sem_t
* stop
);
96 Layer3 (Layer2Interface
* l2
, Trace
* tr
);
99 /** register a busmonitor callback, return true, if successful*/
100 bool registerBusmonitor (L_Busmonitor_CallBack
* c
);
101 /** register a vbusmonitor callback, return true, if successful*/
102 bool registerVBusmonitor (L_Busmonitor_CallBack
* c
);
103 /** register a broadcast callback, return true, if successful*/
104 bool registerBroadcastCallBack (L_Data_CallBack
* c
);
105 /** register a group callback, return true, if successful
107 * @param addr group address (0 means all)
109 bool registerGroupCallBack (L_Data_CallBack
* c
, eibaddr_t addr
);
110 /** register a individual callback, return true, if successful
112 * @param src source individual address (0 means all)
113 * @param dest destination individual address (0 means default address)
114 * @param lock Locktype of the connection
116 bool registerIndividualCallBack (L_Data_CallBack
* c
, Individual_Lock lock
,
117 eibaddr_t src
, eibaddr_t dest
= 0);
119 /** deregister a busmonitor callback, return true, if successful*/
120 bool deregisterBusmonitor (L_Busmonitor_CallBack
* c
);
121 /** deregister a vbusmonitor callback, return true, if successful*/
122 bool deregisterVBusmonitor (L_Busmonitor_CallBack
* c
);
123 /** register a broadcast callback, return true, if successful*/
124 bool deregisterBroadcastCallBack (L_Data_CallBack
* c
);
125 /** deregister a group callback, return true, if successful
127 * @param addr group address (0 means all)
129 bool deregisterGroupCallBack (L_Data_CallBack
* c
, eibaddr_t addr
);
130 /** register a individual callback, return true, if successful
132 * @param src source individual address (0 means all)
133 * @param dest destination individual address (0 means default address)
135 bool deregisterIndividualCallBack (L_Data_CallBack
* c
, eibaddr_t src
,
137 /** sends a L_Data frame asynchronouse */
138 void send_L_Data (L_Data_PDU
* l
);