iceoryx_binding_c  2.0.2
server.h
1 // Copyright (c) 2022 by 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_SERVER_H
18 #define IOX_BINDING_C_SERVER_H
19 
20 #include "iceoryx_binding_c/config.h"
21 #include "iceoryx_binding_c/enums.h"
22 #include "iceoryx_binding_c/service_description.h"
23 #include "iceoryx_binding_c/types.h"
24 
26 typedef CLASS UntypedServer* iox_server_t;
27 
29 typedef struct
30 {
33 
35  char nodeName[IOX_CONFIG_NODE_NAME_SIZE];
36 
39 
41  ENUM iox_QueueFullPolicy requestQueueFullPolicy;
42 
44  ENUM iox_ConsumerTooSlowPolicy clientTooSlowPolicy;
45 
48  uint64_t initCheck;
50 
57 void iox_server_options_init(iox_server_options_t* const options);
58 
62 bool iox_server_options_is_initialized(const iox_server_options_t* const options);
63 
72 iox_server_t iox_server_init(iox_server_storage_t* self,
73  const char* const service,
74  const char* const instance,
75  const char* const event,
76  const iox_server_options_t* const options);
77 
80 void iox_server_deinit(iox_server_t const self);
81 
87 ENUM iox_ServerRequestResult iox_server_take_request(iox_server_t const self, const void** const payload);
88 
92 void iox_server_release_request(iox_server_t const self, const void* const payload);
93 
103 ENUM iox_AllocationResult iox_server_loan_response(iox_server_t const self,
104  const void* const requestPayload,
105  void** const payload,
106  const uint32_t payloadSize);
107 
116 ENUM iox_AllocationResult iox_server_loan_aligned_response(iox_server_t const self,
117  const void* const requestPayload,
118  void** const payload,
119  const uint32_t payloadSize,
120  const uint32_t payloadAlignment);
121 
127 ENUM iox_ServerSendResult iox_server_send(iox_server_t const self, void* const payload);
128 
132 void iox_server_release_response(iox_server_t const self, void* const payload);
133 
137 iox_service_description_t iox_server_get_service_description(iox_server_t const self);
138 
141 void iox_server_offer(iox_server_t const self);
142 
145 void iox_server_stop_offer(iox_server_t const self);
146 
150 bool iox_server_is_offered(iox_server_t const self);
151 
155 bool iox_server_has_clients(iox_server_t const self);
156 
160 bool iox_server_has_requests(iox_server_t const self);
161 
165 bool iox_server_has_missed_requests(iox_server_t const self);
166 
169 void iox_server_release_queued_requests(iox_server_t const self);
170 
171 #endif
options to be set for a server
Definition: server.h:30
ENUM iox_QueueFullPolicy requestQueueFullPolicy
Sets whether the client blocks when the server request queue is full.
Definition: server.h:41
ENUM iox_ConsumerTooSlowPolicy clientTooSlowPolicy
Sets whether the server blocks when the client response queue is full.
Definition: server.h:44
uint64_t initCheck
this value will be set exclusively by iox_server_options_init and is not supposed to be modified othe...
Definition: server.h:48
bool offerOnCreate
Indicates if the server should be connected when created.
Definition: server.h:38
uint64_t requestQueueCapacity
size of the request queue
Definition: server.h:32
has exactly the size required to store the underlying object of iox_server_t
Definition: types.h:80
Definition: service_description.h:25