Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
ioOperations.h
1 /*
2  * Copyright (c) 2017-2019 Cisco and/or its affiliates.
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 
26 #ifndef io_h
27 #define io_h
28 
29 #include <hicn/core/connectionState.h>
30 #include <hicn/core/message.h>
31 #include <hicn/core/ticks.h>
32 #include <hicn/io/addressPair.h>
33 #include <hicn/utils/address.h>
34 
35 // packet types for probing
36 #define PACKET_TYPE_PROBE_REQUEST 5
37 #define PACKET_TYPE_PROBE_REPLY 6
38 
39 struct io_ops;
40 typedef struct io_ops IoOperations;
41 
74 struct io_ops {
75  void *closure;
76  bool (*send)(IoOperations *ops, const Address *nexthop, Message *message);
77  bool (*sendIOVBuffer)(IoOperations *ops, struct iovec *message, size_t
78  size);
79  const Address *(*getRemoteAddress)(const IoOperations *ops);
80  const AddressPair *(*getAddressPair)(const IoOperations *ops);
81  bool (*isUp)(const IoOperations *ops);
82  bool (*isLocal)(const IoOperations *ops);
83  unsigned (*getConnectionId)(const IoOperations *ops);
84  void (*destroy)(IoOperations **opsPtr);
85  const void *(*class)(const IoOperations *ops);
86  list_connections_type (*getConnectionType)(const IoOperations *ops);
87  void (*sendProbe)(IoOperations *ops, uint8_t *message);
88  connection_state_t (*getState)(const IoOperations *ops);
89  void (*setState)(IoOperations *ops, connection_state_t state);
90  connection_state_t (*getAdminState)(const IoOperations *ops);
91  void (*setAdminState)(IoOperations *ops, connection_state_t admin_state);
92 #ifdef WITH_POLICY
93  uint32_t (*getPriority)(const IoOperations *ops);
94  void (*setPriority)(IoOperations *ops, uint32_t priority);
95 #endif /* WITH_POLICY */
96  const char * (*getInterfaceName)(const IoOperations *ops);
97 };
98 
115 void *ioOperations_GetClosure(const IoOperations *ops);
116 
165 void ioOperations_Release(IoOperations **opsPtr);
166 
191 bool ioOperations_Send(IoOperations *ops, const Address *nexthop,
192  Message *message);
193 
194 bool ioOperations_SendIOVBuffer(IoOperations *ops, struct iovec *message,
195  size_t size);
196 
226 const Address *ioOperations_GetRemoteAddress(const IoOperations *ops);
227 
257 const AddressPair *ioOperations_GetAddressPair(const IoOperations *ops);
258 
280 bool ioOperations_IsUp(const IoOperations *ops);
281 
308 bool ioOperations_IsLocal(const IoOperations *ops);
309 
329 unsigned ioOperations_GetConnectionId(const IoOperations *ops);
330 
358 const void *ioOperations_Class(const IoOperations *ops);
359 
383 list_connections_type ioOperations_GetConnectionType(const IoOperations *ops);
384 
385 void ioOperations_SendProbe(IoOperations *ops, uint8_t *message);
386 
387 
395 connection_state_t ioOperations_GetState(const IoOperations *ops);
396 
403 void ioOperations_SetState(IoOperations *ops, connection_state_t state);
404 
412 connection_state_t ioOperations_GetAdminState(const IoOperations *ops);
413 
420 void ioOperations_SetAdminState(IoOperations *ops, connection_state_t admin_state);
421 
422 #ifdef WITH_POLICY
423 
430 uint32_t ioOperations_GetPriority(const IoOperations *ops);
431 
438 void ioOperations_SetPriority(IoOperations *ops, uint32_t priority);
439 #endif /* WITH_POLICY */
440 
447 const char * ioOperations_GetInterfaceName(const IoOperations *ops);
448 
449 #endif // io_h
message.h
Message is the unit of forwarding, i.e. the packets being switched.
io_ops
Definition: ioOperations.h:74
iovec
Definition: windows_utils.h:33