Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int parser::packet_len (int fd)
- {
- ssize_t a;
- unsigned char pkt_type;
- static const int lengths[] = {131, 1, 1, 1028, 7, 9, 8, 74, 10, 7, 5, 4, 2, 66, 65, 2, 0};
- a = recv(fd, &pkt_type, 1, MSG_PEEK);
- if (a < 1)
- return -1;
- if (pkt_type > 0x0F)
- return -1;
- return lengths[pkt_type];
- }
Advertisement
Add Comment
Please, Sign In to add comment