/*===========================================================================

FILE: diagfiltertbl.c

SERVICES:

DESCRIPTION

PUBLIC CLASSES:
   N/A

       Copyright ｩ 2000-2002 QUALCOMM Incorporated.
                     All Rights Reserved.
                   QUALCOMM Proprietary/GTDR
===========================================================================*/
// 2004.02.06 1.01A-001 PTX-633 TRK_4542 /brew/jaフォルダ内アクセス禁止対応

/******************************************************************************
//  [PTX-804改修履歴]
//		PTX-804 BREW-20050307001 NJK 高橋 直美
//		        BrewRpcApi.h削除対応のため
******************************************************************************/

/*===============================================================================
INCLUDES AND VARIABLE DEFINITIONS
=============================================================================== */

#undef FEATURE_PEEK_POKE
#undef BREWHEEPMEM_START_ADDR
#undef BREWHEEPMEM_END_ADDR
// PTX804-NJK BREW3.1_Porting [S]
// Brew3.0 Porting ディレクトリ構成変更に伴い追加
#include "OEMFSPath_priv.h"

// Brew3.0 Porting OTS T.Yamamoto ESNを取得するためのI/Fのヘッダをインクルード
//#include "BrewSysMode.h"
//▼PTX-804 BREW-20050307001 NJK 高橋 直美
//#include "BrewRpcApi.h"
//▲PTX-804 BREW-20050307001 NJK 高橋 直美
#include "ApiDB.h"

#define OEM_MOBILEINFO_DIALSIZE      (INPDIAL_MAX+EXTBUF)   /* 移動局番号ｻｲｽﾞ */ // Brew3.0 Porting 20040531 OTS T.Yamamoto
// PTX804-NJK BREW3.1_Porting [E]
typedef int (*PFNCHECK)(const void * pkt, unsigned int length);

typedef struct {
   PFNCHECK pfunc;
} cmd_check_table_type;



/*-------------------------------------------------------------------
Static function prototypes
-------------------------------------------------------------------*/
static int check_func_default_OK(const void * pkt, unsigned int length);
static int check_func_default_NG(const void * pkt, unsigned int length);
// PTX804-NJK BREW3.1_Porting [S]
//static int check_func_command_1(const void * pkt, unsigned int length);
extern int check_func_command_1(const void * pkt, unsigned int length);
// PTX804-NJK BREW3.1_Porting [E]
static int check_func_command_2(const void * pkt, unsigned int length);
static int check_func_command_3(const void * pkt, unsigned int length);
static int check_func_command_4(const void * pkt, unsigned int length);
static int check_func_command_5(const void * pkt, unsigned int length);
static int check_func_command_6(const void * pkt, unsigned int length);
static int check_func_command_7(const void * pkt, unsigned int length);
static int check_func_command_31(const void * pkt, unsigned int length);
static int check_func_command_89(const void * pkt, unsigned int length);
static int check_func_command_93(const void * pkt, unsigned int length);

/*-------------------------------------------------------------------
Static data definisions
-------------------------------------------------------------------*/

