Exemple #1
0
void
print_ipv4(
	int fd,
	char *datagram)
{
	struct ipv4_header *iph;
	iph = (struct ipv4_header *) datagram;

	print_proto(fd,"[IPv4/ version:%hhd ipheaderlen:%hhd tos:%#x totlen:%d "
		"id:%#x fragoffset:%#x ttl:%hhu proto:%hhd checksum:%#x "
		"source:%s dest:%s]",FLAG_VAL(iph->lenvers,IPV4_VERS,4),
		FLAG_VAL(iph->lenvers,IPV4_HDRLEN,0),iph->tos,
		ntohs(iph->totlen),ntohs(iph->id), ntohs(iph->fragoffset),
		iph->ttl,iph->proto,ntohs(iph->ipchecksum),
		ipv4_ntoa(ntohl(iph->sourceaddr),sourceip),
		ipv4_ntoa(ntohl(iph->destaddr), destip));
}
Exemple #2
0
int int_polling()
{
    if(cpu.INTR & FLAG_VAL(IF)) {
        uint32_t intr_no = i8259_query_intr();
        i8259_ack_intr();
        raise_intr(intr_no);
        return 0;
    }
    return 1;
}
Exemple #3
0
void
scan_ipv4(
	struct data *datagram,
	struct protocol_header *network_layerph,
	struct protocol_header *transport_layerph)
{
	network_layerph->len = 
		(FLAG_VAL(((struct ipv4_header *)network_layerph->header)
			->lenvers,IPV4_HDRLEN,0) * 4);
	transport_layerph->id = 
		((struct ipv4_header *)network_layerph->header)->proto;
}