3D-ICE 3.0.0
network_socket.h
Go to the documentation of this file.
1/******************************************************************************
2 * This file is part of 3D-ICE, version 3.1.0 . *
3 * *
4 * 3D-ICE is free software: you can redistribute it and/or modify it under *
5 * the terms of the GNU General Public License as published by the Free *
6 * Software Foundation, either version 3 of the License, or any later *
7 * version. *
8 * *
9 * 3D-ICE is distributed in the hope that it will be useful, but WITHOUT *
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
12 * more details. *
13 * *
14 * You should have received a copy of the GNU General Public License along *
15 * with 3D-ICE. If not, see <http://www.gnu.org/licenses/>. *
16 * *
17 * Copyright (C) 2021 *
18 * Embedded Systems Laboratory - Ecole Polytechnique Federale de Lausanne *
19 * All Rights Reserved. *
20 * *
21 * Authors: Arvind Sridhar Alessandro Vincenzi *
22 * Giseong Bak Martino Ruggiero *
23 * Thomas Brunschwiler Eder Zulian *
24 * Federico Terraneo Darong Huang *
25 * Luis Costero Marina Zapater *
26 * David Atienza *
27 * *
28 * For any comment, suggestion or request about 3D-ICE, please register and *
29 * write to the mailing list (see http://listes.epfl.ch/doc.cgi?liste=3d-ice) *
30 * Any usage of 3D-ICE for research, commercial or other purposes must be *
31 * properly acknowledged in the resulting products or publications. *
32 * *
33 * EPFL-STI-IEL-ESL Mail : 3d-ice@listes.epfl.ch *
34 * Batiment ELG, ELG 130 (SUBSCRIPTION IS NECESSARY) *
35 * Station 11 *
36 * 1015 Lausanne, Switzerland Url : http://esl.epfl.ch/3d-ice *
37 ******************************************************************************/
38
39#ifndef _3DICE_NETWORK_SOCKET_H_
40#define _3DICE_NETWORK_SOCKET_H_
41
44#ifdef __cplusplus
45extern "C"
46{
47#endif
48
49/******************************************************************************/
50
51#include <netinet/in.h>
52
53#include "types.h"
54#include "string_t.h"
55
56#include "network_message.h"
57
58/******************************************************************************/
59
66 struct Socket_t
67 {
71
74 struct sockaddr_in Address ;
75
78 char HostName [32] ;
79
83 } ;
84
87 typedef struct Socket_t Socket_t ;
88
89
90
91/******************************************************************************/
92
93
94
100 void socket_init (Socket_t *socket) ;
101
102
103
114
115
116
132 (
133 Socket_t *ssocket,
134 PortNumber_t port_number
135 ) ;
136
137
138
155 (
156 Socket_t *csocket,
157 String_t host_name,
158 PortNumber_t port_number
159 ) ;
160
161
162
173 Error_t wait_for_client (Socket_t *ssocket, Socket_t *client) ;
174
175
176
188 (
189 Socket_t *socket,
190 NetworkMessage_t *message
191 ) ;
192
193
194
206 (
207 Socket_t *socket,
208 NetworkMessage_t *message
209 ) ;
210
211
212
222 Error_t socket_close (Socket_t *socket) ;
223
224/******************************************************************************/
225
226#ifdef __cplusplus
227}
228#endif
229
230#endif /* _3DICE_NETWORK_SOCKET_H_ */
Error_t open_client_socket(Socket_t *csocket)
Error_t receive_message_from_socket(Socket_t *socket, NetworkMessage_t *message)
Error_t socket_close(Socket_t *socket)
Error_t connect_client_to_server(Socket_t *csocket, String_t host_name, PortNumber_t port_number)
Error_t send_message_to_socket(Socket_t *socket, NetworkMessage_t *message)
void socket_init(Socket_t *socket)
Error_t open_server_socket(Socket_t *ssocket, PortNumber_t port_number)
Error_t wait_for_client(Socket_t *ssocket, Socket_t *client)
char * String_t
Definition: string_t.h:55
Structure used to store messages to be sent over network.
Structure used to set up and use network connections.
NetworkSocket_t Id
char HostName[32]
struct sockaddr_in Address
PortNumber_t PortNumber
int NetworkSocket_t
Definition: types.h:542
Error_t
Definition: types.h:401
uint16_t PortNumber_t
Definition: types.h:548