home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / p / pcrte224.zip / SOURCE.ZIP / DL_IP.INC < prev    next >
Text File  |  1992-06-09  |  8KB  |  201 lines

  1. ;;*****************************************************************************
  2. ;;                        dl_ip.inc       dl_ip.inc
  3. ;;*****************************************************************************
  4. ;;
  5. ;;  Copyright (C) 1989 Northwestern University, Vance Morrison
  6. ;;
  7. ;;
  8. ;; Permission to view, compile, and modify for LOCAL (intra-organization) 
  9. ;; USE ONLY is hereby granted, provided that this copyright and permission 
  10. ;; notice appear on all copies.  Any other use by permission only.
  11. ;;
  12. ;; Northwestern University makes no representations about the suitability 
  13. ;; of this software for any purpose.  It is provided "as is" without expressed 
  14. ;; or implied warranty.  See the copywrite notice file for complete details.
  15. ;;
  16. ;;****************************************************************************
  17. ;;
  18. ;; dl_ip.inc is the dispatcher for the dl_ip object.  Basicly all this module 
  19. ;; does is look up the name in its database, and based on its name, call the 
  20. ;; correct routine for that dl_ip type (ATP, ARP ...).  
  21. ;;
  22. ;;
  23. ;; The functions provided by this file are
  24. ;;
  25. ;;   DL_IP_DECLARE name, real_dl, type
  26. ;;      DL_IP_DECLARE makes the association between the DL_IP object 'name' 
  27. ;;      and the object 'real_dl' which acutally supplies the routines.  'type'
  28. ;;      is the prefix for the real if (eg.  ARP)
  29. ;;   
  30. ;;   DL_IP_R_READ name, code_label
  31. ;;       DL_IP_R_READ declares that the code starting at 'code_label'
  32. ;;       should be called whenever a IP packet is read.  BX:ES is initilized 
  33. ;;       to the begining of the IP packet before 'macro_code' is called
  34. ;;       The code at 'code_label' should call ARP_DL_IP_R_RETURN when it
  35. ;;       is done processing the packet.
  36. ;;       This procedure can only be called once per 'name'
  37. ;;
  38. ;;   DL_IP_R_RETURN name
  39. ;;       DL_IP_R_RETURN should be executed by the READ routine to signal
  40. ;;       that it is done processing the packet.
  41. ;;
  42. ;;   DL_IP_R_CONT_in_BX_CX_ES_const_BX_CX_DX_BP_SI_DI_ES name, ok
  43. ;;       IF_R_CONT determines if the packet returned by R_READ in BX:ES
  44. ;;       of length CX is continuous.  If it is it jumps to 'ok' otherwise
  45. ;;       it just returns
  46. ;;
  47. ;;   DL_IP_W_ACCESS_in_CX_out_DI_ES_const_CX_BP name, fail
  48. ;;       DL_IP_W_ACCESS returns a pointer to an output buffer for a IP 
  49. ;;       packet.  The pointer is returned in DI:ES.  If the output buffer is 
  50. ;;       busy, this routine will block.   The buffer returned is at least
  51. ;;       min(CX, dl_&name&_ip_mtu) bytes long.If a buffer could not be accessed
  52. ;;       then this routine jumps to 'fail'
  53. ;;
  54. ;;   DL_IP_W_WRITE_in_AX_CX_const_BP name, broadcast
  55. ;;       DL_IP_W_WRITE actually signals the link layer to write a packet to the 
  56. ;;       network.  The packet is assumed to be in the buffer returned by 
  57. ;;       DL_IP_W_ACCESS.  CX is the length of the packet to send.  AX holds the 
  58. ;;       last two bytes of the IP address to send the packet to.  (notice we 
  59. ;;       are assuming a host portion of less that 16 bits)
  60. ;;       if 'broadcast' is not blank, then the packet is written to the
  61. ;;       broadcast address.  AX is ignored in this case
  62. ;;
  63. ;;   DL_IP_IS_BROADCAST_in_BX_ES_const_AX_BX_CX_DX_BP_DI_ES name
  64. ;;      DL_IP_IS_BROADCAST_in_BX_ES determines if the packet pointed to
  65. ;;      by BX:ES is a broadcast and sets the zero flag if it is NOT a 
  66. ;;      broadcast
  67. ;;
  68. ;;   DL_IP_COPY_in_CX_SI_DI_ES_out_SI_DI_const_BX_BP_ES name
  69. ;;      DL_IP_COPY_in_CX_SI_DI_ES copys a packet from the input buffer (pointed 
  70. ;;      to by SI and the segement register given in IF_DECLARE) to an output 
  71. ;;      buffer (pointed to by DI and dest_reg) of length CX.   It assumes the
  72. ;;      output buffer is contiguous.  (and the caller shouldn't care if the 
  73. ;;      input buffer is contiguous)  COPY updates the pointers SI and DI
  74. ;;      to the end of the packet, and COPY could be called again if CX is not
  75. ;;      the total packet length (Note that CX MUST be even if you care about
  76. ;;      SI, and DI being updated properly)
  77. ;;
  78. ;;
  79. ;;  The variables provided by this interface are (READ ONLY)
  80. ;;
  81. ;;      dl_ip_&name&_ip             the IP address
  82. ;;      dl_ip_&name&_mask           the network mask
  83. ;;      dl_ip_&name&_net            the network (IP addr bitwize AND ip_mask)
  84. ;;      dl_ip_&name&_broad          the network broadcast address
  85. ;;      dl_ip_&name&_flags          A word exclusively for IP use
  86. ;;      dl_ip_&name&_haddr          The hardware address 
  87. ;;      dl_ip_&name&_mtu            the mtu (max trans unit) for this interface
  88. ;;      dl_ip_&name&_metric         An interface metric (word for routing)
  89. ;;
  90. ;;      dl_ip_max_mtu               the max mtu for all DL_IP interfaces
  91. ;;      dl_ip_min_mtu               the min mtu for all DL_IP interfaces
  92. ;;
  93. ;;  The flag masks presently defined
  94. ;;      ROUTE_DL_SILENT         ;; don't send routing info out this dl_ip
  95. ;;      ROUTE_DL_DEAF           ;; don't listen to routing info from this dl_ip
  96. ;;      ARP_PROXY_ARP           ;; do proxy arp for all nets not on this subnet
  97. ;;      NO_DIR_BROAD            ;; do not broadcast directed broadcasts
  98. ;;      NO_REDIRECT             ;; do not send redirect messages
  99. ;;
  100. ;;*****************************************************************************
  101. dl_ip_max_mtu   = 1500
  102. dl_ip_min_mtu   = 576           ;; this is an internet mandate
  103.  
  104. ;; flags for the dl_ip_&name&_flags structure.  
  105. ROUTE_DL_SILENT     = (1 shl 0)  
  106. ROUTE_DL_DEAF       = (1 shl 1)  
  107. ARP_PROXY_ARP       = (1 shl 2)  
  108. NO_DIR_BROAD        = (1 shl 3)  
  109. NO_REDIRECT         = (1 shl 4)  
  110. ZERO_BROADCAST      = (1 shl 5)
  111.  
  112.  
  113. ;;*****************************************************************************
  114. ;; DL_IP_DECLARE name, real_routine, type
  115. ;;   
  116. DL_IP_DECLARE MACRO name, real_routine, type
  117.     .errb <init_flags>
  118.  
  119.     dl_&name&_name = real_routine
  120.     dl_&name&_type equ <type>
  121. ENDM
  122.  
  123. ;;******************************************************************************
  124. ;;   DL_IP_R_READ name, code
  125. ;;       
  126. DL_IP_R_READ MACRO name, code
  127.     HELPER macro myname, type, mycode
  128.         type&&_DL_IP_R_READ myname, mycode
  129.     ENDM
  130.  
  131.     HELPER  %dl_&name&_name, %dl_&name&_type, code
  132. ENDM
  133.  
  134. ;;******************************************************************************
  135. ;; DL_IP_R_CONT_in_BX_CX_ES name, ok
  136. ;;
  137. DL_IP_R_CONT_in_BX_CX_ES_const_BX_CX_DX_BP_SI_DI_ES MACRO name, ok
  138.     HELPER macro myname, type, myok
  139.         type&&_DL_IP_R_CONT_in_BX_CX_ES_const_BX_CX_DX_BP_SI_DI_ES name, myok
  140.     ENDM
  141.  
  142.     HELPER  %dl_&name&_name, %dl_&name&_type, ok
  143. ENDM
  144.  
  145. ;;******************************************************************************
  146. ;;   DL_IP_R_RETURN name
  147. ;;       
  148. DL_IP_R_RETURN MACRO name
  149.     HELPER macro myname, type
  150.         type&&_DL_IP_R_RETURN myname
  151.     ENDM
  152.  
  153.     HELPER  %dl_&name&_name, %dl_&name&_type
  154. ENDM
  155.  
  156. ;;******************************************************************************
  157. ;;   DL_IP_W_ACCESS_in_CX_out_DI_ES name, fail
  158. ;;
  159. DL_IP_W_ACCESS_in_CX_out_DI_ES_const_CX_BP MACRO name, fail
  160.     HELPER macro myname, type, myfail
  161.         type&&_DL_IP_W_ACCESS_in_CX_out_DI_ES_const_CX_BP myname, myfail
  162.     ENDM
  163.  
  164.     HELPER  %dl_&name&_name, %dl_&name&_type, fail
  165. ENDM
  166.  
  167. ;;******************************************************************************
  168. ;;   DL_IP_W_WRITE_in_AX_CX name, broadcast
  169. ;;
  170. DL_IP_W_WRITE_in_AX_CX_const_BP MACRO name, broadcast
  171.     HELPER macro myname, type, mybroad
  172.         type&&_DL_IP_W_WRITE_in_AX_CX_const_BP     myname, mybroad
  173.     ENDM
  174.  
  175.     HELPER  %dl_&name&_name, %dl_&name&_type, broadcast
  176. ENDM
  177.  
  178. ;;******************************************************************************
  179. ;;   DL_IP_IS_BROADCAST_in_BX_ES name
  180. ;;
  181. DL_IP_IS_BROADCAST_in_BX_ES_const_AX_BX_CX_DX_BP_DI_ES MACRO name
  182.     HELPER macro myname, type
  183.         type&&_DL_IP_IS_BROADCAST_in_BX_ES_const_AX_BX_CX_DX_BP_DI_ES myname, type
  184.     ENDM
  185.  
  186.     HELPER  %dl_&name&_name, %dl_&name&_type
  187. ENDM
  188.  
  189. ;;******************************************************************************
  190. ;;   DL_IP_COPY_in_CX_SI_DI_ES_out_SI_DI_const_BX_BP name
  191.  
  192. DL_IP_COPY_in_CX_SI_DI_ES_out_SI_DI_const_BX_BP_ES MACRO name
  193.     HELPER macro myname, type
  194.         type&&_DL_IP_COPY_in_CX_SI_DI_ES_out_SI_DI_const_BX_BP_ES myname
  195.     ENDM
  196.  
  197.     HELPER  %dl_&name&_name, %dl_&name&_type
  198. ENDM
  199.  
  200.  
  201.