-
Notifications
You must be signed in to change notification settings - Fork 170
/
ddcd.h
57 lines (46 loc) · 918 Bytes
/
ddcd.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
54
55
56
57
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <signal.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <vector>
#include <limits.h>
#define SOFTWARE_NAME "ddcd"
#define MSG_START SOFTWARE_NAME ": "
typedef enum ddc_method_e
{
M_TD,
M_FASTDDC
} ddc_method_t;
typedef enum client_status_e
{
CS_CREATED,
CS_THREAD_RUNNING,
CS_THREAD_FINISHED
} client_status_t;
typedef struct client_s
{
struct sockaddr_in addr;
int socket;
int error; //set to non-zero on error (data transfer failed)
pthread_t thread;
client_status_t status;
} client_t;
typedef enum command_type_e
{
CT_SHIFT,
CT_BYPASS
} command_type_t;
typedef struct command_s
{
command_type_t type;
float float_param;
} command_t;
void print_exit(const char* why);
void error_exit(const char* why);
void maxfd(int* maxfd, int fd);