⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ppp_fsm.h

📁 最新MTK手机软件源码
💻 H
字号:
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 * PPP_FSM.H
 *
 * Project:
 * --------
 *   MAUI
 *
 * Description:
 * ------------
 *   This file describes the general procedures of PPP finite state machine.
 *
 * Author:
 * -------
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/

#ifndef _PPP_FSM_H
#define _PPP_FSM_H

#define FSM_TIMEOUT_VALUE     3     /* 3 sec for retransmition */
#define FSM_MAX_CONF_CNT      30    
#define FSM_MAX_TERM_CNT      3
#define FSM_MAX_NAK_CNT        10


/*
 * PPP type
 */
typedef enum {
    PPP_CSD_TYPE,
    PPP_GPRS_TYPE
} ppp_type_enum;

typedef enum {
    PPP_DOWN_LOCAL,
    PPP_DOWN_REMOTE
} ppp_down_cause_enum;

typedef enum {
    PPP_DEACT_UNDEF,
    PPP_DEACT_L4C,
    PPP_DEACT_TCM,
    PPP_DEACT_PPP,
    PPP_FAIL_TCM,
    PPP_RETRY_FAIL
} ppp_deactivate_cause_enum;

typedef enum
{
    PPP_NO_TIMER_STATUS=0,
    PPP_TIMER_RUNNING,
    PPP_TIMER_NOT_RUNNING,
    PPP_TIMER_STOPPED,
    PPP_TIMER_TIMED_OUT
} ppp_timer_status_enum;

/* 
 * Parameters of the timer callback function
 */
typedef struct
{
   eventid   event_id;
   ppp_timer_status_enum status; 
} ppp_timer_info_struct;

#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* Removed to ppp_l4_enums.h*/

typedef struct {
    kal_uint8 code;
    kal_uint8 id;
    kal_uint16 length;
} ppp_fsm_code_struct;

typedef struct {
    kal_uint8 type;
    kal_uint8 len;
} ppp_fsm_opt_struct;

typedef struct {
   kal_uint32 nego_allow_flag;
   kal_uint32 nego_work_flag;
   void * nego_allow_value;
   void * nego_work_value;
} ppp_fsm_negotiation_struct;

typedef struct {   
   ppp_type_enum    type;                 /* PPP Type */
   ppp_fsm_idx_enum idx;          /* LCP or IPCP */
   ppp_fsm_state_enum state;           	/* FSM State */
   kal_uint16 protocol;                	/* Protocol code */
   kal_uint8 rcv_id;                        	/* Id used to response the peer */
   kal_uint8 req_id;                         	/* Id used to request the peer */
   kal_bool  is_ack_rcvd;               	/* Ack Reveived */
   kal_uint8 restart_timer_value;    	/* Timeout Configure value in sec */
   kal_uint8 max_term_cnt;	    	/* Max terminate request limit */
   kal_uint8 sterm_cnt;               	/* Terminate request count */ 
   kal_uint8 max_conf_cnt;          	/* Max configure request limit */
   kal_uint8 sconf_cnt;                     	/* Configure request count */
   kal_uint8 max_nak_cnt;                /* Max configuer nak limit */
   kal_uint8 snak_cnt;                     	/* Send configure nak count */
   kal_uint8 rnak_cnt;                      	/* Recv configure nak count */
   ppp_timer_info_struct timer_info;   /* This is the timer of fsm */
   struct ppp_fsm_func_struct * call;
   ppp_fsm_negotiation_struct * rx_opt_ptr;
   ppp_fsm_negotiation_struct * tx_opt_ptr; 
} ppp_fsm_struct;

typedef struct ppp_fsm_func_struct {
   /* Protocol name string */
   kal_char * protocol_name;          
   /* Initial reset cont */
   void (* irc)(ppp_fsm_struct *);
   /* This-Layer-Up while fsm enters FSM_OPENED state */
   void (* tlu)(ppp_fsm_struct *);  
   /* This-Layer-Down while fsm leaves FSM_OPENED state */
   void (* tld)(ppp_fsm_struct *); 
   /* This-Layer-Start while the lower layer is needed for the link */
   void (* tls)(ppp_fsm_struct *);
   /* This-Layer-Finished while the is no longer needed for the link */
   void (* tlf)(ppp_fsm_struct *);
   /* Process Configure-Req message */
   ppp_fsm_code_enum (* rconfreq)(ppp_fsm_struct *, ppp_buff_head_struct *);
   /* Process Configure-Ack message */
   kal_bool (* rconfack)(ppp_fsm_struct *, ppp_buff_head_struct *);
   /* Process Configure-Nak message */
   kal_bool (* rconfnak)(ppp_fsm_struct *, ppp_buff_head_struct *);
   /* Process Configure-Rej message */
   kal_bool (* rconfrej)(ppp_fsm_struct *, ppp_buff_head_struct * );
   /* Process Other message */
   kal_bool (* rothers)(ppp_fsm_struct *,kal_uint8,kal_uint8,ppp_buff_head_struct *);
   /* Make Configure-Req message */
   void (* sconfreq)(ppp_fsm_struct *,ppp_buff_head_struct *);
   /* Make Terminal-Req message */
   void (* stermreq)(ppp_fsm_struct *,ppp_buff_head_struct *);
} ppp_fsm_func_struct;

#define NEG_CHECK(mask,flag) (((mask) & (flag)) ? KAL_TRUE : KAL_FALSE) 
#define NEG_SET(mask,flag)     ((flag) |= (mask))
#define NEG_CLR(mask,flag) ((flag) &= ~(mask))

ppp_buff_head_struct * fsm_pkt_alloc(kal_uint16, kal_uint16);
void fsm_pkt_free(ppp_buff_head_struct **);
void ppp_Down(ppp_type_enum);
void ppp_Up(ppp_fsm_struct *);
void ppp_Open(ppp_type_enum);
void ppp_Close(ppp_type_enum);
void ppp_Deinitial(ppp_type_enum);
void ppp_Reset(ppp_type_enum);
void ppp_Initial(ppp_type_enum);
void ppp_Auth(ppp_fsm_struct *);
void ppp_auth_start_timer(ppp_fsm_struct *);
void ppp_auth_cancel_timer(ppp_fsm_struct *);
void fsm_Up(ppp_fsm_struct *);
void fsm_Down(ppp_fsm_struct *);
void fsm_Init(ppp_fsm_struct *);
void fsm_Open(ppp_fsm_struct *);
void fsm_Close(ppp_fsm_struct *);
void fsm_Send(ppp_fsm_struct *, ppp_fsm_code_enum, kal_uint8, ppp_buff_head_struct *);
void fsm_RcvCodeRej(ppp_fsm_struct *, ppp_buff_head_struct *);
void fsm_RcvProtocolRej(ppp_fsm_struct *, ppp_buff_head_struct *);
void fsm_Input(ppp_fsm_struct *, ppp_buff_head_struct *);
void fsm_SendProtocolRej(ppp_fsm_struct *, ppp_buff_head_struct *);
void fsm_SendPapAck(ppp_fsm_struct *, kal_uint8);
void fsm_SendChapRsp(ppp_fsm_struct * , kal_uint8, kal_char * , kal_char *);
void fsm_SendChapSuccess(ppp_fsm_struct * , kal_uint8 );
#endif /* _PPP_FSM_H */


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -