1228753Smm/*
2228753Smm * Copyright (c) 2013 Romain Francoise <romain@orebokech.com>
3228753Smm *
4228753Smm * Redistribution and use in source and binary forms, with or without
5228753Smm * modification, are permitted provided that the following conditions
6228753Smm * are met:
7228753Smm * 1. Redistributions of source code must retain the above copyright
8228753Smm *    notice, this list of conditions and the following disclaimer.
9228753Smm * 2. Redistributions in binary form must reproduce the above copyright
10228753Smm *    notice, this list of conditions and the following disclaimer in the
11228753Smm *    documentation and/or other materials provided with the distribution.
12228753Smm * 3. Neither the name of the project nor the names of its contributors
13228753Smm *    may be used to endorse or promote products derived from this software
14228753Smm *    without specific prior written permission.
15228753Smm *
16228753Smm * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
17228753Smm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18228753Smm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19228753Smm * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
20228753Smm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21228753Smm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22228753Smm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23228753Smm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24228753Smm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25228753Smm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26228753Smm * SUCH DAMAGE.
27228763Smm */
28228753Smm
29228753Smm#ifdef HAVE_CONFIG_H
30228753Smm#include "config.h"
31228753Smm#endif
32228753Smm
33228753Smm#include <tcpdump-stdinc.h>
34228753Smm
35228753Smm#include <stdio.h>
36228753Smm#include <string.h>
37228753Smm
38228753Smm#include "netdissect.h"
39228753Smm#include "addrtoname.h"
40228753Smm#include "extract.h"
41228753Smm
42228753Smmstruct msnlb_heartbeat_pkt {
43228753Smm	u_int32_t unknown1;
44228753Smm	u_int32_t unknown2;
45228753Smm	u_int32_t host_prio;	/* little-endian */
46228753Smm	u_int32_t virtual_ip;
47228753Smm	u_int32_t host_ip;
48228753Smm	/* the protocol is undocumented so we ignore the rest */
49228753Smm};
50228753Smm
51228753Smmvoid
52228753Smmmsnlb_print(netdissect_options *ndo, const u_char *bp, u_int length)
53228753Smm{
54228753Smm	const struct msnlb_heartbeat_pkt *hb;
55228753Smm
56228753Smm	hb = (struct msnlb_heartbeat_pkt *)bp;
57228753Smm	ND_TCHECK(*hb);
58228753Smm
59228753Smm	ND_PRINT((ndo, "MS NLB heartbeat, host priority: %u,",
60228753Smm		EXTRACT_LE_32BITS(&(hb->host_prio))));
61228753Smm	ND_PRINT((ndo, " cluster IP: %s,", ipaddr_string(&(hb->virtual_ip))));
62228753Smm	ND_PRINT((ndo, " host IP: %s", ipaddr_string(&(hb->host_ip))));
63228753Smm	return;
64228753Smmtrunc:
65228753Smm	ND_PRINT((ndo, "[|MS NLB]"));
66228753Smm}
67228753Smm