The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netatalk/at_rmx.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright 1994, 1995 Massachusetts Institute of Technology
    3  *
    4  * Permission to use, copy, modify, and distribute this software and
    5  * its documentation for any purpose and without fee is hereby
    6  * granted, provided that both the above copyright notice and this
    7  * permission notice appear in all copies, that both the above
    8  * copyright notice and this permission notice appear in all
    9  * supporting documentation, and that the name of M.I.T. not be used
   10  * in advertising or publicity pertaining to distribution of the
   11  * software without specific, written prior permission.  M.I.T. makes
   12  * no representations about the suitability of this software for any
   13  * purpose.  It is provided "as is" without express or implied
   14  * warranty.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
   17  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
   18  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
   20  * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   23  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  * at_rmx.c,v 1.13 1995/05/30 08:09:31 rgrimes Exp
   30  */
   31 
   32 /* This code generates debugging traces to the radix code */
   33 
   34 #include <sys/param.h>
   35 #include <sys/systm.h>
   36 #include <sys/socket.h>
   37 
   38 #include <net/route.h>
   39 
   40 int at_inithead(void **head, int off);
   41 
   42 static char hexbuf[256];
   43 
   44 static char *
   45 prsockaddr(void *v)
   46 {
   47         char *bp = &hexbuf[0];
   48         u_char *cp = v;
   49 
   50         if (v) {
   51                 int len = *cp;
   52                 u_char *cplim = cp + len;
   53 
   54                 /* return: "(len) hexdump" */
   55 
   56                 bp += sprintf(bp, "(%d)", len);
   57                 for (cp++; cp < cplim && bp < hexbuf+252; cp++) {
   58                         *bp++ = "0123456789abcdef"[*cp / 16];
   59                         *bp++ = "0123456789abcdef"[*cp % 16];
   60                 }
   61         } else {
   62                 bp+= sprintf(bp, "null");
   63         }
   64         *bp = '\0';
   65         
   66         return &hexbuf[0];
   67 }
   68 
   69 static struct radix_node *
   70 at_addroute(void *v_arg, void *n_arg, struct radix_node_head *head,
   71             struct radix_node *treenodes)
   72 {
   73         struct radix_node *rn;
   74 
   75         printf("at_addroute: v=%s\n", prsockaddr(v_arg));
   76         printf("at_addroute: n=%s\n", prsockaddr(n_arg));
   77         printf("at_addroute: head=%p treenodes=%p\n",
   78             (void *)head, (void *)treenodes);
   79 
   80         rn = rn_addroute(v_arg, n_arg, head, treenodes);
   81 
   82         printf("at_addroute: returns rn=%p\n", (void *)rn);
   83 
   84         return rn;
   85 }
   86 
   87 static struct radix_node *
   88 at_matroute(void *v_arg, struct radix_node_head *head)
   89 {
   90         struct radix_node *rn;
   91 
   92         printf("at_matroute: v=%s\n", prsockaddr(v_arg));
   93         printf("at_matroute: head=%p\n", (void *)head);
   94 
   95         rn = rn_match(v_arg, head);
   96 
   97         printf("at_matroute: returnr rn=%p\n", (void *)rn);
   98 
   99         return rn;
  100 }
  101 
  102 static struct radix_node *
  103 at_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
  104 {
  105         struct radix_node *rn;
  106 
  107         printf("at_lookup: v=%s\n", prsockaddr(v_arg));
  108         printf("at_lookup: n=%s\n", prsockaddr(m_arg));
  109         printf("at_lookup: head=%p\n", (void *)head);
  110 
  111         rn = rn_lookup(v_arg, m_arg, head);
  112 
  113         printf("at_lookup: returns rn=%p\n", (void *)rn);
  114 
  115         return rn;
  116 }
  117 
  118 static struct radix_node *  
  119 at_delroute(void *v_arg, void *netmask_arg, struct radix_node_head *head)
  120 {
  121         struct radix_node *rn;
  122 
  123         printf("at_delroute: v=%s\n", prsockaddr(v_arg));
  124         printf("at_delroute: n=%s\n", prsockaddr(netmask_arg));
  125         printf("at_delroute: head=%p\n", (void *)head);
  126 
  127         rn = rn_delete(v_arg, netmask_arg, head);
  128 
  129         printf("at_delroute: returns rn=%p\n", (void *)rn);
  130 
  131         return rn;
  132 }
  133 
  134 /*
  135  * Initialize our routing tree with debugging hooks.
  136  */
  137 int
  138 at_inithead(void **head, int off)
  139 {
  140         struct radix_node_head *rnh;
  141 
  142         if(!rn_inithead(head, off))
  143                 return 0;
  144 
  145         rnh = *head;
  146         rnh->rnh_addaddr = at_addroute;
  147         rnh->rnh_deladdr = at_delroute;
  148         rnh->rnh_matchaddr = at_matroute;
  149         rnh->rnh_lookup = at_lookup;
  150         return 1;
  151 }

Cache object: 06df4a6054a4ab93782af1629ffce315


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.