-
Notifications
You must be signed in to change notification settings - Fork 0
/
rdma_utils.h
53 lines (40 loc) · 880 Bytes
/
rdma_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright (c) 2005 Mellanox Technologies. All rights reserved.
*
*/
#ifndef VL_SOCK_H
#define VL_SOCK_H
#include <netinet/in.h>
#include <arpa/inet.h>
#include <byteswap.h>
#ifdef __cplusplus
extern "C" {
#endif
#define IP_STR_LENGTH 15
#define SOCKET_RETRY 10
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define ntohll(x) bswap_64(x)
#define htonll(x) bswap_64(x)
#elif __BYTE_ORDER == __BIG_ENDIAN
#define ntohll(x) x
#define htonll(x) x
#else
#error __BYTE_ORDER is neither __LITTLE_ENDIAN nor __BIG_ENDIAN
#endif
struct sock_t{
int sock_fd;
int is_daemon;
unsigned short port;
char ip[IP_STR_LENGTH+1];
};
struct sock_bind_t {
unsigned int counter;
int socket_fd;
int is_daemon;
unsigned short port;
char ip[IP_STR_LENGTH+1];
};
#ifdef __cplusplus
}
#endif
#endif