/*
    Copyright 2000 (c) by David Schweikert,
    Swiss Federal Institute of Technology,
    Computer Engineering and Networks Laboratory.
 
    TOPSY -- A Teachable Operating System.
             Implementation of a tiny and simple
             micro kernel for teaching purposes.
 
    For further information, please visit http://www.tik.ee.ethz.ch/~topsy
 
    This software is provided under the terms of the GNU General Public 
    Licence. A full copy of the GNU GPL is provided in the file COPYING 
    found in the development root of Topsy.
*/
/*
    File:                  $Source: /home/ruf/cvs_Topsy/cvs/Topsy/Net/NetDebug.h,v $
    Affiliation:           ETH Zuerich, TIK
    Version:               $Revision: 2922 $
    Last Date of Change:   $Date: 2007-03-19 17:48:52 +0100 (Mon, 19 Mär 2007) $  by: $Author: baderma $
 
*/
#ifndef _NETDEBUG_H
#define _NETDEBUG_H

#include "Topsy.h"
#include "NetBuf.h"
#include "NetAttr.h"
#include <stdarg.h>

#define NETDEBUG_GENERIC  (1UL << 0)
#define NETDEBUG_MEMORY   (1UL << 1)
#define NETDEBUG_NETBUFS  (1UL << 2)
#define NETDEBUG_DEVICES  (1UL << 3)
#define NETDEBUG_INQUEUE  (1UL << 4)
#define NETDEBUG_CONFMNGR (1UL << 5)
#define NETDEBUG_MODULES  (1UL << 6)
#define NETDEBUG_QUEUE    (1UL << 7)
#define NETDEBUG_ETHERNET (1UL << 8)
#define NETDEBUG_ARP      (1UL << 9)
#define NETDEBUG_IP       (1UL << 10)
#define NETDEBUG_IP6      (1UL << 17)
#define NETDEBUG_ICMP     (1UL << 11)
#define NETDEBUG_ICMP6    (1UL << 18)
#define NETDEBUG_CONFIG   (1UL << 12)
#define NETDEBUG_UDP      (1UL << 13)
#define NETDEBUG_TCP      (1UL << 14)
#define NETDEBUG_TIMER    (1UL << 15)
#define NETDEBUG_SOCKET   (1UL << 16)
#define NETDEBUG_AUTOCONFIG (1UL << 19)
#define NETDEBUG_ARP6      (1UL << 20)
#define NETDEBUG_TEST      (1UL << 21)
#define NETDEBUG_NETBUFS2  (1UL << 22)
#define NETDEBUG_TFTPC  (1UL << 23)

/* CHANGE THIS: */
#define NETDEBUG
//#define NETDEBUG_MASK  (NETDEBUG_MODULES)
//#define NETDEBUG_MASK  ( NETDEBUG_GENERIC | NETDEBUG_MODULES | NETDEBUG_CONFIG | NETDEBUG_IP | NETDEBUG_UDP | NETDEBUG_ETHERNET )
//#define NETDEBUG_MASK  (NETDEBUG_TCP | NETDEBUG_IP | NETDEBUG_ETHERNET | NETDEBUG_ETHERTAP | NETDEBUG_CONFIG | NETDEBUG_TIMER)
//#define NETDEBUG_MASK  (/*NETDEBUG_GENERIC |*/ NETDEBUG_TCP | NETDEBUG_TIMER)
//#define NETDEBUG_MASK ( NETDEBUG_ARP | NETDEBUG_CONFIG | NETDEBUG_MODULES | NETDEBUG_UDP )
//#define NETDEBUG_MASK 0
//#define NETDEBUG_MASK ( NETDEBUG_ARP | NETDEBUG_ICMP | NETDEBUG_INQUEUE)
//#define NETDEBUG_MASK ( NETDEBUG_CONFIG )
#define NETDEBUG_MASK ( NETDEBUG_TEST | NETDEBUG_CONFIG )
//#define NETDEBUG_MASK ( 0xFFFFFFFF ^ NETDEBUG_MEMORY ^ NETDEBUG_NETBUFS )
//#define NETDEBUG_MASK ( NETDEBUG_DEVICES | NETDEBUG_GENERIC | NETDEBUG_CONFMNGR )

#ifdef NETDEBUG
extern ThreadId netdbg_tty;
void netdbgInit();
void netdbgEnd();
void netdbgDisplay(unsigned long family, char *);
void netdbgPrintf(unsigned long family, char *fmt, ...);
void netdbgDumpBuf(unsigned long family, NetBuf buf);
void netdbgDumpAttr(unsigned long family, NetAttrs attr);
#else
/* This is gcc... There is still some overhead -> to be removed at the end. */
inline static void netdbgInit()
{}
inline static void netdbgEnd()
{}
inline static void netdbgDisplay()
{}
inline static void netdbgPrintf()
{}
inline static void netdbgDumpBuf()
{}
inline static void netdbgDumpAttr()
{}
#endif

#endif
