3MICTCP/include/api/mictcp_core.h
Guillaume Averlant 5e4a2b64a9 ADD+BUGFIX [mictcp/mictcp_core] (see details below)
1) BUGFIX: Fixed the return value of IP_send() and IP_recv() so that they does not include the header size anymore.

2) ADD: Harmonization of IP_send() and IP_recv() so that they both use mic_tcp_pdu data instead of ip_payload data.
Moved therefore the ip_payload type declaration in mictcp_core.h.

3) ADD: Add the source address to the arguments of process_received_PDU() in order to make the multiplexing implementation possible.

4) ADD: Generate a stub addr in IP_recv()
2018-05-03 19:14:04 +02:00

46 lines
1.3 KiB
C

#ifndef MICTCP_CORE_H
#define MICTCP_CORE_H
#include <mictcp.h>
#include <math.h>
/**************************************************************
* Public core functions, can be used for implementing mictcp *
**************************************************************/
int initialize_components(start_mode sm);
int IP_send(mic_tcp_pdu, mic_tcp_sock_addr);
int IP_recv(mic_tcp_pdu*, mic_tcp_sock_addr*, unsigned long timeout);
int app_buffer_get(mic_tcp_payload);
void app_buffer_put(mic_tcp_payload);
void set_loss_rate(unsigned short);
unsigned long get_now_time_msec();
unsigned long get_now_time_usec();
/**********************************************************************
* Private core functions, should not be used for implementing mictcp *
**********************************************************************/
#define API_CS_Port 8524
#define API_SC_Port 8525
#define API_HD_Size 15
typedef struct ip_payload
{
char* data; /* données transport */
int size; /* taille des données */
} ip_payload;
int mic_tcp_core_send(mic_tcp_payload);
mic_tcp_payload get_full_stream(mic_tcp_pdu);
mic_tcp_payload get_mic_tcp_data(ip_payload);
mic_tcp_header get_mic_tcp_header(ip_payload);
void* listening(void*);
void print_header(mic_tcp_pdu);
int min_size(int, int);
float mod(int, float);
#endif