static const cmd_check_table_type c_cmd_check_table[] = {
   check_func_default_OK,               // 0.Version Number Request/Response
   check_func_command_1,                // 1.Mobile Station ESN Request/Response
#if defined(FEATURE_PEEK_POKE)
   check_func_command_2,                // 2.Peek byte Request/Response
   check_func_command_3,                // 3.Peek word Request/Response
   check_func_command_4,                // 4.Peek dword Request/Response
   check_func_command_5,                // 5.Poke byte Request/Response
   check_func_command_6,                // 6.Poke word Request/Response
   check_func_command_7,                // 7.Poke dword Request/Response
#else  // FEATURE_PEEK_POKE
   check_func_default_NG,               // 2.Peek byte Request/Response
   check_func_default_NG,               // 3.Peek word Request/Response
   check_func_default_NG,               // 4.Peek dword Request/Response
   check_func_default_NG,               // 5.Poke byte Request/Response
   check_func_default_NG,               // 6.Poke word Request/Response
   check_func_default_NG,               // 7.Poke dword Request/Response
#endif // FEATURE_PEEK_POKE
   check_func_default_NG,               // 8.Byte output Request/Response
   check_func_default_NG,               // 9.Word output Request/Response
   check_func_default_NG,               // 10.Byte input Request/Response
   check_func_default_NG,               // 11.Word input Request/Response
   check_func_default_OK,               // 12.DMSS status Request/Response
   check_func_default_NG,               // 13.Reserved
   check_func_default_NG,               // 14.Reserved
   check_func_default_OK,               // 15.Set logging mask Request/Response
   check_func_default_OK,               // 16.Log packet Request/Response
   check_func_default_NG,               // 17.Peek at NV memory Request/Response
   check_func_default_NG,               // 18.Poke at NV memory Request/Response
   check_func_default_NG,               // 19.Invalid Command Response
   check_func_default_NG,               // 20.Invalid parmaeter Response
   check_func_default_NG,               // 21.Invalid packet length Response
   check_func_default_NG,               // 22.Reserved
   check_func_default_NG,               // 23.Reserved
   check_func_default_NG,               // 24.Packet not allowed in this mode ( online vs offline )
   check_func_default_NG,               // 25.info for TA power and voice graphs
   check_func_default_NG,               // 26.Markov statistics
   check_func_default_NG,               // 27.Reset of Markov statistics
   check_func_default_OK,               // 28.Return diag version for comparison to detect incompatabilities
   check_func_default_OK,               // 29.Return a timestamp
   check_func_default_NG,               // 30.Set TA parameters
   check_func_command_31,               // 31.Request for msg report
   check_func_default_OK,               // 32.Handset Emulation -- keypress
   check_func_default_OK,               // 33.Handset Emulation -- lock or unlock
   check_func_default_NG,               // 34.Handset Emulation -- display request
   check_func_default_NG,               // 35.Reserved
   check_func_default_NG,               // 36.Parameter Download
   check_func_default_NG,               // 37.Reserved
   check_func_default_NG,               // 38.Read NV item
   check_func_default_NG,               // 39.Write NV item
   check_func_default_NG,               // 40.Reserved
   check_func_default_OK,               // 41.Mode change request
   check_func_default_NG,               // 42.Error record retreival
   check_func_default_NG,               // 43.Error record clear
   check_func_default_NG,               // 44.Symbol error rate counter reset
   check_func_default_NG,               // 45.Symbol error rate counter report
   check_func_default_NG,               // 46.Run a specified test
   check_func_default_NG,               // 47.Retreive the current dip switch setting
   check_func_default_NG,               // 48.Write new dip switch setting
   check_func_default_NG,               // 49.Start/Stop Vocoder PCM loopback
   check_func_default_NG,               // 50.Start/Stop Vocoder PKT loopback
   check_func_default_NG,               // 51.Reserved
   check_func_default_NG,               // 52.Reserved
   check_func_default_NG,               // 53.Originate a call
   check_func_default_NG,               // 54.End a call
   check_func_default_NG,               // 55.Reserved
   check_func_default_NG,               // 56.Reserved
   check_func_default_NG,               // 57.Reserved
   check_func_default_NG,               // 58.Switch to downloader
   check_func_default_NG,               // 59.Test Mode Commands and FTM commands
   check_func_default_NG,               // 60.Reserved
   check_func_default_NG,               // 61.Reserved
   check_func_default_NG,               // 62.Reserved
   check_func_default_NG,               // 63.Return the current state of the phone
   check_func_default_NG,               // 64.Return all current sets of pilots
   check_func_default_NG,               // 65.Send the Service Prog. Code to allow SP
   check_func_default_NG,               // 66.Invalid nv_read/write because SP is locked
   check_func_default_NG,               // 67.get parms obsoletes PARM_GET
   check_func_default_NG,               // 68.Serial mode change Request/Response
   check_func_default_NG,               // 69.Reserved
#if defined(FEATURE_PEEK_POKE)
   check_func_default_OK,               // 70.Send password to unlock secure operations the phone to be in a security state that is wasn't - like unlocked.
#else  // FEATURE_PEEK_POKE
   check_func_default_NG,               // 70.Send password to unlock secure operations the phone to be in a security state that is wasn't - like unlocked.
#endif // FEATURE_PEEK_POKE
   check_func_default_NG,               // 71.An operation was attempted which required
   check_func_default_NG,               // 72.Write Preferred Roaming list to the phone.
   check_func_default_NG,               // 73.Read Preferred Roaming list from the phone.
   check_func_default_NG,               // 74.Reserved
   check_func_default_NG,               // 75.Subssytem dispatcher (extended diag cmd)
   check_func_default_NG,               // 76.Reserved
   check_func_default_NG,               // 77.Reserved
   check_func_default_NG,               // 78.Reserved
   check_func_default_NG,               // 79.Reserved
   check_func_default_NG,               // 80.Reserved
   check_func_default_NG,               // 81.Asks the phone what it supports
   check_func_default_NG,               // 82.Reserved
   check_func_default_NG,               // 83.Read SMS message out of NV
   check_func_default_NG,               // 84.Write SMS message into NV
   check_func_default_NG,               // 85.info for Frame Error Rate on multiple channels
   check_func_default_NG,               // 86.Supplemental channel walsh codes
   check_func_default_NG,               // 87.Sets the maximum # supplemental channels
   check_func_default_NG,               // 88.get parms including SUPP and MUX2: obsoletes PARM_GET and PARM_GET_2
   check_func_command_89,               // 89.Performs an Embedded File System (EFS) operation.
   check_func_default_NG,               // 90.AKEY Verification.
   check_func_default_NG,               // 91.Handset emulation - Bitmap screen
   check_func_default_OK,               // 92.Configure communications
   check_func_command_93,               // 93.Extended logmask for > 32 bits.
   check_func_default_NG,               // 94.reserved
   check_func_default_NG,               // 95.reserved
   check_func_default_NG,               // 96.Static Event reporting.
   check_func_default_NG,               // 97.Load balancing and more!
   check_func_default_NG,               // 98.Parameter retrieval
   check_func_default_NG,               // 99.A state/status snapshot of the DMSS.
   check_func_default_NG,               // 100.Used for RPC
   check_func_default_NG,               // 101.Get_property requests
   check_func_default_NG,               // 102.Put_property requests
   check_func_default_NG,               // 103.Get_guid requests
   check_func_default_NG,               // 104.Invocation of user callbacks
   check_func_default_NG,               // 105.Get permanent properties
   check_func_default_NG,               // 106.Put permanent properties
   check_func_default_NG,               // 107.Permanent user callbacks
   check_func_default_NG,               // 108.GPS Session Control
   check_func_default_NG,               // 109.GPS search grid
   check_func_default_NG,               // 110.GPS Statistics
   check_func_default_NG,               // 111.Packet routing for multiple instances of diag
   check_func_default_NG,               // 112.IS2000 status
   check_func_default_NG,               // 113.RLP statistics reset
   check_func_default_NG,               // 114.(S)TDSO statistics reset
   check_func_default_NG,               // 115.Logging configuration packet
   check_func_default_NG,               // 116.Static Trace Event reporting
   check_func_default_NG,               // 117.SBI Read
   check_func_default_NG,               // 118.SBI Write
   check_func_default_NG,               // 119.SSD Verify
   check_func_default_NG,               // 120.Log on Request
   check_func_default_NG,               // 121 .Request for extended msg report
   check_func_default_NG,               // 122.ONCRPC diag packet
   check_func_default_NG,               // 123.Diagnostics protocol loopback.
   check_func_default_NG,               // 124.Extended build ID text
   check_func_default_NG,               // 125.Request for extended msg report
   check_func_default_NG,               // 126.Extended messages in terse format
   check_func_default_NG,               // 127.Translate terse format message identifier
};


