about summary refs log tree commit diff
path: root/src/utils.h
blob: 98f03879ecc83e4d8fd81df6565697d9679e8f67 (plain) (blame)
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
#ifndef _UTILS_H_
#define _UTILS_H_

#include <protocol.h>

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <pthread.h>
#include <assert.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/socket.h>

typedef struct
{
    char address[20];
    int port;
} socket_info_t;

int send_packet(const socket_info_t* socket_info, const void* packet, size_t packet_size);
Packet_t* wait_for_packet(const socket_info_t* socket_info);

uint8_t* generate_random_data(size_t data_size);
void show_raw(const uint8_t* data, size_t data_size);

#endif