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

📄 ftps_private.h

📁 CSR蓝牙芯片的ftp程序的服务器端代码 客户端已经上传
💻 H
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004

FILE NAME
    FTPS_private.h
    
DESCRIPTION
 Private header for the FTP Server library

*/

#ifndef FTPS_PRIVATE_H_
#define FTPS_PRIVATE_H_

#include <stdlib.h>
#include <panic.h>
#include <message.h>

#include "goep.h"


/* Macros for creating messages */
#define MAKE_FTPS_MESSAGE(TYPE) TYPE##_T *message = PanicUnlessNew(TYPE##_T);

/* Send Error Message */
#define FTPS_SEND_IND(SESSION,TYPE) {TYPE##_T *message = PanicUnlessNew(TYPE##_T);message->session=(FTPS*)(SESSION);MessageSend((SESSION)->theAppTask, (TYPE), message);}

#ifdef FTPS_LIBRARY_DEBUG
	#include <panic.h>
	#include <stdio.h>
	#define FTPS_DEBUG(x) {printf x; Panic();}
#else
	#define FTPS_DEBUG(x)
#endif

/* Type string to use to browse a folders contents */
static const uint8 typeFolder[]="x-obex/folder-listing";

/* Currently running FTPS Command */
typedef enum
{
	ftps_com_None,
	ftps_com_StartSession,
	ftps_com_CloseSession,
	ftps_com_Connecting,

	ftps_com_GetFolderListing,
	ftps_com_GetObject,

	ftps_com_PutObject,
	ftps_com_DeleteObject,

	ftps_com_SetPath,

	ftps_command_end_of_list
} ftps_running_command;

/* Internal state structures */
struct __ftpsState
{
	TaskData            task;
	/* Task associated with this session */
	Task theAppTask;
	/* Sink associated with the session */
	Sink sink;
	/* Maximum packet length for this session */
	uint16 packetSize;
	/* Server Bluetooth address */
	const bdaddr *bdAddr;
	/* Currently running FTPC command */
	ftps_running_command currCom;
	/* Server Type */
	ftps_serv_type serv_type;
	/* Server channel */
	uint8 rfcChan;
	/* SDP Handle */
	uint32 sdpHandle;

	/* Goep Handle */
	GOEP *handle;
};
typedef struct __ftpsState ftpsState;







/* FTP Server Library private messages */
#define FTPS_INTERNAL_MESSAGE_BASE 0x00

enum
{
	FTPS_INT_CONNECTION_RESP = FTPS_INTERNAL_MESSAGE_BASE,

	FTPS_INT_SEND_FIRST_PACKET,
	FTPS_INT_SEND_NEXT_PACKET,
	FTPS_INT_SEND_GET_REJECT,
	FTPS_INT_SEND_FIRST_PACKET_SRC,
	FTPS_INT_SEND_NEXT_PACKET_SRC,

	FTPS_INT_GET_NEXT_PACKET,
	FTPS_INT_SEND_DELETE_REPLY,
	FTPS_INT_SEND_PUT_REJECT,

	FTPS_INT_SETPATH_RESULT,

	FTPS_INT_ENDOFLIST
};

/* Internal Message Structures */
typedef struct
{
	Task theAppTask;
	uint16 sdpLen;
	const uint8* sdpRecord;
	ftps_serv_type serv_type;
} FTPS_INT_START_SESSION_T;

typedef struct
{
	bool accept;
	uint16 pktSize;
	ftps_serv_type type;
} FTPS_INT_CONNECTION_RESP_T;

typedef struct
{
    uint16 nameLen;
    const uint8* name;
    uint16 typeLen;
    const uint8* type;
	uint16 length;
    const uint8 *packet;
    uint32 totalLen;
    bool onlyPacket;
} FTPS_INT_SEND_FIRST_PACKET_T;

typedef struct
{
	uint16 length;
    const uint8 *packet;
    bool lastPacket;
} FTPS_INT_SEND_NEXT_PACKET_T;

typedef struct
{
	ftps_transfer_reason reason;
} FTPS_INT_SEND_GET_REJECT_T;

typedef struct
{
    uint16 nameLen;
    const uint8* name;
    uint16 typeLen;
    const uint8* type;
	uint16 length;
    Source src;
	uint16 offset;
    uint32 totalLen;
    bool onlyPacket;
} FTPS_INT_SEND_FIRST_PACKET_SRC_T;

typedef struct
{
	uint16 length;
    Source src;
	uint16 offset;
    bool lastPacket;
} FTPS_INT_SEND_NEXT_PACKET_SRC_T;

typedef struct
{
	bool moreData;
} FTPS_INT_GET_NEXT_PACKET_T;

typedef struct
{
	bool success;
} FTPS_INT_SEND_DELETE_REPLY_T;

typedef struct
{
	ftps_transfer_reason reason;
} FTPS_INT_SEND_PUT_REJECT_T;

typedef struct
{
	ftps_setpath_result result;
} FTPS_INT_SETPATH_RESULT_T;



/****************************************************************************
NAME 
    ftpsGetTheTask

DESCRIPTION
    This function returns the FTPS library task so that the FTPS library can use it.

RETURNS
    The FTPS library task.
*/
Task ftpsGetTheTask(void);

/****************************************************************************
NAME 
    ftpsHandler

DESCRIPTION
    Handler for messages received by the FTPS Task.

RETURNS
    Nothing.
*/
void ftpsHandler(Task task, MessageId id, Message message);

void ftpsMsgSendInitCfm(ftpsState *state, ftps_lib_status status);
void ftpsMsgSendConnectCfm(ftpsState *state, ftps_lib_status status, uint16 pktSize);
void ftpsMsgSendGetObjectCompleteInd(ftpsState *state, ftps_lib_status status);
void ftpsMsgSendPutObjectCompleteInd(ftpsState *state, ftps_lib_status status);


#endif /* FTPS_PRIVATE_H_*/


⌨️ 快捷键说明

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