sscanf functions has been changed here-------

get_option_value  change %d to %hu
static ULONG get_ip_address_string (char *cptr_ip_address_string) is changed
cptr_hex_values is changed to %jx
changed max no. of ports to 3 in kppp.h
for this lcp_mibs.pppLinkStatusLocalMRU) set_variable_port_and_ulong_decimal_value is called rather than set_variable_port_and_ushort_decimal_value.
same as above for this	port[0].lcp_mibs.pppLinkStatusRemoteMRU

//changed fn called to port_and_ushort in port[0].configuration.enabled.send_id,
//configuration.enabled.time_remaining),ncp[PPP_IP_NCP_STACK_INDEX].enabled ,
//ncp[PPP_IPX_NCP_STACK_INDEX].enabled,cp[PPP_APPLETALK_NCP_STACK_INDEX].enabled &
//port[0].ncp[PPP_NETBIOS_NCP_STACK_INDEX].enabled).

changed fn called for number_of_ppp_ports
printing vars changed to BYTE_ENUM  from enum in vpppstr.h

in ppptx.c for ppp_packet_transmitted a check is made to find whether it is 
NULL OR NOT.
ppp_receive & ppp_send_transmitted() has been changed to look for null function
pointer before calling the wan driver entry points.

static void copy_negotiated_lcp_options_to_mib_variables (USHORT real_port_numb
er) in this routine for LocalMRU copy_option the fix is dirty. check. in pppstate.c


The following changes were made to accomodate PAP
in pppupcal.c ppp_event_authenticate_verify is changed.
in ppplcprx.c ppp_termination_ack_received is been modified

added below function in pppoptn.c
enum OPTION_PARSE_RESULT parse_ppp_lcp_options_from_reject_configure (OPTION_LISTS *sptr_option_lists,
	PPP_OPTION *sptr_received_option,USHORT length_of_options);


OPTION_PARSING_FATAL added to OPTION_PARSE_RESULT in kppp.h

in pppauth.c 
in void ppp_upper_layer_authentication_verification (USHORT real_port_number,ULONG vptr_chap_password_or_pap_pass_or_fail)
if authentication ack is being sent for PAP bring_ncps_up() has been masked.
So also with bring_ccp_up()

Before a call is made to bring_ccp_up, add a call to execute ccp state 
machine with an PPP_OPEN_EVENT. In case of ncp's it is done by lsl. In case
of CCP we need to do it, otherwise, the state machine gets stuck at state 2.

ppplcprx.c: lcp_configure_reject_received - call parse_ppp_lcp_options_from_reject_configure
rather than parse_ppp_options_from_reject_configure



in lcp_configure_reject_received in ppplcprx.c if the other side rejects the
PAP authen & if we have authen enabled we will have to send termination_req
for this iam forcing the state of the connection to PPP_OPENED_STATE before
calling the close event. this was done because of problems faced because it is
in some state and it moves to state 2. try to rectify if possible.

changed number_of_ppp_ports to ULONG in vpppstr.h for snmp.

made the pppLinkStatusatPhysicalIndex initialized to real_port_number+1
also changed in vpppsnmp.h for this not to increment for  get.


/* 19/12/95 Sowmya */
Changes made for Dial-On-Demand

1. defs.h 	: __DOD__
2. vnvppp.h	: string to get the connection-type on the port
		"PPP Port Connection Dial On Demand =",
		"PPP Port Connection Idle Timer =",
   kppp.h 	: dial_on_demand enabled and connect states
enum PPP_CONNECT_STATE
{
	LINK_DOWN = 0x00,
	LINK_UP = 0x01,
	LINK_GOING_DOWN = 0x02,
	LINK_DOWN_BY_DEMAND = 0x03,
	LINK_GOING_UP = 0x04
};
   vpppstr.h	: connect_type and connect_state. 2 fields added to indicate
		  whether dial_on_demand is supported on a port and the current
		  state of the port ie if the port is down because of no traffic
		  or because of link failure.
	ULONG													idle_timer;

	ULONG													idle_timeout;

	BYTE_ENUM (BOOLEAN)						dial_on_demand;
	
	BYTE_ENUM (PPP_CONNECT_STATE)					connect_state;

