KM3NeT CLB
2.0
KM3NeT CLB v2 Embedded Software
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
net.h
Go to the documentation of this file.
1
/*
2
* KM3NeT CLB v2 Firmware
3
*
4
* Copyright 2013 KM3NeT Collaboration
5
*
6
* All Rights Reserved.
7
*
8
* net.h
9
*
10
* Created on: 8 jul. 2013
11
* Author: Vincent van Beveren
12
*/
13
14
15
#ifndef NET_H_
16
#define NET_H_
17
18
/**
19
* @file
20
*
21
* @ingroup network
22
*/
23
24
#include <stdbool.h>
25
#include <stdint.h>
26
#include <string.h>
27
28
/**
29
* Combination of IP address and port.
30
*/
31
typedef
struct
32
{
33
uint32_t
ip
;
//!< IP address
34
uint16_t
port
;
//!< Port number.
35
}
SockAddr
;
36
37
/**
38
* Creates a U32 IP address from components.
39
*/
40
#define NET_IP_U32(A, B, C, D) \
41
(( ( ( A ) & 0xFF) << 24 ) | ( ( ( B ) & 0xFF) << 16 )\
42
| ( ( ( C ) & 0xFF) << 8 ) | ( ( ( D ) & 0xFF) << 0 ))
43
44
/**
45
* Checks if two socket addresses are equal.
46
*
47
* @param addr1 First address to compare.
48
* @param addr2 Second address to compare.
49
* @return
50
*/
51
static
inline
bool
sockAddrEq
(
SockAddr
* addr1,
SockAddr
* addr2)
52
{
53
if
(addr1 == NULL || addr2 == NULL)
return
false
;
54
return
( addr1->
ip
== addr2->
ip
) && ( addr1->
port
== addr2->
port
);
55
}
56
57
#endif
/* NET_H_ */
SockAddr::port
uint16_t port
Port number.
Definition:
net.h:34
SockAddr::ip
uint32_t ip
IP address.
Definition:
net.h:33
sockAddrEq
static bool sockAddrEq(SockAddr *addr1, SockAddr *addr2)
Checks if two socket addresses are equal.
Definition:
net.h:51
SockAddr
Combination of IP address and port.
Definition:
net.h:31
src
platform
net
net.h
Generated on Mon Feb 22 2021 13:46:24 for KM3NeT CLB by
1.8.5