%( **************************************************************** Copyright (c) 1992, Carnegie Mellon University All Rights Reserved Permission is hereby granted to use, copy, modify, and distribute this software provided that the above copyright notice appears in all copies and that any distribution be for noncommercial purposes. Carnegie Mellon University disclaims all warranties with regard to this software. In no event shall Carnegie Mellon University be liable for any special, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data, or profits arising out of or in connection with the use or performance of this software. **************************************************************** )% MODULE IP_Parse ( LANGUAGE (BLISS32), ADDRESSING_MODE(EXTERNAL=LONG_RELATIVE, NONEXTERNAL=LONG_RELATIVE), LIST (ASSEMBLY, BINARY, NOEXPAND)) = BEGIN LIBRARY 'SYS$LIBRARY:STARLET'; LIBRARY 'SYS$LIBRARY:TPAMAC'; ROUTINE Store (TParse_BLock_A, Byte_Number) = !++ ! Description: ! ! This routine is called by TParse Action Routines. !-- BEGIN BIND TParse_BLock = .TParse_BLock_A : $BBLOCK, Addr_Number_A = .TParse_Block [TPA$L_PARAM] : LONG UNSIGNED, Addr_Vec = Addr_Number_A : VECTOR [,BYTE], Value = TParse_Block [TPA$L_NUMBER] : LONG UNSIGNED; IF .Value GTRU 255 THEN RETURN (0); Addr_Vec [.Byte_Number] = .TParse_Block [TPA$L_NUMBER]; SS$_NORMAL END; !++ ! Functional Description: ! ! TParse Action Routines !-- ROUTINE Store_0 = (BUILTIN AP; Store (.AP, 0)); ROUTINE Store_1 = (BUILTIN AP; Store (.AP, 1)); ROUTINE Store_2 = (BUILTIN AP; Store (.AP, 2)); ROUTINE Store_3 = (BUILTIN AP; Store (.AP, 3)); FORWARD IP_Addr_State : VECTOR [0], IP_Addr_Key : VECTOR [0]; GLOBAL ROUTINE Parse_IP_Address (Addr_Desc_A, Addr_Number_A) = !++ ! Functional Description: ! ! Parse the IP Address of the form a.b.c.d into a decimal number. !-- BEGIN BIND Addr_Desc = .Addr_Desc_A : $BBLOCK; EXTERNAL ROUTINE LIB$TPARSE : BLISS ADDRESSING_MODE (GENERAL); LOCAL TParse_Block : $BBLOCK [TPA$C_LENGTH0] PRESET ( [TPA$L_COUNT] = TPA$K_COUNT0, [TPA$L_STRINGCNT] = .Addr_Desc [DSC$W_LENGTH], [TPA$L_STRINGPTR] = .Addr_Desc [DSC$A_POINTER], [TPA$L_PARAM] = .Addr_Number_A), Status; Status = LIB$TPARSE (TParse_Block, IP_Addr_State, IP_Addr_Key); IF NOT .Status THEN RETURN (.Status); SS$_NORMAL END; !++ ! Description: ! ! TParse State Table for a.b.c.d !-- $INIT_State (IP_Addr_State, IP_Addr_Key); $State (IP_Addr_Start, (TPA$_DECIMAL, , Store_0)); $State (, ('.')); $State (, (TPA$_DECIMAL, , Store_1)); $State (, ('.')); $State (, (TPA$_DECIMAL, , Store_2)); $State (, ('.')); $State (, (TPA$_DECIMAL, , Store_3)); $State (, (TPA$_EOS, TPA$_EXIT)); END ELUDOM