/* ***************************************************************************** * * 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 is the common header file for both the PPPDUTIL.C and PPPDUTIL_KERNEL.C files, and is part of the user interface to the Point to Point (PPPD) Utility. AUTHOR: Iris Langstein Realmuto 21-December-1995 REVISION HISTORY: X-10 BWK010 Barry W. Kierstein 17-DEC-1996 Replaced the standard Digital copyright with one compatible with the CMU copyright. X-9 BWK009 Barry W. Kierstein 24-SEP-1996 QAR EVMS-GRYPHON #2474: Added field user_device_is_physical_device for the permanent connection check. X-8 BWK008 Barry W. Kierstein 21-AUG-1996 QAR EVMS-GRYPHON-FT #131: SHOW would show the internal coded port speed rates, not the human-understandable ones. X-7 BWK007 Barry W. Kierstein 13-AUG-1996 QAR EVMS-GRYPHON-FT #107: Added ppp_callback_registered to DEVICE_REC to flag whether a PPP callback routine was registered in a $ SET NETWORK. X-6 BWK006 Barry W. Kierstein 9-AUG-1996 Added fields for virtual terminals. See PPPDUTIL.C edit X-8 for details. X-5 BWK005 Barry W. Kierstein 16-JUL-1996 Added trace_mbx field for the shutdown_logger routine. 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. */ /* Constants */ #define ASN_SENSE_ITEMS 2 #define ASN_SET_ITEMS 5 #define TRANSMIT_ACCM_SIZE 8 #define PPP_STRING_ITEMS 2 /* DEBUG_MAILBOX, COM_PORT */ #define PPP_INT_ITEMS (18 + TRANSMIT_ACCM_SIZE) /* 18 = DEBUG, RX_ACCM, TX_ACCM, MRU, MTU, MODE, LINE_TYPE, */ /* MAX_CONFIGURE, MAX_FAILURE, MAX_TERMINATE, AC_COMPRESS, */ /* PROTO_COMPRESS, FCS_RX, FCS_TX, MAGIC_NUM_RETRIES, */ /* RESTART_TIMER, ECHO_INTERVALS, ECHO_FAILURE */ #define PPP_ITEMS (PPP_STRING_ITEMS + PPP_INT_ITEMS + 1) /* PPP_INT_ITEMS with TRANSMIT_ACCM_SIZE counting as 1 */ #define NULL_CHAR '\0' /* Priviledge fields */ #define ENABLE_PRIVS 1 #define DISABLE_PRIVS 0 #define PRIV_PRMPRV 1 /* permanent (process) privileges */ #define PRIV_TMPPRV 0 /* temporary (image) privileges */ #define ALL_PRIV 0x0FF /* Macros */ #define REMOVE_PRIV(priv_bit,mask,prev_priv,status) \ if (!priv_bit) \ { \ status = sys$setprv(DISABLE_PRIVS, /* enbflg */ \ &mask, /* prvaddr */ \ PRIV_TMPPRV, /* prmflg */ \ &prev_priv); /* prvprv */ \ } \ else \ status = SS$_NORMAL; #define SET_PRIV(priv_bit,mask,prev_priv,status) \ memset(&prev_priv,NULL_CHAR,sizeof(prev_priv)); \ memset(&mask,NULL_CHAR,sizeof(mask)); \ priv_bit = TRUE; \ \ status = sys$setprv(ENABLE_PRIVS, /* enbflg */ \ &mask, /* prvaddr */ \ PRIV_TMPPRV, /* prmflg */ \ &prev_priv); /* prvprv */ /* Typedefs */ typedef long int UIC_VALUE; typedef union prvdef PRIV; typedef struct { u_short item_length; u_short item_tag; long item_data; } NETWORK_ITEM_INT_ENTRY; typedef struct { u_short item_length; u_short item_tag; char item_data[PPPD$K_MAX_NAME]; } NETWORK_ITEM_STR_ENTRY; #define NETWORK_ITEM_HDR_SIZE 4 /* Header size for each item */ typedef struct { int item_length; NETWORK_ITEM_INT_ENTRY *item_address; u_short item_size; unsigned char item_type; unsigned char item_subtype; NETWORK_ITEM_INT_ENTRY item_entries[PPP_INT_ITEMS]; NETWORK_ITEM_STR_ENTRY item_str_entries[PPP_STRING_ITEMS]; } NETWORK_ITEMLIST; #define NETWORK_ITEMLIST_HDR_SIZE 12 /* Header size for list header */ typedef struct device_rec { /* Physical device fields */ D_DESCRIPTOR device_name; /* Name of the physical device */ D_DESCRIPTOR edited_device_name; /* Orig. name w/o '_' and ':' */ CHAN device_channel; /* Physical device channel number */ int user_device_is_physical_device; /* Are the device names the same? */ /* Virtual device fields */ int virtual_terminal; /* Are we logged on via a VT device? */ D_DESCRIPTOR virtual_device_name; /* Name of the virtual device */ D_DESCRIPTOR edited_virtual_device_name; /* Orig. name w/o '_' and ':' */ /* PPP fields */ int trace; /* should tracing be done */ D_DESCRIPTOR trace_file; /* Trace file name */ D_DESCRIPTOR trace_mbx; /* Trace mailbox name */ NETWORK_ITEMLIST *ppp_items; /* PPP attributes */ /* ASN fields */ D_DESCRIPTOR asn_name; /* Name of the Asynch device */ D_DESCRIPTOR edited_asn_name; /* Orig. name w/o '_' and ':' */ CHAN asn_channel; /* Asynch device channel number */ VMS_ITEMLIST asn_items[ASN_SET_ITEMS+1]; /* Asynch attributes */ /* network callout fields */ int ppp_callback_registered; /* Is a callback registered for this protocol? */ D_DESCRIPTOR network_protocol; /* Network protocol to be used */ int (*network_callback)(); /* Callback routine for network protocol */ /* device attributes */ u_int restore_device; /* Does the device need to be restored? */ DEV_CHAR old_device_chars; /* Original device characteristics */ u_char old_input_speed; /* Original input speed */ u_char old_output_speed; /* Original output speed */ u_int hangup; /* Hangup setting */ u_char input_speed; /* Coded input speed setting */ u_int input_show_speed; /* External input speed setting */ u_char output_speed; /* Coded output speed setting */ u_int output_show_speed; /* External output speed setting */ /* terminal attributes */ CHAN terminal_channel; /* Terminal channel number */ u_int restore_terminal; /* Does the terminal need to be restored? */ DEV_CHAR old_terminal_chars; /* Original terminal characteristics */ struct device_rec *next; } DEVICE_REC; /* More Macros */ static VMS_ITEMLIST *vms_macro_items; #define VMS_ITEMLIST_INIT(items) vms_macro_items = (VMS_ITEMLIST *) &items; #define VMS_ITEMLIST_ADDR(code, buflen, buffer, retlen) \ vms_macro_items->itm$w_bufsiz = buflen; \ vms_macro_items->itm$w_itmcod = code; \ vms_macro_items->itm$l_bufadr = (void *) buffer; \ vms_macro_items->itm$l_retlen = (u_short *) retlen; \ ++vms_macro_items; #define VMS_ITEMLIST_ADDR2(code, buflen, data, retbuf) \ vms_macro_items->itm$w_bufsiz = buflen; \ vms_macro_items->itm$w_itmcod = code; \ vms_macro_items->itm$l_bufadr = (void *) data; \ vms_macro_items->itm$l_retlen = (void *) retbuf; \ ++vms_macro_items; #define VMS_ITEMLIST_VALUE(code,value) \ vms_macro_items->itm$w_bufsiz = sizeof(value); \ vms_macro_items->itm$w_itmcod = code; \ vms_macro_items->itm$l_bufadr = (void *) value; \ vms_macro_items->itm$l_retlen = 0; \ ++vms_macro_items; #define VMS_ITEMLIST_TERM \ vms_macro_items->itm$w_bufsiz = 0; \ vms_macro_items->itm$w_itmcod = 0; \ vms_macro_items->itm$l_bufadr = (void *) 0; \ vms_macro_items->itm$l_retlen = (u_short *) 0; #define PPPD$K_ITEMLIST_SIZE (NETWORK_ITEMLIST_HDR_SIZE + \ (PPP_ITEMS * NETWORK_ITEM_HDR_SIZE) + \ (PPP_STRING_ITEMS * PPPD$K_MAX_NAME) + \ (PPP_INT_ITEMS * sizeof(u_int))) static u_short ppp_str_len = PPPD$K_MAX_NAME;