/*===============================================================================
FUNCTION DEFINITIONS
=============================================================================== */
/*===========================================================================

FUNCTION: check_func_default_OK

DESCRIPTION


PROTOTYPE:
   int check_func_default_OK(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_default_OK(const void * pkt, unsigned int length)
{
   return(SUCCESS);
}

/*===========================================================================

FUNCTION: check_func_default_NG

DESCRIPTION


PROTOTYPE:
   int check_func_default_NG(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_default_NG(const void * pkt, unsigned int length)
{
   return(EFAILED);
}

/*===========================================================================

FUNCTION: check_func_command_1

DESCRIPTION


PROTOTYPE:
   int check_func_command_1(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
//static int check_func_command_1(const void * pkt, unsigned int length)
//{
//   if (length != sizeof(DIAG_ESN_F_req_type)) {
//     return (EINVALIDFORMAT);
//   }
//   else {
//      DIAG_ESN_F_rsp_type * rsp_ptr = (DIAG_ESN_F_rsp_type *)pkt_alloc(DIAG_ESN_F, sizeof(DIAG_ESN_F_rsp_type));

//      if (rsp_ptr != NULL) {
//         /* Format response packet with dummy value. */
//         rsp_ptr->esn = 0x00000000;
//         pkt_commit((PACKED void *)rsp_ptr);
//      }
//      return(-1);
//   }
//}