3. pppinit.c	: a) Port connect_state initialized to LINK_DOWN in initialize_ppp.
		  b) In case PPP decides to bring down a link because of no traffic,
		  the connect_state is set to LINK_GOING_DOWN. When the link actually
		  goes down the connect_state is made LINK_DOWN_ON_DEMAND.
		  If the link goes down because of line failure, the state is
		  LINK_DOWN.
		  c) As soon as the LLDD is up, connect_state is LINK_UP and
		  the idle timer is reset.
4. ppptimer.c	: a) Every second a check is made on the connection_type and
		  connect_state and the idle timer count decremented. When the
		  count reaches 0, the link is brought down.
		  b) The wan port's timer function is called only if the connect_state
		  is not LINK_DOWN_BY_DEMAND.
		  c) Since PPP must initiate initialization/opening of the wan ports,
		  the place to do it is after everything is initialized.
		  So it is done in the timer. This has to be done only once and
		  so the first_time variable.
5. ppptx.c	: a) In send_ppp_packet, if PPP is not in opened state and
		  connect_state is LINK_DOWN_BY_DEMAND then link is brought up.
		  After the packet is sent, idle timer is reset.
		  b) In send_native_ppp_packet, if PPP is not in the opened state
		  or if NCP packets are being sent, the idle timer is reset.
		  For periodic Echo, Authentication and LQR packets, it is not
		  reset. We must not count these as traffic on the link.
6. pppdod.c	: Contains all routines for dial_on_demand support.
7. pppncpst.c	: When the link goes down because of no traffic, do not 
		  inform the higher layers about this. -  signal_down_event_to_ncp


vpppstr.h 
PPP_PORT_AUTHENTICATION_CLASS
char		remote_user_name[NAME_SIZE];
char		remote_password[NAME_SIZE];
vnvppp.h
PPP Port Remote User Name 
PPP Port Remote User Password 
pppupcal.c
pppoptn.c

pppoptna.c : free_ppp_option_lists
masked freeing of configured and remote_configured lists.
pppinit.c  : after free_lcp_and_ncp_option_lists is called, the LCP and NCP 
tx_accepted list is reinitialised and ppp LCP and NCP states reset.
Do it for CCP options list also .
Add a function initialize_ccp_tx_accepted_option_list.
Call function reset_ccp_state_machine

pppconfg.c: get_ip_address_string - ip_address must be changed from ULONG to USHORT

pppauth.c : authentication_request_received - the 'name' and 'password' that
are passed to the upcall function should be the values that were received
in the pap request and not the local configured values. 

pppinit.c : initialize_ppp_ports : all ports are forced to being SYNC to 
take care of UI.
in pppstprx.c in  in ppp_free_a_bridge_send_packet in checking for is_option_
present the real_port_number is to be real_port_number-1.

pppinit.c : ppp_close_device_driver_port : send the port number as the 
second argument cause there is only 1 wan control routine for all the ports.

ppptx.c, vpppstr.h
Address of 'device_driver_buffer' is passed as a parameter to ccp_compress_ppp
Same in the compression routine called using fptr_get_sender_compression_function_function.
Corresponding changes made in CCP. See its readme.

vpppstr.h
added MY_GLOBAL in the checksum_table declaration portion so that it gets 
defined as extern.
#ifdef MY_GLOBAL
	extern USHORT checksum_table[DEFAULT_FCS_TABLE_SIZE];
#else
	GLOBAL USHORT checksum_table[DEFAULT_FCS_TABLE_SIZE];
#endif


pppstate.c :this_layer_up - bring_ncps_up is called only if authentication
is disabled both ways

pppauth.c :ppp_upper_layer_authentication_verification - bring_ncps_up is called
only if remote_authentication is disabled else if enabled then an ack has been received.

authentication_ack_received - bring_ncps_up is called only if local authentication is 
disabled else if enabled then an ack has been sent.
the authentication.status flag is made TRUE only when we bring_ncps_up, ie
after authentication is complete both ways.

