/* Make sure the protocol version of a received message is what we were expecting.  */
static int rpcap_check_msg_ver(SOCKET sock, uint8 expected_ver, struct rpcap_header *header, char *errbuf)
/* Make sure the protocol version of a received message is what we were expecting.  */
static int rpcap_check_msg_ver(SOCKET sock, uint8 expected_ver, struct rpcap_header *header, char *errbuf)
{
	if (header->ver != expected_ver)
	{
		if (rpcap_discard(sock, header->plen, errbuf) == -1)
			return -1;
		if (errbuf != NULL)
		{
			pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
			    "Server sent us a message with version %u when we were expecting %u",
			    header->ver, expected_ver);
		}
		return -1;
	}
	return 0;
}