#ifndef RECEIVE_H
#define RECEIVE_H

#include <sys/types.h>
#include <netinet/in.h>
#include <poll.h>
#include "packet.h"

typedef struct {
    int socket;
    struct sockaddr_in name;
    struct pollfd pollfds;    
} ReceiveState;

extern ReceiveState *initialize_receive(O1kNetwork* network, int channel_offset);
extern int receive_packet(ReceiveState * receiver, PacketType * packet, O1kThread* thread);
extern void close_receive(ReceiveState * receiver);

#endif				/* RECEIVE_H */
