/* ***************************************************************************** * * Copyright © 1996 Digital Equipment Corporation. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by Digital Equipment Corporation. The name of the * Corporation may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * ***************************************************************************** FACILITY: PPPD ABSTRACT: This module contains the prototypes, definitions, etc. for routines in the PPPD utility that are shared by several modules. This is part of the user interface to the Point to Point (PPPD) Utility. AUTHOR: Iris Langstein Realmuto 21-December-1995 REVISION HISTORY: X-7 BWK007 Barry W. Kierstein 17-DEC-1996 Replaced the standard Digital copyright with one compatible with the CMU copyright. X-6 BWK006 Barry W. Kierstein 24-SEP-1996 Moved CHECK_AND* macros out of the DEBUG_CODE conditional in conjunction with the dialout error reporting standardization. Added REPORT_CONTEXT_AND_STATUS_1_1P2 in conjunction with QAR fixes in PPPDUTIL.C. X-5 BWK005 Barry W. Kierstein 02-AUG-1996 Added CHECK_AND_REPORT* macros for better error reporting. X-4 BWK004 Barry W. Kierstein 11-JUL-1996 Finished DIAL_OUT and HELP commands, fixed numerous bugs. X-3 BWK003 Barry W. Kierstein 14-JUN-1996 Finished the SET and SHOW sections, fixed numerous bugs. X-2 BWK002 Barry W. Kierstein 14-MAY-1996 Implemented initial SHOW command and fixed numerous bugs. X-1 BWK001 Barry W. Kierstein 12-APR-1996 Initial check in of this module. */ /* Macros */ #define FAILURE(x) (((x) & 1) == 0) #define SUCCESS(x) (((x) & 1) != 0) /* Debugging definitions */ #ifdef DEBUG_CODE #define DEBUG_STACK_MAX 500 #ifdef PPPD_MAIN int debug_stack[DEBUG_STACK_MAX], debug_sub; #else extern int debug_stack[DEBUG_STACK_MAX], debug_sub; #endif #define DEBUG_STORE_LOCATION 1 #define DEBUG_STORE_LONGWORD 2 #define INIT_DEBUG_STORAGE debug_sub = 0 #define REPORT_LOCATION_AND_STATUS(location,status) \ signal_error (PPPD$_BADSTATUS1, 2, location, status); \ signal_error (status, 0); #define REPORT_CONTEXT_AND_STATUS(location,context,status) \ signal_error (PPPD$_BADSTATUS1, 2, location, status); \ signal_error (status, 0); #define REPORT_LOCATION_AND_STATUS_1(location,status,p1) \ signal_error (PPPD$_BADSTATUS2, 3, location, status, p1); \ signal_error (status, 1, p1); #define REPORT_CONTEXT_AND_STATUS_1_0(location,context,status,p1) \ signal_error (PPPD$_BADSTATUS1, 2, location, status); \ signal_error (status, 0); #define REPORT_CONTEXT_AND_STATUS_1_1(location,context,status,p1) \ signal_error (PPPD$_BADSTATUS2, 3, location, status, p1); \ signal_error (status, 1, p1); #define REPORT_CONTEXT_AND_STATUS_1_1P2(location,context,status,p1,p2) \ signal_error (PPPD$_BADSTATUS2, 3, location, status, p1); \ signal_error (status, 1, p2); #define REPORT_LOCATION_AND_STATUS_2(location,status,p1,p2) \ signal_error (PPPD$_BADSTATUS3, 4, location, status, p1, p2); \ signal_error (status, 2, p1, p2); #define STORE_DEBUG_LOCATION(routine,place) \ if (debug_sub < DEBUG_STACK_MAX) \ debug_stack[debug_sub++] = (DEBUG_STORE_LOCATION << 16) + \ (routine << 8) + place; #define STORE_DEBUG_LONGWORD(routine,place,longword) \ if (debug_sub < DEBUG_STACK_MAX) \ { \ debug_stack[debug_sub++] = (DEBUG_STORE_LONGWORD << 16) + \ (routine << 8) + place; \ debug_stack[debug_sub++] = longword; \ } #else #define INIT_DEBUG_STORAGE #define REPORT_LOCATION_AND_STATUS(location,status) \ signal_error (status, 0); #define REPORT_CONTEXT_AND_STATUS(location,context,status) \ signal_error (context, 0); \ signal_error (status, 0); #define REPORT_LOCATION_AND_STATUS_1(location,status, p1) \ signal_error (status, 1, p1); #define REPORT_CONTEXT_AND_STATUS_1_0(location,context,status,p1) \ signal_error (context, 1, p1); \ signal_error (status, 0); #define REPORT_CONTEXT_AND_STATUS_1_1(location,context,status,p1) \ signal_error (context, 1, p1); \ signal_error (status, 1, p1); #define REPORT_CONTEXT_AND_STATUS_1_1P2(location,context,status,p1,p2) \ signal_error (context, 1, p1); \ signal_error (status, 1, p2); #define REPORT_LOCATION_AND_STATUS_2(location,status,p1,p2) \ signal_error (status, 2, p1, p2); #define STORE_DEBUG_LOCATION(routine,place) #define STORE_DEBUG_LONGWORD(routine,place,longword) #endif #define CHECK_AND_REPORT_CONTEXT_AND_STATUS(location,context,status) \ if FAILURE(status) \ { \ REPORT_CONTEXT_AND_STATUS(location,context,status) \ return FALSE; \ }; #define CHECK_AND_REPORT_CONTEXT_AND_STATUS_1_0(location,context,status,p1) \ if FAILURE(status) \ { \ REPORT_CONTEXT_AND_STATUS_1_0(location,context,status,p1) \ return FALSE; \ }; #define CHECK_AND_REPORT_CONTEXT_AND_STATUS_1_1(location,context,status,p1) \ if FAILURE(status) \ { \ REPORT_CONTEXT_AND_STATUS_1_1(location,context,status,p1) \ return FALSE; \ }; /* Make things visible for the .STB file if debugging */ #ifdef DEBUG_CODE #define PROC_STATIC #define VAR_STATIC #else #define PROC_STATIC static #define VAR_STATIC static #endif /* Constants */ #define PPPD_EFN 128 /* Macros */ #define CHECK_STATUS(status) \ if (FAILURE(status)) \ { \ signal_error(status,0); \ return FALSE; \ } #define DIALOUT_CHECK_STATUS(status) \ if (FAILURE(status)) \ { \ signal_error(status,0); \ return DIALOUT_ERROR_ABORT; \ } #define INIT_DYNAMIC_DESCRIPTOR(desc,size) \ desc.dsc$w_length = 0; \ desc.dsc$b_dtype = DSC$K_DTYPE_T; \ desc.dsc$b_class = DSC$K_CLASS_D; \ desc.dsc$a_pointer = 0; \ if (size) \ { \ status = str$get1_dx(&size,&desc); \ CHECK_STATUS(status); \ } #define SET_DYNAMIC_DESCRIPTOR(desc,string) \ desc.dsc$w_length = strlen(string); \ strncpy (desc.dsc$a_pointer, \ string, \ strlen(string)); #define RESET_DYNAMIC_DESCRIPTOR(desc,size) \ desc.dsc$w_length = size; #define FREE_DYNAMIC_DESCRIPTOR(desc) \ str$free1_dx(desc); /* Typedefs */ typedef unsigned short CHAN; typedef unsigned long int EFN; typedef unsigned long int VMS_STATUS; typedef long int VMS_TIME[2]; typedef struct dsc$descriptor_s DESCRIPTOR; typedef struct dsc$descriptor D_DESCRIPTOR; typedef struct { unsigned int status; unsigned int info; } IOSB; typedef struct { unsigned short status; unsigned short count; unsigned short term_char; unsigned short term_size; } RW_IOSB; typedef struct sense_iosb /* IOSB for set and sense requests */ { unsigned short status; unsigned char xmit_speed; unsigned char rcv_speed; unsigned char cr_fill; unsigned char lf_fill; unsigned char parity_flags; unsigned char unused; } SENSE_IOSB; typedef struct vms_itemlist { unsigned short itm$w_bufsiz; /* Target buffer size */ unsigned short itm$w_itmcod; /* Item code */ void *itm$l_bufadr; /* Target buffer address */ unsigned short *itm$l_retlen; /* Address of word to receive length */ } VMS_ITEMLIST; typedef struct dev_char /* Device characteristics block */ { unsigned char class; unsigned char type; unsigned short buffer_size; unsigned int basic_chars; unsigned int tt2_chars; unsigned int tt3_chars; } DEV_CHAR; /* Functions */ int get_str_qualifier(DESCRIPTOR *qualifier, D_DESCRIPTOR *str); int lookup_asn_item(VMS_ITEMLIST *items, unsigned int item_code, unsigned int *index); void signal_error(VMS_STATUS status, int argcount, ...); int util$convert_log_file(void);