ndmpd.h
来自「网络数据管理协议的开发」· C头文件 代码 · 共 312 行
H
312 行
/* -*- Mode: C -*- * ndmpd.h * * Description : NDMP daemon commons. * * Copyright (c) 1996,1997 PDC, Network Appliance. All Rights Reserved. * * $Id: ndmpd.h,v 1.11 1998/05/26 03:52:21 tim Exp $ */#ifndef _ndmpd_h#define _ndmpd_h#if !defined(lint) && !defined(SABER)static char ndmpd_h_rcsId[] __attribute__ ((unused)) = "@(#) $Id: ndmpd.h,v 1.11 1998/05/26 03:52:21 tim Exp $";#endif#include <sys/types.h>#include <sys/stat.h>#include "ndmp_common.h"#include "module.h"#define MAX_RECORD_SIZE (126*512)struct NdmpdSession;typedef struct NdmpdSession NdmpdSession;/* File handler classes */#define HC_CLIENT 1#define HC_MOVER 2#define HC_MODULE 4#define HC_ALL 0xffffffffstruct NdmpdFileHandler{ int fd; u_long mode; u_long class; void* cookie; NdmpdFileHandlerFunc* func; struct NdmpdFileHandler* next;};typedef struct NdmpdFileHandler NdmpdFileHandler;struct NdmpdSession{ NdmpConnection connection; /* NDMP connection to client */ bool_t eof; /* connection EOF flag */ u_short protocolVersion;/* connection protocol version */ u_long id; /* unique session identifier */ struct { int fd; /* scsi device file descriptor */ } scsi; struct { int fd; /* tape device file descriptor */ u_long recordCount; /* number of records written */ ndmp_tape_open_mode mode; /* tape device open mode */ } tape; struct { ndmp_mover_state state; /* current state */ ndmp_mover_mode mode; /* current mode */ ndmp_mover_pause_reason pauseReason; /* current reason */ ndmp_mover_halt_reason haltReason; /* current reason */ u_longlong_t dataWritten; /* total written to tape */ u_longlong_t seekPosition; /* current seek position */ u_longlong_t bytesLeftToRead;/* #bytes to end of seek window */ u_longlong_t windowOffset; /* valid data window begin */ u_longlong_t windowLength; /* valid data window length */ u_longlong_t position; /* current data stream pos */ u_long recordSize; /* tape I/O record size */ u_long recordNum; /* current record num */ int listenSock; /* data conn listen socket */ int sock; /* data conn socket */ u_long rIndex; /* buffer read index */ u_long wIndex; /* buffer write index */ char buf[MAX_RECORD_SIZE]; /* data buffer */ } mover; struct { ndmp_data_operation operation; /* current operation */ ndmp_data_state state; /* current state */ ndmp_data_halt_reason haltReason; /* current reason */ bool_t abortFlag; /* abort operation flag */ bool_t ioReady; /* mover sock read for I/O */ ndmp_pval *env; /* environment from backup or * recover request */ u_long envLen; /* environment length */ ndmp_name *nlist; /* recover file list */ u_long nlistLen; /* recover file list length */ ndmp_addr moverAddr; /* address for connection to mover */ int sock; /* socket to remote mover */ int listenSock; /* socket for listening for remote mover connections */ u_longlong_t readOffset; /* data read seek offset */ u_longlong_t readLength; /* data read length */ u_longlong_t bytesLeftToRead;/* #bytes to end of seek window */ u_longlong_t position; /* current data stream pos */ u_long discardLength; /* bytes to discard */ struct { void* moduleCookie;/* sent as abortFunc param */ ModuleStartFunc* startFunc; /* start function */ ModuleAbortFunc* abortFunc; /* abort function */ NdmpdModuleStats stats; /* statistics buffer */ } module; } data; struct { ndmp_file* files; ndmp_dir* dirs; ndmp_node* nodes; ndmp_file_name* fileNames; ndmp_file_name* dirNames; ndmp_file_stat* fileStats; ndmp_file_stat* nodeStats; char* fileNameBuf; char* dirNameBuf; u_long fileIndex; u_long dirIndex; u_long nodeIndex; u_long fileNameBufIndex; u_long dirNameBufIndex; } fh; NdmpdFileHandler* fileHandlerList; /* for I/O multiplexing */};/* * NDMP request handler functions. */NdmpMsgHandlerFunc ndmpdConnectOpen;NdmpMsgHandlerFunc ndmpdConnectClientAuth;NdmpMsgHandlerFunc ndmpdConnectClose;NdmpMsgHandlerFunc ndmpdConnectServerAuth;NdmpMsgHandlerFunc ndmpdConfigGetHostInfo;NdmpMsgHandlerFunc ndmpdConfigGetConnectionType;NdmpMsgHandlerFunc ndmpdConfigGetAuthAttr;NdmpMsgHandlerFunc ndmpdConfigGetButypeInfo;NdmpMsgHandlerFunc ndmpdConfigGetFsInfo;NdmpMsgHandlerFunc ndmpdConfigGetTapeInfo;NdmpMsgHandlerFunc ndmpdConfigGetScsiInfo;NdmpMsgHandlerFunc ndmpdConfigGetServerInfo;NdmpMsgHandlerFunc ndmpdScsiOpen;NdmpMsgHandlerFunc ndmpdScsiClose;NdmpMsgHandlerFunc ndmpdScsiGetState;NdmpMsgHandlerFunc ndmpdScsiSetTarget;NdmpMsgHandlerFunc ndmpdScsiResetDevice;NdmpMsgHandlerFunc ndmpdScsiResetBus;NdmpMsgHandlerFunc ndmpdScsiExecuteCdb;NdmpMsgHandlerFunc ndmpdTapeOpen;NdmpMsgHandlerFunc ndmpdTapeClose;NdmpMsgHandlerFunc ndmpdTapeGetState;NdmpMsgHandlerFunc ndmpdTapeMtio;NdmpMsgHandlerFunc ndmpdTapeSetRecordSize;NdmpMsgHandlerFunc ndmpdTapeWrite;NdmpMsgHandlerFunc ndmpdTapeRead;NdmpMsgHandlerFunc ndmpdTapeExecuteCdb;NdmpMsgHandlerFunc ndmpdDataGetState;NdmpMsgHandlerFunc ndmpdDataStartBackup;NdmpMsgHandlerFunc ndmpdDataStartRecover;NdmpMsgHandlerFunc ndmpdDataAbort;NdmpMsgHandlerFunc ndmpdDataGetEnv;NdmpMsgHandlerFunc ndmpdDataStop;NdmpMsgHandlerFunc ndmpdDataListen;NdmpMsgHandlerFunc ndmpdDataConnect;NdmpMsgHandlerFunc ndmpdMoverGetState;NdmpMsgHandlerFunc ndmpdMoverListen;NdmpMsgHandlerFunc ndmpdMoverContinue;NdmpMsgHandlerFunc ndmpdMoverAbort;NdmpMsgHandlerFunc ndmpdMoverStop;NdmpMsgHandlerFunc ndmpdMoverSetWindow;NdmpMsgHandlerFunc ndmpdMoverRead;NdmpMsgHandlerFunc ndmpdMoverClose;NdmpMsgHandlerFunc ndmpdMoverSetRecordSize;NdmpMsgHandlerFunc ndmpdMoverConnect;/* * Backup/recover module API functions. */NdmpdGetEnvFunc ndmpdApiGetEnv;NdmpdAddEnvFunc ndmpdApiAddEnv;NdmpdGetNameFunc ndmpdApiGetName;NdmpdDispatchFunc ndmpdApiDispatch;NdmpdDoneFunc ndmpdApiDone;NdmpdLogFunc ndmpdApiLog;NdmpdWriteFunc ndmpdApiWrite;NdmpdFileHistoryFileFunc ndmpdApiFileHistoryFile;NdmpdFileHistoryDirFunc ndmpdApiFileHistoryDir;NdmpdFileHistoryNodeFunc ndmpdApiFileHistoryNode;NdmpdReadFunc ndmpdApiRead;NdmpdSeekFunc ndmpdApiSeek;NdmpdFileRecoveredFunc ndmpdApiFileRecovered;NdmpdAddFileHandlerFunc ndmpdApiAddFileHandler;NdmpdRemoveFileHandlerFunc ndmpdApiRemoveFileHandler;/* * Utility functions form data.c. */voidndmpdDataCleanup(NdmpdSession* session);voidndmpdDataInit(NdmpdSession* session);voidndmpdDataError(NdmpdSession* session, ndmp_data_halt_reason reason);intndmpdRemoteWrite(NdmpdSession* session, char* data, u_long length);intndmpdRemoteRead(NdmpdSession* session, char* data, u_long length);/* * Utility functions from mover.c. */voidndmpdMoverInit(NdmpdSession* session);voidndmpdMoverCleanup(NdmpdSession* session);voidndmpdMoverError(NdmpdSession* session, ndmp_mover_halt_reason reason);intndmpdMoverSeek(NdmpdSession* session, u_longlong_t offset, u_longlong_t length);intndmpdLocalWrite(NdmpdSession* session, char* data, u_long length);intndmpdLocalRead(NdmpdSession* session, char* data, u_long length);/* * Utility functions from file_history.c */voidndmpdFileHistoryInit(NdmpdSession* session);voidndmpdFileHistoryCleanup(NdmpdSession* session, bool_t sendFlag);/* * Utility functions from util.c. */intndmpdSelect(NdmpdSession* session, bool_t block, u_long fdClass);ndmp_errorndmpdSaveEnv(NdmpdSession* session, ndmp_pval *env, u_long envlen);voidndmpdFreeEnv(NdmpdSession* session);ndmp_errorndmpdSaveNlist(NdmpdSession* session, ndmp_name* nlist, u_long nlistlen);voidndmpdFreeNlist(NdmpdSession* session);intndmpdAddFileHandler(NdmpdSession* session, void* cookie, int fd, u_long mode, u_long class, NdmpdFileHandlerFunc* func);intndmpdRemoveFileHandler(NdmpdSession* session, int fd);voidndmpdCreateMD5Challenge(NdmpdSession* session, char buf[64]);#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?