Run indent on files.

This commit is contained in:
Manoel Rebelo Abranches 2011-06-07 21:59:53 -03:00
parent 423a1849ef
commit 4700d08bb4
8 changed files with 307 additions and 288 deletions

View file

@ -5,24 +5,25 @@
#include <grub/time.h>
grub_err_t
grub_net_send_udp_packet (const grub_net_socket_t socket , struct grub_net_buff *nb)
grub_net_send_udp_packet (const grub_net_socket_t socket,
struct grub_net_buff *nb)
{
struct udphdr *udph;
grub_netbuff_push (nb,sizeof(*udph));
udph = (struct udphdr *) nb->data;
grub_netbuff_push (nb, sizeof (*udph));
udph = (struct udphdr *) nb->data;
udph->src = grub_cpu_to_be16 (socket->in_port);
udph->dst = grub_cpu_to_be16 (socket->out_port);
/* No chechksum. */
udph->chksum = 0;
udph->chksum = 0;
udph->len = grub_cpu_to_be16 (nb->tail - nb->data);
return grub_net_send_ip_packet (socket->inf, &(socket->out_nla), nb);
}
grub_err_t
grub_err_t
grub_net_recv_udp_packet (struct grub_net_buff *nb)
{
struct udphdr *udph;
@ -30,24 +31,24 @@ grub_net_recv_udp_packet (struct grub_net_buff *nb)
udph = (struct udphdr *) nb->data;
grub_netbuff_pull (nb, sizeof (*udph));
FOR_NET_SOCKETS(sock)
{
if (grub_be_to_cpu16 (udph->dst) == sock->in_port)
{
if (sock->status == 0)
sock->out_port = grub_be_to_cpu16 (udph->src);
/* App protocol remove its own reader. */
sock->app->read (sock,nb);
/* If there is data, puts packet in socket list. */
if ((nb->tail - nb->data) > 0)
grub_net_put_packet (&sock->packs, nb);
else
grub_netbuff_free (nb);
return GRUB_ERR_NONE;
}
}
grub_netbuff_free (nb);
FOR_NET_SOCKETS (sock)
{
if (grub_be_to_cpu16 (udph->dst) == sock->in_port)
{
if (sock->status == 0)
sock->out_port = grub_be_to_cpu16 (udph->src);
/* App protocol remove its own reader. */
sock->app->read (sock, nb);
/* If there is data, puts packet in socket list. */
if ((nb->tail - nb->data) > 0)
grub_net_put_packet (&sock->packs, nb);
else
grub_netbuff_free (nb);
return GRUB_ERR_NONE;
}
}
grub_netbuff_free (nb);
return GRUB_ERR_NONE;
}