esis.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* $NetBSD: esis.h,v 1.11 1997/11/03 15:01:19 is Exp $ */
  2. /*-
  3. * Copyright (c) 1991, 1993
  4. * The Regents of the University of California. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. All advertising materials mentioning features or use of this software
  15. * must display the following acknowledgement:
  16. * This product includes software developed by the University of
  17. * California, Berkeley and its contributors.
  18. * 4. Neither the name of the University nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * @(#)esis.h 8.1 (Berkeley) 6/10/93
  35. */
  36. /***********************************************************
  37. Copyright IBM Corporation 1987
  38. All Rights Reserved
  39. Permission to use, copy, modify, and distribute this software and its
  40. documentation for any purpose and without fee is hereby granted,
  41. provided that the above copyright notice appear in all copies and that
  42. both that copyright notice and this permission notice appear in
  43. supporting documentation, and that the name of IBM not be
  44. used in advertising or publicity pertaining to distribution of the
  45. software without specific, written prior permission.
  46. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  47. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  48. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  49. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  50. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  51. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  52. SOFTWARE.
  53. ******************************************************************/
  54. /*
  55. * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
  56. */
  57. #include <machine/endian.h>
  58. #define SNPAC_AGE 60 /* seconds */
  59. #define ESIS_CONFIG 60 /* seconds */
  60. #define ESIS_HT (ESIS_CONFIG * 2)
  61. /*
  62. * Fixed part of an ESIS header
  63. */
  64. struct esis_fixed {
  65. u_char esis_proto_id; /* network layer protocol identifier */
  66. u_char esis_hdr_len; /* length indicator (octets) */
  67. u_char esis_vers; /* version/protocol identifier
  68. * extension */
  69. u_char esis_res1; /* reserved */
  70. u_char esis_type; /* type code */
  71. /* technically, type should be &='d 0x1f */
  72. #define ESIS_ESH 0x02 /* End System Hello */
  73. #define ESIS_ISH 0x04 /* Intermediate System Hello */
  74. #define ESIS_RD 0x06 /* Redirect */
  75. u_char esis_ht_msb; /* holding time (seconds) high byte */
  76. u_char esis_ht_lsb; /* holding time (seconds) low byte */
  77. u_char esis_cksum_msb; /* checksum high byte */
  78. u_char esis_cksum_lsb; /* checksum low byte */
  79. } __attribute__((packed));
  80. /*
  81. * Values for ESIS datagram options
  82. */
  83. #define ESISOVAL_NETMASK 0xe1 /* address mask option, RD PDU only */
  84. #define ESISOVAL_SNPAMASK 0xe2 /* snpa mask option, RD PDU only */
  85. #define ESISOVAL_ESCT 0xc6 /* end system conf. timer, ISH PDU
  86. * only */
  87. #define ESIS_CKSUM_OFF 0x07
  88. #define ESIS_CKSUM_REQUIRED(pdu)\
  89. ((pdu->esis_cksum_msb != 0) || (pdu->esis_cksum_lsb != 0))
  90. #define ESIS_VERSION 1
  91. struct esis_stat {
  92. u_short es_nomem; /* insufficient memory to send hello */
  93. u_short es_badcsum; /* incorrect checksum */
  94. u_short es_badvers; /* incorrect version number */
  95. u_short es_badtype; /* unknown pdu type field */
  96. u_short es_toosmall; /* packet too small */
  97. u_short es_eshsent; /* ESH sent */
  98. u_short es_eshrcvd; /* ESH rcvd */
  99. u_short es_ishsent; /* ISH sent */
  100. u_short es_ishrcvd; /* ISH rcvd */
  101. u_short es_rdsent; /* RD sent */
  102. u_short es_rdrcvd; /* RD rcvd */
  103. };
  104. #ifdef _KERNEL
  105. struct esis_stat esis_stat;
  106. struct socket;
  107. struct mbuf;
  108. struct snpa_hdr;
  109. struct clnp_optidx;
  110. struct iso_addr;
  111. struct rtentry;
  112. struct sockaddr_dl;
  113. void esis_init __P((void));
  114. int esis_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *,
  115. struct mbuf *, struct proc *));
  116. void esis_input __P((struct mbuf *, ...));
  117. void esis_rdoutput __P((struct snpa_hdr *, struct mbuf *, struct clnp_optidx *,
  118. struct iso_addr *, struct rtentry *));
  119. int esis_insert_addr __P((caddr_t *, int *, struct iso_addr *, struct mbuf *,
  120. int));
  121. void esis_eshinput __P((struct mbuf *, struct snpa_hdr *));
  122. void esis_ishinput __P((struct mbuf *, struct snpa_hdr *));
  123. void esis_rdinput __P((struct mbuf *, struct snpa_hdr *));
  124. void esis_config __P((void *));
  125. void esis_shoutput __P((struct ifnet *, int, int, caddr_t, int,
  126. struct iso_addr *));
  127. void isis_input __P((struct mbuf *, ...));
  128. int isis_output __P((struct mbuf *, ...));
  129. void *esis_ctlinput __P((int, struct sockaddr *, void *));
  130. #endif /* _KERNEL */