vpppastr.h : We have 2 flags to take care of this in PPP_PORT_AUTHENTICATION_CLASS

ppputil.c, pppinit.c, ppplcprx.c - reset the 2 flags rxed/txed_authentication_ack.

pppauth.c - rxed_au.._ack is reset when we send a authentication request and
txed_au.._ack is reset when we receive an authentication request.
----------------------------------------------------------------------------
Sanjay,18,Jan,96 - changes for SNMP support
-------------------------------------------
1. pppinit.c,initialize_ppp_ports() - some change had been to make
   pppLinkStatusPhysicalIndex 1-based. Removed the change and reverted to
   old method of letting SNMP code do the job using a field in the
   SNMP_TABLE_ENTRY structure set to TRUE.
2. pppstate.c,copy_negotiated_lcp_options_to_mib_variables() - the following
   ppp snmp params were being set to TRUE or FALSE. What was actually needed
   was to set to 1 (enabled) or 2 (disabled) for SNMP purposes. Made the
   change.
   	pppLinkStatusLocalToRemoteProtocolCompression
	pppLinkStatusRemoteToLocalProtocolCompression
	pppLinkStatusLocalToRemoteACCompression
	pppLinkStatusRemoteToLocalACCompression
   These parameters should not be (and currently are not) used for boolean
   comparisons.
3. pppstate.c,copy_negotiated_lcp_options_to_mib_variables() - Put in code
   to set two snmp variables related to size of FCS bits. We don't 
   negotiate this and so this is always 16.
   	pppLinkStatusTransmitFcsSize
	pppLinkStatusReceiveFcsSize 
4. pppinit.c,initialize_ppp_ports() - removed code relating to initialization
   of some ppp-snmp parameters. Moved them to a newly introduced function
   initialize_ppp_snmp_static_information(). Also added addition init-s of
   snmp variables to this function. Introduced prototype for this function.
5. kppp.h - introduced the following enum
	enum PPP_LQR_QUALITY {
		LQR_GOOD = 1,
		LQR_BAD = 2,
		LQD_NOT_DETERMINED = 3
	};
6. The routerware code does not really do anything on Link Quality Reports.
   So decided not to support LQR in the SNMP manager. #ifdef-ed out the
   table support in VSNMPMIB.H for this. SNMP support for these variables are
   not complete in the code.
7. pppstate.c,this_layer_up() - removed code setting the mib variable
   pppLqrQuality.
8. #ifdef-ed out strings in VSNMPMIB.H relating to LQR Config information as
   we do not support LQR.
9. We do not support the link quality extensions.
10. For pppLinkConfigMagicNumber, in vpppsnmp.h, set need_to_increment field
    to TRUE.
----------------------------------------------------------------------------
in pppstate.c two new wan control calls SET_RX_ACCM_SERIAL_PORT & SET_TX_ACCM_SERIAL_PORT has been added.

7/3/96
------
1. ppptx.c : send_cipx_packet ( called when CONFIRM/REJECT packets are to be
sent) was not doing CCP compression resulting in CCP going out of sync.
Added code for CCP compression similar to that in send_ppp_packet.

2. ppptimer.c : Checks every second if it is safe to bring up CCP ie after
all NCPs have gone to some stable state. check_to_bring_ccp_up does this.
A flag 'ccp_state_machine_inited', for each port ensures that bring_ccp_up is 
not called repeatedly.

3. pppstate.c, pppauth.c : WE no longer call bring_ccp_up with bring_ncps_up.
CCP is inited from the timer. All calls to bring_ccp_up are commented.

19/3/96 Sowmya
--------------
Changes made for CHAP

1.pppauth.c
- ppp_upper_layer_auth... : authentication_protocol changed from enum to USHORT_ENUM
  in declaration and assignment.
- chap_packet_received : AUTHENTICATE_LOOKUP upcall function, send the remote_user_name
- send_lcp_chap_server : comment out moving 0x00 into last byte of challenge.
- all changes made for PAP to bring up ncps only after authentication, are 
  made for CHAP also.