/*===========================================================================

FUNCTION: check_func_command_2

DESCRIPTION


PROTOTYPE:
   int check_func_command_2(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_command_2(const void * pkt, unsigned int length)
{
#if defined(BREWHEEPMEM_START_ADDR) & defined(BREWHEEPMEM_END_ADDR)
   DIAG_PEEKB_F_req_type *req = (DIAG_PEEKB_F_req_type *) pkt;
   if (req->ptr < (byte *)BREWHEEPMEM_START_ADDR || req->ptr > (byte *)BREWHEEPMEM_END_ADDR) {
      return(EBADPARM);
   }
#endif // BREWHEEPMEM_START_ADDR & BREWHEEPMEM_END_ADDR
   return(SUCCESS);
}

/*===========================================================================

FUNCTION: check_func_command_3

DESCRIPTION


PROTOTYPE:
   int check_func_command_3(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_command_3(const void * pkt, unsigned int length)
{
#if defined(BREWHEEPMEM_START_ADDR) & defined(BREWHEEPMEM_END_ADDR)
   DIAG_PEEKW_F_req_type *req = (DIAG_PEEKW_F_req_type *) pkt;

   if (req->ptr < (byte *)BREWHEEPMEM_START_ADDR || req->ptr > (byte *)BREWHEEPMEM_END_ADDR) {
      return(EBADPARM);
   }
   return(SUCCESS);
#endif // BREWHEEPMEM_START_ADDR & BREWHEEPMEM_END_ADDR
}

/*===========================================================================

FUNCTION: check_func_command_4

DESCRIPTION


PROTOTYPE:
   int check_func_command_4(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_command_4(const void * pkt, unsigned int length)
{
#if defined(BREWHEEPMEM_START_ADDR) && defined(BREWHEEPMEM_END_ADDR)
   DIAG_PEEKD_F_req_type *req = (DIAG_PEEKD_F_req_type *) pkt;

   if (req->ptr < (byte *)BREWHEEPMEM_START_ADDR || req->ptr > (byte *)BREWHEEPMEM_END_ADDR) {
      return(EBADPARM);
   }
#endif // BREWHEEPMEM_START_ADDR & BREWHEEPMEM_END_ADDR
   return(SUCCESS);
}

/*===========================================================================

FUNCTION: check_func_command_5

DESCRIPTION


PROTOTYPE:
   int check_func_command_5(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_command_5(const void * pkt, unsigned int length)
{
#if defined(BREWHEEPMEM_START_ADDR) && defined(BREWHEEPMEM_END_ADDR)
   DIAG_POKEB_F_req_type *req = (DIAG_POKEB_F_req_type *) pkt;

   if (req->ptr < (byte *)BREWHEEPMEM_START_ADDR || req->ptr > (byte *)BREWHEEPMEM_END_ADDR) {
      return(EBADPARM);
   }
#endif // BREWHEEPMEM_START_ADDR & BREWHEEPMEM_END_ADDR
   return(SUCCESS);
}

/*===========================================================================

FUNCTION: check_func_command_6

DESCRIPTION


PROTOTYPE:
   int check_func_command_6(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_command_6(const void * pkt, unsigned int length)
{
#if defined(BREWHEEPMEM_START_ADDR) && defined(BREWHEEPMEM_END_ADDR)
   DIAG_POKEW_F_req_type *req = (DIAG_POKEW_F_req_type *) pkt;

   if (req->ptr < (word *)BREWHEEPMEM_START_ADDR || req->ptr > (word *)BREWHEEPMEM_END_ADDR) {
      return(EBADPARM);
   }
#endif // BREWHEEPMEM_START_ADDR & BREWHEEPMEM_END_ADDR
   return(SUCCESS);
}

/*===========================================================================

FUNCTION: check_func_command_7

DESCRIPTION


PROTOTYPE:
   int check_func_command_7(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_command_7(const void * pkt, unsigned int length)
{
#if defined(BREWHEEPMEM_START_ADDR) && defined(BREWHEEPMEM_END_ADDR)
   DIAG_POKED_F_req_type *req = (DIAG_POKED_F_req_type *) pkt;

   if (req->ptr < (dword *)BREWHEEPMEM_START_ADDR || req->ptr > (dword *)BREWHEEPMEM_END_ADDR) {
      return(EBADPARM);
   }
#endif // BREWHEEPMEM_START_ADDR & BREWHEEPMEM_END_ADDR
   return(SUCCESS);
}

/*===========================================================================

FUNCTION: check_func_command_31

DESCRIPTION


PROTOTYPE:
   int check_func_command_31(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_command_31(const void * pkt, unsigned int length)
{
   return(SUCCESS);
}

/*===========================================================================

FUNCTION: check_func_command_89

DESCRIPTION


PROTOTYPE:
   int check_func_command_89(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
// Brew 3.0 Porting ディレクトリ構成変更により、"/brew/ja" を
// 作成しないため、TRK4542関連の処理を削除
// [TRK_4542 /brew/jaアクセス禁止対応] [S]
// PTX804-NJK BREW3.1_Porting [S]
//#define BREWRES_DIR_PATH        "/ja"
//#define BREWRES_DIRCHILD_PATH   "/ja/"
/* 高速化のため即値を使用！！上記を変更した場合は以下も修正すること */
//#define BREWRES_DIRC_LEN		(4)
// PTX804-NJK BREW3.1_Porting [E]
// [TRK_4542 /brew/jaアクセス禁止対応] [E]
static int check_func_command_89(const void * pkt, unsigned int length)
{
   fsdiag_req_pkt_type * req = (fsdiag_req_pkt_type *)pkt;
// PTX804-NJK BREW3.1_Porting [S]
// Brew3.0 Porting ディレクトリ構成変更に伴う修正("brew"フォルダで比較)
//   const char * szbrewPath = OEM_GetMIFPath();
   const char * szbrewPath = OEMFS_BREW_DIR;
// PTX804-NJK BREW3.1_Porting [E]
// [TRK_4542 /brew/jaアクセス禁止対応] [S]
// PTX804-NJK BREW3.1_Porting [S]
//   const int    len_brew = STRLEN(szbrewPath);
// PTX804-NJK BREW3.1_Porting [E]
// [TRK_4542 /brew/jaアクセス禁止対応] [E]

   switch (req->file_op) {
      case FSDIAG_MK_DIR:
      {
         if (STRNICMP((void *)req->fs_req.mkdir.name, szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
// PTX804-NJK BREW3.1_Porting [S]
// [TRK_4542 /brew/jaアクセス禁止対応] [S]
//         /* ja以下ならディレクトリ作成不可 */
//         if (STRNICMP((void *)&req->fs_req.mkdir.name[len_brew]
//         				, BREWRES_DIRCHILD_PATH, BREWRES_DIRC_LEN) == 0)
//           return(EBADPARM);
// [TRK_4542 /brew/jaアクセス禁止対応] [E]
// PTX804-NJK BREW3.1_Porting [E]
      }
      break;

      case FSDIAG_RM_DIR:
      {
         if (STRNICMP((void *)req->fs_req.rmdir.name, szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
// PTX804-NJK BREW3.1_Porting [S]
// [TRK_4542 /brew/jaアクセス禁止対応] [S]
//         /* /ja/以下ならディレクトリ削除不可 */
//         if (STRNICMP((void *)&req->fs_req.rmdir.name[len_brew]
//         				, BREWRES_DIRCHILD_PATH, BREWRES_DIRC_LEN) == 0)
//            return(EBADPARM);
//         /* /jaならディレクトリ削除不可 */
//         if (STRICMP((void *)&req->fs_req.rmdir.name[len_brew], BREWRES_DIR_PATH) == 0)
//         {
//            return(EBADPARM);
//         }
// [TRK_4542 /brew/jaアクセス禁止対応] [E]
// PTX804-NJK BREW3.1_Porting [E]
      }
      break;

      case FSDIAG_DISP_DIRS:
      {
         if (STRNICMP((void *)req->fs_req.disp_dirs.name, szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
      }
      break;

      case FSDIAG_DISP_FILES:
      {
         if (STRNICMP((void *)req->fs_req.disp_files.name, (const char *)szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
      }
      break;

      case FSDIAG_READ_FILE:
      {
         if (req->fs_req.read.seq_num == 0)
         {
            if (STRNICMP((const char *)req->fs_req.read.filename_info.name, (const char *)szbrewPath, STRLEN(szbrewPath)))
               return(EBADPARM);
         }
      }
      break;

      case FSDIAG_WRITE_FILE:
      {
         if (req->fs_req.write.seq_num == 0)
         {
            if (STRNICMP((const char *)req->fs_req.write.block.begin.var_len_buf.name_info.name, (const char *)szbrewPath, STRLEN(szbrewPath)))
               return(EBADPARM);
// PTX804-NJK BREW3.1_Porting [S]
// [TRK_4542 /brew/jaアクセス禁止対応] [S]
//            if (STRNICMP((const char *)&req->fs_req.write.block.begin.var_len_buf.name_info.name[len_brew]
//            			, (const char *)BREWRES_DIRCHILD_PATH, BREWRES_DIRC_LEN) == 0)
//               return(EBADPARM);
// [TRK_4542 /brew/jaアクセス禁止対応] [E]
// PTX804-NJK BREW3.1_Porting [E]
         }
      }
      break;

      case FSDIAG_REMOVE_FILE:
      {
         if (STRNICMP((const char *)req->fs_req.rmfile.name, (const char *)szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
// PTX804-NJK BREW3.1_Porting [S]
// [TRK_4542 /brew/jaアクセス禁止対応] [S]
//         if (STRNICMP((const char *)&req->fs_req.rmfile.name[len_brew]
//            			, (const char *)BREWRES_DIRCHILD_PATH, BREWRES_DIRC_LEN) == 0)
//            return(EBADPARM);
// [TRK_4542 /brew/jaアクセス禁止対応] [E]
// PTX804-NJK BREW3.1_Porting [E]
      }
      break;

      case FSDIAG_GET_ATTRIB:
      {
         if (STRNICMP((const char *)req->fs_req.get_attrib.name, (const char *)szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
      }
      break;

      case FSDIAG_SET_ATTRIB:
      {
         if (STRNICMP((const char *)req->fs_req.set_attrib.filename_info.name, (const char *)szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
// PTX804-NJK BREW3.1_Porting [S]
// [TRK_4542 /brew/jaアクセス禁止対応] [S]
//         if (STRNICMP((const char *)&req->fs_req.set_attrib.filename_info.name[len_brew]
//            			, (const char *)BREWRES_DIRCHILD_PATH, BREWRES_DIRC_LEN) == 0)
//            return(EBADPARM);
// [TRK_4542 /brew/jaアクセス禁止対応] [E]
// PTX804-NJK BREW3.1_Porting [E]
      }
      break;

      case FSDIAG_REMOTE_LINK:
      {
         if (STRNICMP((const char *)req->fs_req.remote_link.name_info.name, (const char *)szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
// PTX804-NJK BREW3.1_Porting [S]
// [TRK_4542 /brew/jaアクセス禁止対応] [S]
//         if (STRNICMP((const char *)&req->fs_req.remote_link.name_info.name[len_brew]
//            			, (const char *)BREWRES_DIRCHILD_PATH, BREWRES_DIRC_LEN) == 0)
//            return(EBADPARM);
// [TRK_4542 /brew/jaアクセス禁止対応] [E]
// PTX804-NJK BREW3.1_Porting [E]
      }
      break;

      case FSDIAG_ITER_DIRS:
      case FSDIAG_ITER_FILES:
      {
         if (STRNICMP((const char *)req->fs_req.iter_dirs.dir_name.name, (const char *)szbrewPath, STRLEN(szbrewPath)))
            return(EBADPARM);
      }
      break;

      case FSDIAG_SPACE_AVAIL:
      break;
   }
   return(SUCCESS);
}

/*===========================================================================

FUNCTION: check_func_command_93

DESCRIPTION


PROTOTYPE:
   int check_func_command_93(const void * pkt, unsigned int length);

PARAMETERS:
   pkt    : [in]: request packet data
   length : [in]: request packet length

DEPENDENCIES
  none

RETURN VALUE
  SUCCESS       : send command to diag
  EBADPARM      : send parameter err to sio
  EFAILED       : send command err to sio
  EINVALIDFORMAT: send length err to sio

SIDE EFFECTS
  none
===========================================================================*/
static int check_func_command_93(const void * pkt, unsigned int length)
{
   DIAG_EXT_LOGMASK_F_req_type * req_ptr = (DIAG_EXT_LOGMASK_F_req_type *)pkt;
   int i;

   if (length != FPOS(DIAG_EXT_LOGMASK_F_req_type, mask) + (req_ptr->num_bits + 7) / 8) {
      return(EBADPARM);
   }

   if (req_ptr->num_bits <= 0xf2 ) {
      return(EBADPARM);
   }

   // Clear bit 0 - 241
   for (i=0; i < 0xf1; i++) {
      req_ptr->mask[i>>3] &= ~(0x80 >> (i & 7));
   }

   // Clear bit 275 -
   if ( req_ptr->num_bits > 0x112) {
      for (i=0x113; i <= req_ptr->num_bits; i++) {
         req_ptr->mask[i>>3] &= ~(0x80 >> (i & 7));
      }
   }

   return(SUCCESS);
}
