darwin-xnu/bsd/netat/debug.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
   3 *
   4 * @APPLE_LICENSE_HEADER_START@
   5 * 
   6 * The contents of this file constitute Original Code as defined in and
   7 * are subject to the Apple Public Source License Version 1.1 (the
   8 * "License").  You may not use this file except in compliance with the
   9 * License.  Please obtain a copy of the License at
  10 * http://www.apple.com/publicsource and read it before using this file.
  11 * 
  12 * This Original Code and all software distributed under the License are
  13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17 * License for the specific language governing rights and limitations
  18 * under the License.
  19 * 
  20 * @APPLE_LICENSE_HEADER_END@
  21 */
  22/*
  23 *      Copyright (c) 1988, 1989, 1997 Apple Computer, Inc.
  24 */
  25
  26/* netat/debug.h */
  27
  28#ifndef _NETAT_DEBUG_H_
  29#define _NETAT_DEBUG_H_
  30#include <sys/appleapiopts.h>
  31#ifdef __APPLE_API_OBSOLETE
  32#ifdef PRIVATE
  33
  34#define D_L_FATAL               0x00000001
  35#define D_L_ERROR               0x00000002
  36#define D_L_WARNING             0x00000004
  37#define D_L_INFO                0x00000008
  38#define D_L_VERBOSE             0x00000010
  39#define D_L_STARTUP             0x00000020
  40#define D_L_STARTUP_LOW         0x00000040
  41#define D_L_SHUTDN              0x00000080
  42#define D_L_SHUTDN_LOW          0x00000100
  43#define D_L_INPUT               0x00000200
  44#define D_L_OUTPUT              0x00000400
  45#define D_L_STATS               0x00000800
  46#define D_L_STATE_CHG           0x00001000      /* re-aarp, ifState etc. */
  47#define D_L_ROUTING             0x00002000
  48#define D_L_DNSTREAM            0x00004000
  49#define D_L_UPSTREAM            0x00008000
  50#define D_L_STARTUP_INFO        0x00010000
  51#define D_L_SHUTDN_INFO         0x00020000
  52#define D_L_ROUTING_AT          0x00040000      /* atalk address routing */
  53#define D_L_USR1                0x01000000
  54#define D_L_USR2                0x02000000
  55#define D_L_USR3                0x04000000
  56#define D_L_USR4                0x08000000
  57#define D_L_TRACE               0x10000000
  58
  59
  60#define D_M_PAT                 0x00000001
  61#define D_M_PAT_LOW             0x00000002
  62#define D_M_ELAP                0x00000004
  63#define D_M_ELAP_LOW            0x00000008
  64#define D_M_DDP                 0x00000010
  65#define D_M_DDP_LOW             0x00000020
  66#define D_M_NBP                 0x00000040
  67#define D_M_NBP_LOW             0x00000080
  68#define D_M_ZIP                 0x00000100
  69#define D_M_ZIP_LOW             0x00000200
  70#define D_M_RTMP                0x00000400
  71#define D_M_RTMP_LOW            0x00000800
  72#define D_M_ATP                 0x00001000
  73#define D_M_ATP_LOW             0x00002000
  74#define D_M_ADSP                0x00004000
  75#define D_M_ADSP_LOW            0x00008000
  76#define D_M_AEP                 0x00010000
  77#define D_M_AARP                0x00020000
  78#define D_M_ASP                 0x00040000
  79#define D_M_ASP_LOW             0x00080000
  80#define D_M_AURP                0x00100000
  81#define D_M_AURP_LOW            0x00200000
  82#define D_M_TRACE               0x10000000
  83
  84        /* macros for working with atp data at the lap level. 
  85         * These are for tracehook performance measurements only!!!
  86         * It is assumed that the ddp & atp headers are at the top of the
  87         * mblk, occupy contiguous memory and the atp headers are of the
  88         * extended type only.
  89         */
  90
  91typedef struct dbgBits {
  92        unsigned long   dbgMod; /* debug module bitmap (used in dPrintf) */
  93        unsigned long   dbgLev; /* debug level bitmap */
  94} dbgBits_t;
  95
  96extern dbgBits_t        dbgBits;
  97
  98        /* macros for debugging */
  99#ifdef DEBUG
 100#define dPrintf(mod, lev, p) \
 101        if (((mod) & dbgBits.dbgMod) && ((lev) & dbgBits.dbgLev)) {\
 102                 kprintf p;  \
 103        }
 104#else
 105#define dPrintf(mod, lev, p)
 106#endif
 107
 108/* 8/5/98 LD: Adds MacOSX kernel debugging facility */
 109/* note: kdebug must be added to the "RELEASE" config in conf/MASTER.ppc */
 110
 111#include <sys/kdebug.h>
 112#if KDEBUG
 113/*
 114  Strings for the "trace/codes" file:
 115
 1160x02650004      AT_DDPinput
 117
 1180x02680000      AT_ADSP_Misc
 1190x02680004      AT_ADSP_RxData
 1200x02680008      AT_ADSP_SndData
 1210x0268000C      AT_ADSP_Read
 1220x02680010      AT_ADSP_Write
 1230x02680014      AT_ADSP_mbuf
 1240x02680018      AT_ADSP_putnext
 1250x0268001c      AT_ADSP_ATrw
 126
 127*/
 128
 129/* usage:
 130      KERNEL_DEBUG(DBG_AT_DDP_INPUT | DBG_FUNC_START, 0,0,0,0,0);
 131      KERNEL_DEBUG(DBG_AT_DDP_INPUT, 0,0,0,0,0);
 132      KERNEL_DEBUG(DBG_AT_DDP_INPUT | DBG_FUNC_END, 0,0,0,0,0);
 133*/
 134
 135#define DBG_AT_DDP_INPUT NETDBG_CODE(DBG_NETDDP, 1)
 136#define DBG_AT_DDP_OUTPUT NETDBG_CODE(DBG_NETDDP, 2)
 137
 138#define DBG_ADSP_MISC   NETDBG_CODE(DBG_NETADSP, 0)
 139#define DBG_ADSP_RCV    NETDBG_CODE(DBG_NETADSP, 1)
 140#define DBG_ADSP_SND    NETDBG_CODE(DBG_NETADSP, 2)
 141#define DBG_ADSP_READ   NETDBG_CODE(DBG_NETADSP, 3)
 142#define DBG_ADSP_WRITE  NETDBG_CODE(DBG_NETADSP, 4)
 143#define DBG_ADSP_MBUF   NETDBG_CODE(DBG_NETADSP, 5)
 144#define DBG_ADSP_PNEXT  NETDBG_CODE(DBG_NETADSP, 6)
 145#define DBG_ADSP_ATRW   NETDBG_CODE(DBG_NETADSP, 7)
 146#endif
 147
 148#define trace_mbufs(pri, str, start)\
 149{ if (start)\
 150{   int i; gbuf_t *tmp;\
 151    for (tmp=start, i=0; tmp && i < 10; tmp = gbuf_cont(tmp), i++) {\
 152        dPrintf(pri, D_L_TRACE, ("%s=0x%x, len=%d %s\n",\
 153                                 str, tmp, gbuf_len(tmp),\
 154                                 (((struct mbuf *)tmp)->m_flags & M_EXT)?"CL":""));\
 155        KERNEL_DEBUG(DBG_ADSP_MBUF,  0, tmp, gbuf_len(tmp), gbuf_next(tmp), \
 156                ((struct mbuf *)tmp)->m_flags & M_EXT);\
 157}}}
 158
 159/* from h/atlog.h */
 160
 161/* These pointers are non-NULL if logging or tracing are activated. */
 162#ifndef LOG_DRIVER
 163extern char *log_errp;  
 164extern char *log_trcp;
 165#endif  /* LOG_DRIVER */
 166
 167/* ATTRACE() macro.  Use this routine for calling 
 168 * streams tracing and logging.  If `log' is TRUE, then
 169 * this event will also be logged if logging is on.
 170 */
 171#if !defined(lint) && defined(AT_DEBUG)
 172#define ATTRACE(mid,sid,level,log,fmt,arg1,arg2,arg3)           \
 173        if (log_trcp || (log && log_errp)) {                    \
 174                strlog(mid,sid,level,SL_TRACE |                 \
 175                        (log ? SL_ERROR : 0)  |                 \
 176                        (level <= AT_LV_FATAL ? SL_FATAL : 0),  \
 177                        fmt,arg1,arg2,arg3);                    \
 178        }
 179#else
 180#define ATTRACE(mid,sid,level,log,fmt,arg1,arg2,arg3)           \
 181/*      printf(fmt, arg1, arg2, arg3); */
 182
 183#endif
 184
 185
 186/* Levels for AppleTalk tracing */
 187
 188#define AT_LV_FATAL     1
 189#define AT_LV_ERROR     3
 190#define AT_LV_WARNING   5
 191#define AT_LV_INFO      7
 192#define AT_LV_VERBOSE   9
 193
 194
 195/* Sub-ids for AppleTalk tracing, add more if you can't figure
 196 * out where your event belongs.
 197 */
 198
 199#define AT_SID_INPUT    1       /* Network incoming packets */
 200#define AT_SID_OUTPUT   2       /* Network outgoing packets */
 201#define AT_SID_TIMERS   3       /* Protocol timers */
 202#define AT_SID_FLOWCTRL 4       /* Protocol flow control */
 203#define AT_SID_USERREQ  5       /* User requests */
 204#define AT_SID_RESOURCE 6       /* Resource limitations */
 205
 206
 207
 208/* Module ID's for AppleTalk subsystems */
 209
 210#define AT_MID(n)       (200+n)
 211
 212/* 
 213#define AT_MID_MISC     AT_MID(0)       not used
 214#define AT_MID_LLAP     AT_MID(1)       not_used
 215#define AT_MID_ELAP     202             moved to lap.h
 216#define AT_MID_DDP      203             moved to ddp.h
 217#define AT_MID_RTMP     AT_MID(4)       not used
 218#define AT_MID_NBP      AT_MID(5)       not used
 219#define AT_MID_EP       AT_MID(6)       not used
 220#define AT_MID_ATP      AT_MID(7)       not used
 221#define AT_MID_ZIP      AT_MID(8)       not needed
 222#define AT_MID_PAP      AT_MID(9)       not used
 223#define AT_MID_ASP      AT_MID(10)      redefined in adsp.h
 224#define AT_MID_AFP      AT_MID(11)      not used
 225#define AT_MID_ADSP     212             moved to adsp.h
 226#define AT_MID_NBPD     AT_MID(13)      not used
 227#define AT_MID_LAP      214             moved to lap.h
 228#define AT_MID_LAST     214
 229*/
 230
 231#ifdef  AT_MID_STRINGS
 232static char *at_mid_strings[] = {
 233        "misc",
 234        "LLAP",
 235        "ELAP",
 236        "DDP",
 237        "RTMP",
 238        "NBP",
 239        "EP",
 240        "ATP",
 241        "ZIP",
 242        "PAP",
 243        "ASP",
 244        "AFP",
 245        "ADSP",
 246        "NBPD",
 247        "LAP"
 248};
 249#endif
 250
 251
 252#ifndef SL_FATAL
 253/* Don't define these if they're already defined */
 254
 255/* Flags for log messages */
 256
 257#define SL_FATAL        01      /* indicates fatal error */
 258#define SL_NOTIFY       02      /* logger must notify administrator */
 259#define SL_ERROR        04      /* include on the error log */
 260#define SL_TRACE        010     /* include on the trace log */
 261
 262#endif
 263
 264#endif /* PRIVATE */
 265#endif /* __APPLE_API_OBSOLETE */
 266#endif /* _NETAT_DEBUG_H_ */
 267
 268
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.