2. ppprx.c
- verify_packet : The identifier must be checked against different values based
  on whether it is a CHAP_RESPONSE or CHAP_ACK/NACK. We need to save another
  identifier value for CHAP - last_id_of_chap_response_packet apart from
  last_id_of_chap_challenge_packet.

3. vpppstr.h
- added last_id_of_chap_response_packet variable in PPP_PORT_CLASS and renamed
  last_id_of_chap_packet as last_id_of_chap_challenge_packet

in  initialize_ppp_snmp_static_information(USHORT real_port_number) for
		pppLinkConfigReceiveACCMap & pppLinkConfigTransmitACCMap ACCMap is made to
		be 0 as we are right now not using them.

3/4/96 Sowmya
-------------
pppinit.c : Initialise the tx_identification_string to 'Multi-Tech Systems"
ppplcptx.c : send_lcp_id :Need to check if Magic number has been negotiated
before sending it in the identification packet.
ppplcprx.c : Send the identification string if you receive one

26/4/96 Sowmya
--------------
ppplcprx.c, pppstate.c : calls to send_lcp_id_packet are removed. The only 
place it is called from is when and id packet is received. No check for
enabled/disabled is made.
ppptx.c : send_ppp_packet : After the check is made that PPP is NOT in state
9 and if connect state is NOT LINK_DOWN_BY_DEMAND, we need to return buffer
and not continue.

in ppptimer.c in periodic_lcp_echo_request if the 
ppp.maximum_echo_request_send_interval is zero we just return.
WLINK doesn't reply for echo requests.

Vidy modifications - 31/5/96

