S2OPC OPCUA Toolkit
p_sopc_sockets.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_SOCKETS_H_
21 #define SOPC_P_SOCKETS_H_
22 
23 #include "sopc_raw_sockets.h"
24 
25 #include <lwip/inet.h>
26 #include <lwip/netdb.h>
27 #include <lwip/sockets.h>
28 
29 #define SOPC_PIKEOS_INVALID_SOCKET_ID (-1)
30 #define SOPC_MAX_PENDING_CONNECTIONS (2)
31 
35 struct SOPC_Socket_Impl
36 {
37  int sock;
38  struct ip_mreq* membership; // NULL if not used
39 };
40 
46 {
47  struct addrinfo addrInfo;
48 };
49 
55 {
56  struct addrinfo address;
57 };
58 
62 struct SOPC_SocketSet
63 {
64  int fdmax;
65  fd_set set;
66  uint8_t rfu[2];
67 };
68 
69 #define SOPC_PIKEOS_SOCKET_IS_VALID(pSock) \
70  (SOPC_INVALID_SOCKET != (pSock) && SOPC_PIKEOS_INVALID_SOCKET_ID != (pSock)->sock)
71 
72 #endif // SOPC_P_SOCKETS_H_
SOPC_SocketSet::set
fd_set set
Definition: p_sopc_sockets.h:65
sopc_raw_sockets.h
A platform independent API to use sockets.
SOPC_SocketSet::fdmax
int fdmax
Definition: p_sopc_sockets.h:64
SOPC_Socket_Impl::membership
struct ip_mreq * membership
Definition: p_sopc_sockets.h:38
SOPC_Socket_Impl
Socket base type.
Definition: p_sopc_sockets.h:36
SOPC_Socket_Address
Socket address information on a connected socket.
Definition: p_sopc_sockets.h:55
SOPC_SocketSet::rfu
uint8_t rfu[2]
Definition: p_sopc_sockets.h:66
SOPC_Socket_AddressInfo::addrInfo
struct addrinfo addrInfo
Definition: p_sopc_sockets.h:47
SOPC_SocketSet
Set of sockets type.
Definition: p_sopc_sockets.h:63
SOPC_Socket_AddressInfo
Socket addressing information for listening or connecting operation type.
Definition: p_sopc_sockets.h:46
SOPC_Socket_Impl::sock
int sock
Definition: p_sopc_sockets.h:37
SOPC_Socket_Address::address
struct addrinfo address
Definition: p_sopc_sockets.h:56