Exemple #1
0
/* return true if we parsed enough = min ieee header */
bool parse_packet(unsigned char* buf, size_t len, struct uwifi_packet* p)
{
	int ret = uwifi_parse_raw(buf, len, p, conf.intf.arphdr);
	if (ret == 0)
		return true;
	else if (ret < 0)
		return false;

	len -= ret; buf += ret;
	ret = parse_llc(buf, len, p);
	if (ret <= 0)
		return true;

	len -= ret; buf += ret;
	ret = parse_ip_header(buf, len, p);
	if (ret <= 0)
		return true;

	len -= ret; buf += ret;
	parse_udp_header(buf, len, p);
	return true;
}
Exemple #2
0
/* return true if we parsed enough = min ieee header */
bool parse_packet(unsigned char* buf, size_t len, struct packet_info* p)
{
	int ret = wlan_parse_packet(buf, len, p);
	if (ret == 0)
		return true;
	else if (ret < 0)
		return false;

	len -= ret; buf += ret;
	ret = parse_llc(buf, len, p);
	if (ret <= 0)
		return true;

	len -= ret; buf += ret;
	ret = parse_ip_header(buf, len, p);
	if (ret <= 0)
		return true;

	len -= ret; buf += ret;
	parse_udp_header(buf, len, p);
	return true;
}
/* return 1 if we parsed enough = min ieee header */
int
parse_packet(unsigned char* buf, int len, struct packet_info* p)
{
	len = parse_packet_wlan(&buf, len, p);
	if (len == 0)
		return 1;
	else if (len < 0)
		return 0;

	len = parse_llc(&buf, len, p);
	if (len <= 0)
		return 1;

	len = parse_ip_header(&buf, len, p);
	if (len <= 0)
		return 1;

	len = parse_udp_header(&buf, len, p);
	if (len <= 0)
		return 1;

	return 1;
}