[Feature]Upload Modem source code

Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/interface/protocol/l2_c2k/common/HlpQos.h b/mcu/interface/protocol/l2_c2k/common/HlpQos.h
new file mode 100644
index 0000000..7263d60
--- /dev/null
+++ b/mcu/interface/protocol/l2_c2k/common/HlpQos.h
@@ -0,0 +1,328 @@
+/*****************************************************************************
+*  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) 2016
+*
+*  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).
+*
+*****************************************************************************/
+/*************************************************************
+*
+* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.  
+* 
+* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
+* 
+* Copyright (c) 2007-2010 VIA Telecom, Inc.  All rights reserved.
+*
+*************************************************************/
+#ifndef  _HLP_QOS_H_
+#define  _HLP_QOS_H_
+/*****************************************************************************
+* 
+* FILE NAME   :   hlpqos.h
+*
+* DESCRIPTION :   This file contains function prototypes and other definitions
+*                 for the QOS
+*
+* HISTORY     :
+*     See Log at end of file
+*
+*****************************************************************************/
+
+/*----------------------------------------------------------------------------
+* Include Files
+----------------------------------------------------------------------------*/
+#include "do_Qos.h"
+/*----------------------------------------------------------------------------
+Defines And Macros
+----------------------------------------------------------------------------*/
+typedef enum
+{
+   QosFileDirCreateErr,
+   FlowRequestErr,
+   FlowReleaseErr,   
+   QosNegoFail,
+   ReservationOpFail,
+   RsvpCommonHdrDecErr,
+   RsvpCheckSumCalErr,
+   RsvpErrSpecNotReceived,
+   Rsvp3GPPObjNotReceived,
+   TFTIpAddrNotMatch,
+   RsvpMsgEncodeErr,
+   RsvpMsgDecodeErr,
+   RsvpDstPortErr,
+   ResvMsgBufFull,
+   RsvpInvalidMsgId,
+   RsvpInvalidTransId,
+   RsvpMsgLengthErr,
+   QoSCheckFail,
+}QOMErrCodeT;
+
+typedef enum
+{
+  TftNull,
+  TftToBeSent,
+  TftSent,
+  TftConfirmed
+}ResvTftStatusT;
+
+typedef enum
+{
+  QOS_INACTIVE,
+  QOS_IDLE,
+  QOS_WFR_CHECK_CONFIRM,
+  QOS_WFR_GRANT,
+  QOS_WFR_TFT_CONFIRM,
+  QOS_WFR_TFT_CONFIRM_NTWK_INIT,
+  QOS_WFR_TFT_REL_CONFIRM,
+  QOS_WFR_TFT_REL_CONFIRM_NTWK_INIT,
+}QoMStateT;
+
+typedef enum
+{
+  QOS_NOT_CHECKED,
+  QOS_CONFIRMED,
+  QOS_CHECKING
+}QoMCheckStateT;
+
+typedef struct
+{
+   QosSubBlobT   QosSetInfo; 
+/*   kal_uint8 MacFlowId; 
+   kal_uint8  RlpState;
+   kal_uint8  RlpFlowNum;   */
+   kal_bool          bReserved;
+}QosTabelT;
+
+typedef struct
+{
+  kal_uint8 Num;
+  kal_uint8 PdnId;
+  kal_uint8 Label[16];
+}QosPdnInfoT;
+
+typedef struct
+{
+  kal_uint8 RlpFlowNum;
+  kal_uint8 cid;
+  ResvTftStatusT   Status;
+} ResvInfoT;
+
+typedef struct
+{
+  kal_uint16         len;/* The length of this data*/
+  kal_uint16         offset;/* The starting location for the data  */
+  CpBufferT      *buffer;/* The buffer which makes up this data. This is a ptr */
+} RsvpDatapktT;
+
+typedef enum
+{
+  PATH_MSG=1,
+  RESV_MSG,
+  PATHERR_MSG,
+  RESVERR_MSG,
+  PATHTEAR_MSG,
+  RESVTEAR_MSG,
+  RESVCONF_MSG
+}RsvpMsgTypeT;
+
+typedef enum
+{
+  TFTIPv4,
+  TFTIPv4Err,
+  TFTIPv6,
+  TFTIPv6Err,
+  HeaderRemoval,
+  HeaderRemovalErr,
+  ChannelTreatment,
+  ChannelTreatmentErr
+}RsvpIETypeT;
+
+
+
+typedef enum
+{
+   IP4SrcAdr_SubnetMask = 16,
+   IP4DstAdr_SubnetMask,
+   IP6SrcAdr_SubnetMask = 32,
+   IP6DstAdr_SubnetMask,
+   Protocol_NextHdr = 48,
+   Single_DstPort = 64,
+   DstPortRange,
+   Single_SrcPort = 80,
+   SrcPortRange,
+   SecurityParmInd = 96,
+   Tos_TrafficClass = 112,
+   Flow_Label = 128,
+   Type2RoutingHdr_PreLen,
+   HomeAdrOpt_PreLen
+}TftPktFilterComponentIdT;
+
+typedef enum
+{
+   ErrReserved,
+   PktFilterAddFailure,
+   PktFilterUnavailable,
+   UnsuccessfulTFTProcessing,
+   ChannelNotAvailable,
+   EvaluationPrecedenceContention,
+   TreatmentNotSupported,
+   PacketFilterReplaceFailure,
+   PersistencyLimitReached,
+   PersistencyNotAllowed,
+   UnauthorizedTFT,
+   MaxNumPktFilters,
+   AddToNonExistTFT,
+   UEUnsuccessfulTftProcess = 0x80,
+   InvalidIPAddress,
+   NotSupportProfileID,
+   InvalidPdnID,
+}TftErrCodeT;
+
+typedef enum
+{
+  QoSCheckSuccessfull,
+  QoSIsNotAuthorized,
+}QoSCheckResultCodeT;
+
+typedef  struct
+{
+   kal_uint32  RsvpSnTransId;
+   kal_uint32  RsvpRvTransId;
+   kal_bool    bTftCreated; 
+   kal_bool    bIpV4;
+   kal_uint32  SrcIpAddr[4];
+   kal_uint32  DstIpAddr[4];
+}RsvpInfoT;
+
+typedef struct
+{
+   RsvpDatapktT  MsgPkt;
+   kal_uint8         NumOfPktList;
+   RlpFlowDirection  Direction[MAX_TFT_NUM]; /*0 Forward, 1 Reverse*/
+   kal_uint8             ResvLabel[MAX_TFT_NUM];
+   kal_uint8             FilterIndex[MAX_TFT_NUM];
+   kal_uint32            TransId;
+   kal_uint8             NumOfSend;
+}RsvpResvMsgT;
+
+typedef  struct
+{
+   //ExeTimerT   TimerCb;
+   kal_timerid TimerId;
+   kal_bool        bActive;
+}RsvpResvTimerT;
+
+typedef  struct
+{
+  TftOperationCodeT OpCode; 
+  kal_uint8             Num;
+  RlpFlowDirection  Direction[MAX_TFT_NUM];
+  kal_uint8             Label[MAX_TFT_NUM];
+  kal_uint8             FilterIndex[MAX_TFT_NUM];
+}ResvTftReqT;
+
+typedef struct
+{
+  kal_uint8   PFType;
+  kal_uint8   length;
+  kal_uint8   PktComponent[200];
+  kal_bool    bTreatmentInc;
+  kal_uint8   PFT;   /*Packet Filter Treatment*/
+  kal_uint32  Hint;  /*RFC3006 hint*/
+}QoMPktContentT;
+
+typedef struct
+{
+  kal_uint8   FlowId;
+  kal_uint8   PrecedenceIndex;/*evaluation precedence index*/
+  QoMPktContentT PktContent;
+}QoMRsvpPktFilterT;
+
+typedef struct
+{
+   kal_uint8  ReservationLabel;
+   kal_uint8  Priority;
+   kal_uint8  QoSSetNum;
+   kal_uint8  QosAttrSetId[MAX_SUPPORTED_QOS_BLOB_NUM];/*7 bits,should not be zero*/
+   kal_uint16 FlowProfileId[MAX_SUPPORTED_QOS_BLOB_NUM];
+} QosRsvpSubBlobT;
+
+typedef struct
+{
+  kal_uint8                  PktFlterNum;
+  kal_uint8                  bIPv4;
+  QoMRsvpPktFilterT      PktFilter[MAX_TFT_NUM];
+  kal_uint8                  FlowNum;
+  QosRsvpSubBlobT        QosBlob[MAX_TFT_NUM];
+}EhrpdResvMsgIEDataT;
+
+typedef struct
+{
+  kal_uint8                  num;
+  RlpFlowDirection       Direction[2];
+  TftOperationCodeT      OpCode[2];
+  EhrpdResvMsgIEDataT    IEData[2]; 
+}ResvMsgIEListT;
+
+typedef struct
+{
+  kal_uint8  num;
+  kal_uint8 Direction[MAX_CLIENT_NUM*2];
+  kal_uint8 Label[MAX_CLIENT_NUM*2];
+  kal_uint8  RsvpTimerId;
+}ResvLabelInfoT;
+/****************************************************************************/
+kal_bool   QOMSetFwdQoSSubscribProfile(QosSubScriberProfileT* pSubProfile);
+kal_bool   QOMSetRevQoSSubscribProfile(QosSubScriberProfileT* pSubProfile);
+void   QOMInit(void);
+void   QOMSetRlpFlowProfile(void);
+kal_bool   QOMActivateQoSFlow(kal_uint8 Label, kal_uint8 Direction);
+kal_bool   QOMSendTFT(ResvTftReqT* pReq, kal_uint32 TransId);
+kal_bool  QOMGetRevSubscribQoSBlob(kal_uint8 Label,QosSubBlobT* pSubProfile);
+kal_bool  QOMGetFwdSubscribQoSBlob(kal_uint8 Label,QosSubBlobT* pSubProfile);
+kal_uint8 QOMEncKKQoSRequest(RlpFlowDirection direction,kal_uint8 Label,kal_uint8* pData,QosSubBlobT*  pSubBlob);
+kal_uint8 QOMEncNullKKQoSRequest(RlpFlowDirection direction,kal_uint8 Label,kal_uint8* pData);
+void  HlpQoMSetSubscribQoSProfile(kal_bool eHRPD,kal_uint8 FlowNum, kal_uint8 PdnId, HlpQoSFlowInfoT* pFlow, kal_uint8 *pFlowId);
+
+kal_bool HlpQoMIsActive(void);
+void QOMSetUpUDPConnection(void);
+void QOMSetUpUDP6Connection(kal_uint8 PdnId);
+void QOMSetMainConnAddr(kal_bool bIPv4, kal_uint32 *pSrcAddr, kal_uint32 *pDstAddr);
+kal_bool HlpQOMReleaseTft(kal_uint8* pLabel, kal_uint8* pDirection, kal_uint8 Num);
+kal_bool HlpQOMFlowRelease(kal_uint8* pLabel, kal_uint8* pDirection, kal_uint8 Num);
+kal_bool HlpQoMFlowRenego(kal_uint8 Num, kal_uint8 *pLabel, kal_uint8* pDirec);
+
+/*****************************************************************************
+* End of File
+*****************************************************************************/
+#endif
+
+
+