1251127Sdelphij/* 2251127Sdelphij * Copyright (c) 2013 Romain Francoise <romain@orebokech.com> 3251127Sdelphij * 4251127Sdelphij * Redistribution and use in source and binary forms, with or without 5251127Sdelphij * modification, are permitted provided that the following conditions 6251127Sdelphij * are met: 7251127Sdelphij * 1. Redistributions of source code must retain the above copyright 8251127Sdelphij * notice, this list of conditions and the following disclaimer. 9251127Sdelphij * 2. Redistributions in binary form must reproduce the above copyright 10251127Sdelphij * notice, this list of conditions and the following disclaimer in the 11251127Sdelphij * documentation and/or other materials provided with the distribution. 12251127Sdelphij * 3. Neither the name of the project nor the names of its contributors 13251127Sdelphij * may be used to endorse or promote products derived from this software 14251127Sdelphij * without specific prior written permission. 15251127Sdelphij * 16251127Sdelphij * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 17251127Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18251127Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19251127Sdelphij * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 20251127Sdelphij * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21251127Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22251127Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23251127Sdelphij * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24251127Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25251127Sdelphij * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26251127Sdelphij * SUCH DAMAGE. 27251127Sdelphij */ 28251127Sdelphij 29251127Sdelphij#ifdef HAVE_CONFIG_H 30251127Sdelphij#include "config.h" 31251127Sdelphij#endif 32251127Sdelphij 33251127Sdelphij#include <tcpdump-stdinc.h> 34251127Sdelphij 35251127Sdelphij#include <stdio.h> 36251127Sdelphij#include <string.h> 37251127Sdelphij 38251127Sdelphij#include "netdissect.h" 39251127Sdelphij#include "addrtoname.h" 40251127Sdelphij#include "extract.h" 41251127Sdelphij 42251127Sdelphijstruct msnlb_heartbeat_pkt { 43251127Sdelphij u_int32_t unknown1; 44251127Sdelphij u_int32_t unknown2; 45251127Sdelphij u_int32_t host_prio; /* little-endian */ 46251127Sdelphij u_int32_t virtual_ip; 47251127Sdelphij u_int32_t host_ip; 48251127Sdelphij /* the protocol is undocumented so we ignore the rest */ 49251127Sdelphij}; 50251127Sdelphij 51251127Sdelphijvoid 52251127Sdelphijmsnlb_print(netdissect_options *ndo, const u_char *bp, u_int length) 53251127Sdelphij{ 54251127Sdelphij const struct msnlb_heartbeat_pkt *hb; 55251127Sdelphij 56251127Sdelphij hb = (struct msnlb_heartbeat_pkt *)bp; 57251127Sdelphij ND_TCHECK(*hb); 58251127Sdelphij 59251127Sdelphij ND_PRINT((ndo, "MS NLB heartbeat, host priority: %u,", 60251127Sdelphij EXTRACT_LE_32BITS(&(hb->host_prio)))); 61251127Sdelphij ND_PRINT((ndo, " cluster IP: %s,", ipaddr_string(&(hb->virtual_ip)))); 62251127Sdelphij ND_PRINT((ndo, " host IP: %s", ipaddr_string(&(hb->host_ip)))); 63251127Sdelphij return; 64251127Sdelphijtrunc: 65251127Sdelphij ND_PRINT((ndo, "[|MS NLB]")); 66251127Sdelphij} 67