PPP directory - ppptx.c
---------------------------
enum TEST send_cipx_packet (USHORT real_port_number,
PPP_PACKET_WITH_MAC_HEADER *sptr_tx_packet,USHORT number_of_bytes,

This routine used to call the 
		reset_ppp_idle_timer (real_port_number);
This is not correct as CIPX packets are not user data.


Sachin (10th May onwards)
-------------------------
. Included 2 new files
	(a). PPPCOMP.C which has the code for LZW-expansion
	(b). PPPUDB.C which has all the code related to user database handling

. Made small changes in ppp_event_authenticate_verify () in PPPUPCAL.C
	(a). To compare passwords (PAP).
	(b). To get the line permissions.
	(c). To get the protocol permissions.

. Made small changes in ppp_event_authenticate_lookup () in PPPUPCAL.C
	(a). To get the line permissions.
	(b). To get the protocol permissions.

. Made changes for callback, cbcp

. Made changes to echo-request, response handling (magic number handling)

. Made changes to handle the changed memory map

Sachin 05/10/1996
-----------------
	Changes for CBCP handling in WIN 95. There is a proposal to make a policy
	change in CBCP if callback is asked and the administrator has not given permissions
	for callback to the user.

Chidanand 20 Nov 1996
---------------------
File : pppinit.c 
	Function : initialize_ppp_ports()

	A boolean parmeter was passed instead of a string parameter to routine
process_back_slash(). This pbm was corrected by using 
configuration.tx_identification_messsage string.

Kmalnath 07 Dec 1996
--------------------
pppinit.c : 

1. After LOWER_DEVICE_DRIVER_UP call to PPP, PPP calls dhcp_control() 
   thru lsl_control for sending dhcp discover packet for that port (client).

2. After LOWER_DEVICE_DRIVER_DOWN call to PPP, PPP calls dhcp_control()
   thru lsl_control for relesing the assigned dynamic IP address for that
   perticular port (client).

3. In initialize_ppp_ports(), ppp.port[real_port_number].dhcp_status = DHCP_STATUS_NO_OPERATION
   is added.

pppconfg.c:

1. ppp_dhcp_control_function : This function is added for getting dhcp information 
   i.e. IP_ADDRESS_OBTAINED, DHCP_SERVER_NOT_FOUND and LEASE_TIME_EXPIRED etc.

2. ip_bring_down_ncp : This function is added to disable IP for the perticular 
   port (client), immidiatly after the LEASE_TIME expires .

ppprx.c	  :

1. Drops the IPCP PROTOCOL (NCP) packet till the dhcp_status set to IP_
   ADRESS_OBTAINED by dhcp protocol and also after LEASE TIME expires.

vpppstr.h :

1. dhcp_status member is added to PPP_PORT_CLASS with which PPP keep tracks 
   the dhcp processing.




Sachin, 03rd October, 1997
--------------------------
        Changes to be made for the DOD problem ----
        What happens is, when a port goes down because of no demand, the
stacks are NOT communicated about the port having gone down. When all the ports
have gone down by demand, if a client on the PROXY server's LAN comes up,
the proxy server tries to put the first packet on Port 0 (the IP stack
thinks this port is UP). This triggers a dialing of the port and the port comes
up. The second packet that comes from the client, the proxy server tries to
put it on port 1 because the IP stack thinks, this port is UP. This again has
to do the dialing, connecting, etc. part. The idea is to use the port 0 and
trigger the dialing of port 1 transparently so that time is not lost.
        Right now, it is being done thru' function calls across modules.
We need to change it to make calls by sending commands.
Files changed :
        PPPDOD.C (Calling ppp_port_down_by_no_demand ()) in ppp_link_idle().


Sachin 06/10/1997
----------------
Ported the following changes from the MTR2.20 sources. This problem was fixed
towards the end of MTR2.20 Beta. But the integration problems continue to
haunt us. In between, this thing has got missed out !
Sachin 13/07/1997
----------------
        CHAP was not functioning. The basic problem was that a comparison was
wrong in the timer were auth packets are sent. The enum in this case being
a 4 byte quantity (because some of the values exceed 0x7FFF), the comparison
was failing. And it was coded as if (CHAP)....else (PAP). So, we had the
catostrophic effect of switching over to PAP. There used to be times when
CHAP would come up because a CHAP challenge was being sent in this_layer_up().
It looks like a quick fix. It has been taken off now. All authentication packets
are sent from the timer now.
        Further, in the timer, if authentication is not successful and we need to
make retransmissions, there is a small catch. We need to do retransmissions
of PAP auth req if PAP authentication is TX accepted and retransmissions of CHAP
challenges if CHAP authentication is RX accepted. The difference lies in who
starts authentication in the two cases. In case of PAP, the client (the
'authenticatee' if you like to call it) has to initiate the 2-way handshake.
In case of CHAP the server starts the 3-way handshake.

        The other issue was regarding when to apply ACCM. In case we use
AHDLC microcode, the application of ACCM is 'on the fly'. In fact, if it is applied
in the middle of a packet transmission, the rest of the packet goes quoted
with the new ACCM. Now what we do is, apply RX accm immediately after LCPs
are up. But TX ACCM is applied in the transmit complete routine of the first
NCP. The only overhead is that the first NCP goes with all bytes quoted. But that's
ok. Functionally, it is correct though it is sub-optimal.

The modified files are :
        PPPSTATE.C : this_layer_up()
        PPPTIMER.C : send_periodic_authentication_packets()
        PPPUTIL.C  : apply_tx_accm ()
        VPPPSTR.H  : added a new field in station class to keep track
                     of whether ACCM has been applied or not
        PPPNCPTX.C : ppp_ncp_send_completion (), changed the send completion being passed
                     to ppp_send_native_packet()
        PPPDBSWI.C : Added a new function to check if a port has a backup

Sachin 06/10/1997
----------------
        Changed the CHAP challenge size to a max of 64 and handle it
accordingly. Files changed :
        KPPP.H (the #define value)
        VPPPASTR.H (The structure defn.)
        PPPAUTH.C (We do not drop the packet if the challenge size is not 8).

Naveen 15/10/1997
-----------------
1. pppdod.c : In ppp_link_idle() initing link_port_number was changed.

2. mpppinit.c : In map_physical_port_to_virtual_port() extra code was added
                to allot the same bundle number for any of the links
                when it comes up by demand.
3. pppinit.c : In initialize_ppp() called register_debugger.

4. mpppinit.c : changed printf's to ppp_printf

5. pppdod.c : changed printf's to ppp_printf

6. kppp.h : added PPP_MLPPP_PRINTF to enum PPP_PRINTF_GROUP

7. vnvppp.h : added one group for mlppp printf.

8. vpppstr.h : added one byte enum mlppp_printing_enabled to PPP_CLASS.

9. ppputil.c : in ppp_printf() added support for mlppp printf.


Naveen 29/10/1997
-----------------
1. mppptx.c : Before we were checking bundle's LCP state to bring
              up bundle on demand. Now it is changed.
              Now we are refering 
              "mlppp.dod_enabled_bundle[real_port_number].link_down_by_demand".


Sachin, 5th November 1997
------------------------
. PPPINIT.C :
        Till such time when we support Link CCP and test out CCP with MLPPP,
  we disable ccp in case mlppp is enabled (even if MLPPP is finally not even
  going to be used). We were thinking of doing this in roucon itself, but
  that will require extensions to cfgmgr, telnet, web, etc. So, it is done
  during run time.

Sachin, 07th November 1997 (For SLIP support)
------------------------
MPPPTX.C : 
        send_mlppp_packet() :
            If slip is up, a block of code is executed to encode the packet
                and transmit it.
        mlppp_packet_transmitted() :
            If slip is up, a block of code is executed to free up the transmitted
                packets.

MPPPRX.C : 
        mlppp_receive :
            If slip is up, a block of code is executed.
            
PPPINIT.C :
        ppp_device_driver_control() :
            In slip, there was a bug fixed (getting the IP stack id).
            See the routerware source fixes folder for more details.

sudhir 12/2/98 
--------------
	kppp.h and pppiprx.c are modified to support dns options.

sudhir 3/3/98
-------------
	mofified ppptx.c and mppptx.c.
	added check for callback before bringing up link which is 
	down by no demand.
Vidy - cutting data for LCPR
1. all comments VIDY_CUT

Jo 24/07/98 : reads the PPP configuration from flash into PPP_CLASS 
	      starting from the location specified by cptr_config
	      Changed files pppconfg.c	

Jo 12/09/98 : Made modifications to access PPP options as bits instead of Strings 
	      Changed files pppconfg.c	

Jo 17/05/99 : Removed Slip code. Not supported in Serial Proxy.
	      Changed files mppprx.c, mppptx.c, pppinit.c, ppprx.c, ppptimer.c, 
	      ppptx.c, ppputil.c, slip.c, sliputil.c	

Jo 04/06/99 : Added RAS feature
	      Changed files pppdod.c, pppudb.c, pppinit.c, ppputil.c, pppupcal.c
	      pppauth.c, pppcbcp.c, pppoptna.c, vpppstr.h	

Jo 04/06/99 : Added for DHCP Client feature.
	      Changed files mppprx.c, pppinit.c	

Jo 23/09/99 : If No RAS Users, callback should not be negotiated 
	      Changed files pppupcal.c

Jo 23/09/99 : Added to fix trigerring problem which occurs if a WAN port is RAS
	      Changed files pppdod.c, pppinit.c	

Jo 23/09/99 : Added from Big Proxy. This is required because, what was happening was, if any
	      NT client is acting as a RAS client to our ProxyServer, NT client requests DNS 
	      primary as well as secondary (option number 129, 131 ) address from RASServer 
	      (i.e.,) our ProxyServer during NCP IPCP negotiations.But Proxy sends configure 
	      nak to those DNS primary as well as secondary, only if some ip address has been 
	      configured.Otherwise, if not configured, Proxy sends ack for those options of 
	      NT client with 0.0.0.0 as their address itself instead of rejecting those 
	      options.Due to this, NT client, is not willing to accept 0.0.0.0 as the DNS 
	      primary & secondary address & keeps on sending configure request to Proxy 
	      thinking that, if Proxy has some DNS options address configured, it should 
	      nak or if not configured, it should reject.Due to this problem, NT client 
	      never comes up, even after getting IP address from Proxy.After some time, it 
	      times out & the connection is down.Now, we are checking whether the received 
	      options from ras client contain dns primary or secondary or both.If it has & 
	      if we don't have a proper address to nak them other than 0.0.0.0, then we 
	      are rejecting those options.
	      Changed files pppoptn.c
