Source

blake / blake_debugtables.c

Full commit
/*
Copyright (C) 2001-2006 Daybo Logic.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/*
  See header for details.
  Blake symbol tables.
*/

#define BLAKE_SOURCE

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /*HAVE_CONFIG_H*/

#include <time.h>
#include <stdio.h>

#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif /*HAVE_LIMITS_H*/

#ifdef BLAKE_HDRSTOP
# pragma hdrstop
#endif /*BLAKE_HDRSTOP*/

#ifdef HAVE_DLSTDINC_H
# include "dlstdinc.h"
#endif /*HAVE_DLSTDINC_H*/

#include "blake_threads.h"
#include "blake.h"
#include "blake_debugtables.h"
/*-------------------------------------------------------------------------*/
static const char *rcsid =
  "$Id: blake_debugtables.c,v 0.7 2006/03/17 18:27:00 ddrp Exp $";

static const char def[] = "UNKNOWN";
/*-------------------------------------------------------------------------*/
void blake_int_debugtables_NCI()
{
    blake_Unused(rcsid);
}
/*-------------------------------------------------------------------------*/
const char* blake_dbgtab_ProtocolPacketCode(
  bool IsServer,
  WORD Code
)
{
  static const char* serverCodes[] = {
    "bscsuspend",
    "bscresume",
    "bscchallenge",
    "bscgoterror",
    "bsclist_response",
    "bscwhois_info",
    "bscversioned",
    "bscsuper",
    "bsckilled",
    "bscchum_signon",
    "bscchum_signoff",
    "bscchum_idle",
    "bscloginreply",
    "bscisonlinereply"
  };

  static const char* clientCodes[] = {
    "bcclogin",
    "bccsuper_request",
    "bccadd_enemy",
    "bccnot_enemy",
    "bccjoin_chat",
    "bcclist",
    "bcckilluser",
    "bcckillchat",
    "bcckick",
    "bccreserved0",
    "bccnonsense0",
    "bccversion",
    "bccmessage",
    "bccchatmsg",
    "bccwhois",
    "bccundocumented0",
    "bccremoteshutdown",
    "bccchum_add",
    "bccchum_remove",
    "bccidle",
    "bccisonline"
  };

  if ( IsServer ) { /* Server code? */
    if ( Code >= sizeof(serverCodes)/sizeof(serverCodes[0]) )
      return def;
    return serverCodes[Code];
  }

  /* Client code */
  if ( Code >= sizeof(clientCodes)/sizeof(clientCodes[0]) )
    return def;
  return clientCodes[Code];
}
/*-------------------------------------------------------------------------*/
const char* blake_dbgtab_HashType(enum blakeHashType HashType)
{
  static const char* hashTypes[] = {
    "bhtMd5",
    "bhtDoubleMd5",
    "bhtSha",
    "bhtSha1"
  };

  if ( HashType >= sizeof(hashTypes)/sizeof(hashTypes[0]) )
    return def;
  return hashTypes[HashType];
}
/*-------------------------------------------------------------------------*/
const char* blake_dbgtab_ClientID(enum blakeClientID ClientID)
{
  static const char* clientids[] = {
    "bClientIdOberChatten",
    "bClientIdOCTurboUNIX",
    "bClientIdOCLogin",
    "bClientIdDDRPLogin",
    "bClientIdOC32",
    "bClientIdJava",
    "bClientIdSarah"
  };

  if ( ClientID >= sizeof(clientids)/sizeof(clientids[0]) )
    return def;
  return clientids[ClientID];
}
/*-------------------------------------------------------------------------*/