/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010,2011 Free Software Foundation, Inc.
*
* 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.
*
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/priority_queue.h>
struct unacked
{
int try_count;
};
enum
{
};
struct grub_net_tcp_socket
{
int established;
int i_closed;
int they_closed;
int in_port;
int out_port;
int errors;
int they_reseted;
int i_reseted;
void *recv);
void *hook_data;
};
struct grub_net_tcp_listen
{
void *data);
void *hook_data;
};
struct tcphdr
{
} __attribute__ ((packed));
struct tcp_pseudohdr
{
} __attribute__ ((packed));
struct tcp6_pseudohdr
{
} __attribute__ ((packed));
const struct grub_net_network_level_interface *inf,
void *data),
void *hook_data)
{
if (!ret)
return NULL;
return ret;
}
void
{
GRUB_AS_LIST (listen));
}
static inline void
{
GRUB_AS_LIST (sock));
}
static void
{
if (sock->error_hook)
{
}
}
static grub_err_t
{
size++;
if (size)
{
if (!unack)
return grub_errno;
if (!socket->unack_last)
else
}
if (err)
return err;
if (!size)
return GRUB_ERR_NONE;
}
void
int discard_received)
{
{
}
if (discard_received == GRUB_NET_TCP_ABORT)
return;
if (!nb_fin)
return;
if (err)
{
return;
}
if (err)
{
return;
}
| TCP_ACK);
if (err)
{
}
return;
}
static void
{
if (!nb_ack)
return;
if (err)
{
return;
}
if (err)
{
return;
}
if (res)
{
}
else
{
}
if (err)
{
}
}
static void
{
}
static void
{
}
void
grub_net_tcp_retransmit (void)
{
{
{
continue;
{
break;
}
{
}
if (err)
{
}
}
}
}
const grub_net_network_level_address_t *src,
const grub_net_network_level_address_t *dst)
{
grub_uint16_t a, b = 0;
{
{
break;
}
{
break;
}
b = 0;
break;
}
c = (grub_uint32_t) a + (grub_uint32_t) b;
if (c >= 0xffff)
c -= 0xffff;
return grub_cpu_to_be16 (~c);
}
/* FIXME: overflow. */
static int
{
/* We want the first elements to be on top. */
return +1;
return -1;
return 0;
}
static void
{
{
}
}
struct grub_net_buff *nb,
void *data),
void *data),
void *data),
void *hook_data)
{
if (!nb_ack)
return grub_errno;
if (err)
{
return err;
}
if (err)
{
return err;
}
if (err)
return err;
sock->my_cur_seq++;
return GRUB_ERR_NONE;
}
struct grub_net_buff *nb,
void *data),
void *data),
void *data),
void *hook_data)
{
int i;
if (err)
return NULL;
{
return NULL;
}
if (err)
return NULL;
if (err)
return NULL;
return NULL;
if (!nb)
return NULL;
if (err)
{
return NULL;
}
if (err)
{
return NULL;
}
{
return NULL;
}
for (i = 0; i < TCP_SYN_RETRANSMISSION_COUNT; i++)
{
int j;
if (err)
{
GRUB_AS_LIST (socket));
return NULL;
}
for (j = 0; (j < TCP_SYN_RETRANSMISSION_TIMEOUT / 50
&& !socket->established); j++)
grub_net_poll_cards (50);
if (socket->established)
break;
}
if (!socket->established)
{
GRUB_AS_LIST (socket));
if (socket->they_reseted)
else
destroy_pq (socket);
return NULL;
}
return socket;
}
{
- sizeof (*tcph));
else
{
if (!nb2)
return grub_errno;
if (err)
return err;
if (err)
return err;
if (err)
return err;
if (err)
return err;
if (err)
return err;
}
if (err)
return err;
}
struct grub_net_network_level_interface *inf,
{
/* Ignore broadcast. */
if (!inf)
{
return GRUB_ERR_NONE;
}
{
return GRUB_ERR_NONE;
}
>> 12) * sizeof (grub_uint32_t)))
{
return GRUB_ERR_NONE;
}
{
continue;
{
{
"Expected %x, got %x\n",
grub_be_to_cpu16 (chk));
return GRUB_ERR_NONE;
}
}
&& !sock->established)
{
}
{
return GRUB_ERR_NONE;
}
{
{
->seqnr);
seqnr++;
break;
}
if (!sock->unack_first)
}
{
return GRUB_ERR_NONE;
}
>> 12) * sizeof (grub_uint32_t)) > 0)
{
}
if (err)
{
return err;
}
{
int do_ack = 0;
int just_closed = 0;
while (1)
{
if (!nb_top_p)
return GRUB_ERR_NONE;
break;
}
return GRUB_ERR_NONE;
while (1)
{
if (!nb_top_p)
break;
break;
>> 12) * sizeof (grub_uint32_t));
if (err)
{
return err;
}
{
just_closed = 1;
sock->their_cur_seq++;
do_ack = 1;
}
/* If there is data, puts packet in socket list. */
{
do_ack = 1;
}
else
}
if (do_ack)
{
else
}
}
return GRUB_ERR_NONE;
}
{
{
continue;
return grub_errno;
cmp);
{
return grub_errno;
}
return err;
}
}
return GRUB_ERR_NONE;
}