/* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2010,2011 Free Software Foundation, Inc. * * VAS_EBOOT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * VAS_EBOOT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with VAS_EBOOT. If not, see . */ #ifndef VAS_EBOOT_NET_TCP_HEADER #define VAS_EBOOT_NET_TCP_HEADER 1 #include #include struct VasEBoot_net_tcp_socket; typedef struct VasEBoot_net_tcp_socket *VasEBoot_net_tcp_socket_t; struct VasEBoot_net_tcp_listen; typedef struct VasEBoot_net_tcp_listen *VasEBoot_net_tcp_listen_t; VasEBoot_net_tcp_socket_t VasEBoot_net_tcp_open (char *server, VasEBoot_uint16_t out_port, VasEBoot_err_t (*recv_hook) (VasEBoot_net_tcp_socket_t sock, struct VasEBoot_net_buff *nb, void *data), void (*error_hook) (VasEBoot_net_tcp_socket_t sock, void *data), void (*fin_hook) (VasEBoot_net_tcp_socket_t sock, void *data), void *hook_data); VasEBoot_net_tcp_listen_t VasEBoot_net_tcp_listen (VasEBoot_uint16_t port, const struct VasEBoot_net_network_level_interface *inf, VasEBoot_err_t (*listen_hook) (VasEBoot_net_tcp_listen_t listen, VasEBoot_net_tcp_socket_t sock, void *data), void *hook_data); void VasEBoot_net_tcp_stop_listen (VasEBoot_net_tcp_listen_t listen); VasEBoot_err_t VasEBoot_net_send_tcp_packet (const VasEBoot_net_tcp_socket_t socket, struct VasEBoot_net_buff *nb, int push); enum { VAS_EBOOT_NET_TCP_CONTINUE_RECEIVING, VAS_EBOOT_NET_TCP_DISCARD, VAS_EBOOT_NET_TCP_ABORT }; void VasEBoot_net_tcp_close (VasEBoot_net_tcp_socket_t sock, int discard_received); VasEBoot_err_t VasEBoot_net_tcp_accept (VasEBoot_net_tcp_socket_t sock, VasEBoot_err_t (*recv_hook) (VasEBoot_net_tcp_socket_t sock, struct VasEBoot_net_buff *nb, void *data), void (*error_hook) (VasEBoot_net_tcp_socket_t sock, void *data), void (*fin_hook) (VasEBoot_net_tcp_socket_t sock, void *data), void *hook_data); void VasEBoot_net_tcp_stall (VasEBoot_net_tcp_socket_t sock); void VasEBoot_net_tcp_unstall (VasEBoot_net_tcp_socket_t sock); #endif