Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
connection.h
Go to the documentation of this file.
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 
25 #ifndef connection_h
26 #define connection_h
27 #include <hicn/hicn-light/config.h>
28 #include <hicn/core/connectionState.h>
29 #include <hicn/io/ioOperations.h>
30 #include <hicn/utils/address.h>
31 
32 #ifdef WITH_MAPME
33 typedef enum {
34  CONNECTION_EVENT_CREATE,
35  CONNECTION_EVENT_DELETE,
36  CONNECTION_EVENT_UPDATE,
37  CONNECTION_EVENT_SET_UP,
38  CONNECTION_EVENT_SET_DOWN,
39  CONNECTION_EVENT_PRIORITY_CHANGED,
40  CONNECTION_EVENT_TAGS_CHANGED,
41 } connection_event_t;
42 
43 #endif /* WITH_MAPME */
44 
45 #ifdef WITH_POLICY
46 #include <hicn/policy.h>
47 #endif /* WITH_POLICY */
48 
49 struct connection;
50 typedef struct connection Connection;
51 
55 Connection *connection_Create(IoOperations *ops);
56 
64 void connection_Release(Connection **connectionPtr);
65 
72 Connection *connection_Acquire(Connection *connection);
73 
79 bool connection_Send(const Connection *conn, Message *message);
80 
85 bool connection_SendIOVBuffer(const Connection *conn, struct iovec *msg,
86  size_t size);
87 
92 bool connection_SendBuffer(const Connection *conn, u8 * buffer, size_t length);
93 
101 IoOperations *connection_GetIoOperations(const Connection *conn);
102 
109 unsigned connection_GetConnectionId(const Connection *conn);
110 
117 const AddressPair *connection_GetAddressPair(const Connection *conn);
118 
125 bool connection_IsUp(const Connection *conn);
126 
138 bool connection_IsLocal(const Connection *conn);
139 
150 const void *connection_Class(const Connection *conn);
151 
152 bool connection_ReSend(const Connection *conn, Message *message,
153  bool notification);
154 
155 void connection_Probe(Connection *conn, uint8_t *probe);
156 
157 void connection_HandleProbe(Connection *conn, uint8_t *message);
158 
159 void connection_AllowWldrAutoStart(Connection *conn, bool allow);
160 
161 void connection_EnableWldr(Connection *conn);
162 
163 void connection_DisableWldr(Connection *conn);
164 
165 bool connection_HasWldr(const Connection *conn);
166 
167 bool connection_WldrAutoStartAllowed(const Connection *conn);
168 
169 void connection_DetectLosses(Connection *conn, Message *message);
170 
171 void connection_HandleWldrNotification(Connection *conn, Message *message);
172 
173 connection_state_t connection_GetState(const Connection *conn);
174 
175 void connection_SetState(Connection *conn, connection_state_t state);
176 
177 connection_state_t connection_GetAdminState(const Connection *conn);
178 
179 void connection_SetAdminState(Connection *conn, connection_state_t admin_state);
180 
181 #ifdef WITH_POLICY
182 uint32_t connection_GetPriority(const Connection *conn);
183 
184 void connection_SetPriority(Connection *conn, uint32_t priority);
185 #endif /* WITH_POLICY */
186 
187 const char * connection_GetInterfaceName(const Connection * conn);
188 
189 #ifdef WITH_POLICY
190 void connection_AddTag(Connection *conn, policy_tag_t tag);
191 void connection_RemoveTag(Connection *conn, policy_tag_t tag);
192 policy_tags_t connection_GetTags(const Connection *conn);
193 void connection_SetTags(Connection *conn, policy_tags_t tags);
194 void connection_ClearTags(Connection *conn);
195 int connection_HasTag(const Connection *conn, policy_tag_t tag);
196 #endif /* WITH_POLICY */
197 
198 #endif // connection_h
policy.h
Policy description.
connection_Send
bool connection_Send(const Connection *conn, Message *message)
connection_SendBuffer
bool connection_SendBuffer(const Connection *conn, u8 *buffer, size_t length)
connection_Class
const void * connection_Class(const Connection *conn)
connection_Create
Connection * connection_Create(IoOperations *ops)
connection_Acquire
Connection * connection_Acquire(Connection *connection)
connection_SendIOVBuffer
bool connection_SendIOVBuffer(const Connection *conn, struct iovec *msg, size_t size)
io_ops
Definition: ioOperations.h:74
iovec
Definition: windows_utils.h:33
connection_IsUp
bool connection_IsUp(const Connection *conn)
connection_GetIoOperations
IoOperations * connection_GetIoOperations(const Connection *conn)
connection_Release
void connection_Release(Connection **connectionPtr)
connection_GetConnectionId
unsigned connection_GetConnectionId(const Connection *conn)
connection_GetAddressPair
const AddressPair * connection_GetAddressPair(const Connection *conn)
connection_IsLocal
bool connection_IsLocal(const Connection *conn)