S2OPC OPCUA Toolkit
p_sopc_udp_sockets_custom.h
Go to the documentation of this file.
1 /*
2  * Licensed to Systerel under one or more contributor license
3  * agreements. See the NOTICE file distributed with this work
4  * for additional information regarding copyright ownership.
5  * Systerel licenses this file to you under the Apache
6  * License, Version 2.0 (the "License"); you may not use this
7  * file except in compliance with the License. You may obtain
8  * a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef SOPC_P_UDP_SOCKETS_CUSTOM_H_
21 #define SOPC_P_UDP_SOCKETS_CUSTOM_H_
22 
23 #include "sopc_enums.h"
24 #include "sopc_udp_sockets.h"
25 
26 #ifndef SO_TXTIME
27 #define SO_TXTIME 61
28 #define SCM_TXTIME SO_TXTIME
29 #endif
30 
31 #define ONE_SEC 1000 * 1000 * 1000
32 #define CLOCKID CLOCK_TAI
33 
34 /*
35  * SO_TXTIME gets a struct sock_txtime with flags being an integer bit
36  * field comprised of these values.
37  */
39 {
42 
45 };
46 
51 typedef struct
52 {
53  clockid_t clockid;
54  uint16_t flags;
56 
67 SOPC_ReturnStatus SOPC_UDP_SO_TXTIME_Socket_Option(const char* interface, Socket* sock, uint32_t soPriority);
68 
84  void* txBuffer,
85  uint32_t txBuffLen,
86  uint64_t txtime,
87  const char* node,
88  const char* service);
89 
100 
101 #endif /* SOPC_P_UDP_SOCKETS_CUSTOM_H_ */
SOPC_TX_UDP_send
SOPC_ReturnStatus SOPC_TX_UDP_send(int sockAddress, void *txBuffer, uint32_t txBuffLen, uint64_t txtime, const char *node, const char *service)
Send data through the UDP socket to given IP address and port.
SOPC_TX_UDP_Socket_Error_Queue
SOPC_ReturnStatus SOPC_TX_UDP_Socket_Error_Queue(int sockFd)
Function for socket error queue.
txtime_flags
txtime_flags
Definition: p_sopc_udp_sockets_custom.h:39
SOF_TXTIME_DEADLINE_MODE
@ SOF_TXTIME_DEADLINE_MODE
Definition: p_sopc_udp_sockets_custom.h:40
SOF_TXTIME_REPORT_ERRORS
@ SOF_TXTIME_REPORT_ERRORS
Definition: p_sopc_udp_sockets_custom.h:41
sopc_enums.h
SOPC_Socket_txtime
The API for SO_TXTIME is the below struct and enum, which will be provided by uapi/linux/net_tstamp....
Definition: p_sopc_udp_sockets_custom.h:52
SOPC_UDP_SO_TXTIME_Socket_Option
SOPC_ReturnStatus SOPC_UDP_SO_TXTIME_Socket_Option(const char *interface, Socket *sock, uint32_t soPriority)
Function to add new socket option and bind interface.
SOF_TXTIME_FLAGS_MASK
@ SOF_TXTIME_FLAGS_MASK
Definition: p_sopc_udp_sockets_custom.h:44
SOF_TXTIME_FLAGS_LAST
@ SOF_TXTIME_FLAGS_LAST
Definition: p_sopc_udp_sockets_custom.h:43
sopc_udp_sockets.h
A platform independent API to use sockets.
SOPC_Socket_txtime::flags
uint16_t flags
Definition: p_sopc_udp_sockets_custom.h:54
SOPC_Socket_txtime::clockid
clockid_t clockid
Definition: p_sopc_udp_sockets_custom.h:53
Socket_t
Definition: p_sopc_sockets.h:30
SOPC_ReturnStatus
SOPC_ReturnStatus
Definition: libs2opc_client.h:64