#ifndef _COMM_UDP_H_
#define _COMM_UDP_H_

#include "myComm.h"
#include "comm.h"

typedef struct 
{
    stru_udp_para *p_para;
    int sockfd;

    CommDebugShow debug_show;

    comm_state_cb state_cb;
    comm_recv_cb recv_cb;
    comm_debug_show_cb debug_show_cb;

    int (*udp_state_register)(void *p_this, comm_state_cb cb);
    int (*udp_recv_register)(void *p_this, comm_recv_cb cb);
    int (*udp_debug_show_register)(void *p_this, comm_debug_show_cb cb);

    int (*udp_client_connect)(int id, void *p_this);
    int (*udp_server_connect)(int id, void *p_this);

    int (*udp_send)(int id, int fd, const char *udp_type, void *p_this, const uint8_t *data, uint16_t len);

    int (*udp_close)(int id, void *p_this);
}stru_comm_udp;

int comm_udp_create(stru_comm_udp *udp);

#endif /* _COMM_UDP_H_ */