#ifndef _COMM_H_
#define _COMM_H_


#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/select.h>

#include <netinet/tcp.h>
#include <netinet/in.h>
#include <arpa/inet.h>



enum CommInit
{
    no,
    ok,
};



enum CommDir
{
    unkonwn,
    dir_send,
    dir_recv
};

typedef void (*comm_debug_show_cb)(const char *str, uint8_t dir, const uint8_t*data, uint16_t len);




typedef struct 
{
    CommType type;
    CommInit init;
    CommDebugShow debug_show;

    void *p_comm;
    comm_debug_show_cb debug_show_cb;

    int (*comm_connect)(int id);
    int (*comm_disconnect)(int id);
    int (*comm_run)(int id);

    int (*comm_state_register)(int id, comm_state_cb cb);
    int (*comm_recv_register)(int id, comm_recv_cb cb);

    int (*comm_send)(int id, const char *data, uint16_t len);

}stru_comm;

#endif