iceoryx_binding_c  2.0.2
listener.h
1 // Copyright (c) 2021 - 2022 Apex.AI Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // SPDX-License-Identifier: Apache-2.0
16 
17 #ifndef IOX_BINDING_C_LISTENER_H
18 #define IOX_BINDING_C_LISTENER_H
19 
20 #include "iceoryx_binding_c/client.h"
21 #include "iceoryx_binding_c/enums.h"
22 #include "iceoryx_binding_c/internal/c2cpp_binding.h"
23 #include "iceoryx_binding_c/server.h"
24 #include "iceoryx_binding_c/service_discovery.h"
25 #include "iceoryx_binding_c/subscriber.h"
26 #include "iceoryx_binding_c/types.h"
27 #include "iceoryx_binding_c/user_trigger.h"
28 
29 typedef CLASS Listener* iox_listener_t;
30 
31 
35 iox_listener_t iox_listener_init(iox_listener_storage_t* self);
36 
39 void iox_listener_deinit(iox_listener_t const self);
40 
47 ENUM iox_ListenerResult iox_listener_attach_subscriber_event(iox_listener_t const self,
48  iox_sub_t const subscriber,
49  const ENUM iox_SubscriberEvent subscriberEvent,
50  void (*callback)(iox_sub_t));
51 
60 ENUM iox_ListenerResult
61 iox_listener_attach_subscriber_event_with_context_data(iox_listener_t const self,
62  iox_sub_t const subscriber,
63  const ENUM iox_SubscriberEvent subscriberEvent,
64  void (*callback)(iox_sub_t, void*),
65  void* const contextData);
66 
72 ENUM iox_ListenerResult iox_listener_attach_user_trigger_event(iox_listener_t const self,
73  iox_user_trigger_t const userTrigger,
74  void (*callback)(iox_user_trigger_t));
75 
83 ENUM iox_ListenerResult iox_listener_attach_user_trigger_event_with_context_data(iox_listener_t const self,
84  iox_user_trigger_t const userTrigger,
85  void (*callback)(iox_user_trigger_t,
86  void*),
87  void* const contextData);
88 
93 void iox_listener_detach_subscriber_event(iox_listener_t const self,
94  iox_sub_t const subscriber,
95  const ENUM iox_SubscriberEvent subscriberEvent);
96 
100 void iox_listener_detach_user_trigger_event(iox_listener_t const self, iox_user_trigger_t const userTrigger);
101 
102 
106 uint64_t iox_listener_size(iox_listener_t const self);
107 
111 uint64_t iox_listener_capacity(iox_listener_t const self);
112 
119 ENUM iox_ListenerResult iox_listener_attach_client_event(iox_listener_t const self,
120  iox_client_t const client,
121  const ENUM iox_ClientEvent clientEvent,
122  void (*callback)(iox_client_t));
123 
132 ENUM iox_ListenerResult iox_listener_attach_client_event_with_context_data(iox_listener_t const self,
133  iox_client_t const client,
134  const ENUM iox_ClientEvent clientEvent,
135  void (*callback)(iox_client_t, void*),
136  void* const contextData);
137 
142 void iox_listener_detach_client_event(iox_listener_t const self,
143  iox_client_t const client,
144  const ENUM iox_ClientEvent clientEvent);
145 
152 ENUM iox_ListenerResult iox_listener_attach_server_event(iox_listener_t const self,
153  iox_server_t const server,
154  const ENUM iox_ServerEvent serverEvent,
155  void (*callback)(iox_server_t));
156 
165 ENUM iox_ListenerResult iox_listener_attach_server_event_with_context_data(iox_listener_t const self,
166  iox_server_t const server,
167  const ENUM iox_ServerEvent serverEvent,
168  void (*callback)(iox_server_t, void*),
169  void* const contextData);
170 
175 void iox_listener_detach_server_event(iox_listener_t const self,
176  iox_server_t const server,
177  const ENUM iox_ServerEvent serverEvent);
178 
185 ENUM iox_ListenerResult
186 iox_listener_attach_service_discovery_event(iox_listener_t const self,
187  iox_service_discovery_t const serviceDiscovery,
188  const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
189  void (*callback)(iox_service_discovery_t));
190 
199 ENUM iox_ListenerResult iox_listener_attach_service_discovery_event_with_context_data(
200  iox_listener_t const self,
201  iox_service_discovery_t const serviceDiscovery,
202  const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
203  void (*callback)(iox_service_discovery_t, void*),
204  void* const contextData);
205 
210 void iox_listener_detach_service_discovery_event(iox_listener_t const self,
211  iox_service_discovery_t const serviceDiscovery,
212  const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent);
213 
214 #endif
Definition: types.h:59