af.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:3k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* af.h - address family header file */
  2. /* Copyright 1984-1992 Wind River Systems, Inc. */
  3. /*
  4.  * Copyright (c) 1980, 1986 Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms are permitted
  8.  * provided that the above copyright notice and this paragraph are
  9.  * duplicated in all such forms and that any documentation,
  10.  * advertising materials, and other materials related to such
  11.  * distribution and use acknowledge that the software was developed
  12.  * by the University of California, Berkeley.  The name of the
  13.  * University may not be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  *
  19.  *      @(#)af.h        7.3 (Berkeley) 6/27/88
  20.  */
  21. /*
  22. modification history
  23. --------------------
  24. 01h,22sep92,rrr  added support for c++
  25. 01g,26may92,rrr  the tree shuffle
  26. 01f,04oct91,rrr  passed through the ansification filter
  27.   -changed copyright notice
  28. 01e,05oct90,shl  added copyright notice.
  29.                  made #endif ANSI style.
  30. 01d,16apr89,gae  updated to new 4.3BSD.
  31. 01c,03apr87,ecs  added header and copyright.
  32. 01b,22dec86,dnw  added IMPORT to declaration of afswitch to satisfy
  33.    Intermetrics assembler.
  34. */
  35. #ifndef __INCafh
  36. #define __INCafh
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /*
  41.  * Address family routines,
  42.  * used in handling generic sockaddr structures.
  43.  *
  44.  * Hash routine is called
  45.  * af_hash(addr, h);
  46.  * struct sockaddr *addr; struct afhash *h;
  47.  * producing an afhash structure for addr.
  48.  *
  49.  * Netmatch routine is called
  50.  * af_netmatch(addr1, addr2);
  51.  * where addr1 and addr2 are sockaddr *.  Returns 1 if network
  52.  * values match, 0 otherwise.
  53.  */
  54. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  55. #pragma align 1                 /* tell gcc960 not to optimize alignments */
  56. #endif  /* CPU_FAMILY==I960 */
  57. struct afswitch {
  58. int (*af_hash)();
  59. int (*af_netmatch)();
  60. int (*af_output)(); /* interprets address for sending */
  61. int (*af_portmatch)(); /* packet from some other router? */
  62. int (*af_portcheck)(); /* packet from privileged peer? */
  63. int (*af_checkhost)(); /* tells if address is valid */
  64. int (*af_rtflags)(); /* get flags for route (host or net) */
  65. int (*af_sendroute)(); /* check bounds of subnet broadcast */
  66. int (*af_canon)(); /* canonicalize address for compares */
  67. char *(*af_format)(); /* convert address to string */
  68. };
  69. struct afhash {
  70. u_int afh_hosthash;
  71. u_int afh_nethash;
  72. };
  73. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  74. #pragma align 0                 /* turn off alignment requirement */
  75. #endif  /* CPU_FAMILY==I960 */
  76. IMPORT struct afswitch afswitch[];
  77. extern int af_max; /* number of entries in table */
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif /* __INCafh */