2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2010,2011 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_NET_TCP_HEADER
20 #define GRUB_NET_TCP_HEADER 1
21 #include <grub/types.h>
24 struct grub_net_tcp_socket
;
25 typedef struct grub_net_tcp_socket
*grub_net_tcp_socket_t
;
27 struct grub_net_tcp_listen
;
28 typedef struct grub_net_tcp_listen
*grub_net_tcp_listen_t
;
31 grub_net_tcp_open (char *server
,
32 grub_uint16_t out_port
,
33 grub_err_t (*recv_hook
) (grub_net_tcp_socket_t sock
,
34 struct grub_net_buff
*nb
,
36 void (*error_hook
) (grub_net_tcp_socket_t sock
,
38 void (*fin_hook
) (grub_net_tcp_socket_t sock
,
43 grub_net_tcp_listen (grub_uint16_t port
,
44 const struct grub_net_network_level_interface
*inf
,
45 grub_err_t (*listen_hook
) (grub_net_tcp_listen_t listen
,
46 grub_net_tcp_socket_t sock
,
51 grub_net_tcp_stop_listen (grub_net_tcp_listen_t listen
);
54 grub_net_send_tcp_packet (const grub_net_tcp_socket_t socket
,
55 struct grub_net_buff
*nb
,
60 GRUB_NET_TCP_CONTINUE_RECEIVING
,
66 grub_net_tcp_close (grub_net_tcp_socket_t sock
, int discard_received
);
69 grub_net_tcp_accept (grub_net_tcp_socket_t sock
,
70 grub_err_t (*recv_hook
) (grub_net_tcp_socket_t sock
,
71 struct grub_net_buff
*nb
,
73 void (*error_hook
) (grub_net_tcp_socket_t sock
,
75 void (*fin_hook
) (grub_net_tcp_socket_t sock
,
80 grub_net_tcp_stall (grub_net_tcp_socket_t sock
);
83 grub_net_tcp_unstall (grub_net_tcp_socket_t sock
);