opt
/
kaspersky
/
kav4fs
/
src
/
kernel
/
oas
/
small
➕ New
📤 Upload
✎ Editing:
protocol.h
← Back
#ifndef KERNEL__OAS__SMALL__PROTOCOL_H #define KERNEL__OAS__SMALL__PROTOCOL_H #ifndef __KERNEL__ #include <sys/types.h> #endif #pragma pack(1) enum ReqTypes { CHECK_FILE = 1, // both MONITOR and SAMBA CHECK_FILE_RES = 2, // both MONITOR and SAMBA NOTIFY_FILE = 3, // both MONITOR and SAMBA MONITOR_SHUTDOWN = 4, // only MONITOR SAMBA_CONNECT = 5, // only SAMBA CHECK_SIGN = 6 }; #define FS_PROTOCOL_VERSION 3 typedef struct { u_int8_t request; // common_request_types u_int8_t version; // MONITOR_INTERFACE_VERSION/SAMBA_INTERFACE_VERSION u_int32_t data_size; } ProtocolHeader; // struct for universal access(cast) to any data typedef struct { ProtocolHeader header; char data[0]; } ProtocolData; // CHECK_FILE enum FileOpType { FILE_OPEN_OPER, FILE_CLOSE_OPER, FILE_EXEC_OPER }; typedef struct { ProtocolHeader header; u_int32_t uid; // effective user ID u_int32_t gid; // effective group ID u_int32_t pid; // process ID int32_t flags; // flags like O_RDONLY etc u_int8_t file_type; // enum file_oper_type u_int16_t queue_id; // used only in MONITOR, but probably will be used in SAMBA // in the future // size of dev_t and ino_t is platform specific u_int64_t dev; u_int64_t ino; char name[0]; // filename,host } CheckFileData; typedef struct { ProtocolHeader header; u_int32_t uid; // effective user ID u_int32_t gid; // effective group ID u_int32_t pid; // process ID int32_t flags; // flags like O_RDONLY etc u_int8_t file_op_type; // enum file_oper_type u_int16_t queue_id; // used only in MONITOR, but probably will be used in SAMBA // in the future // size of dev_t and ino_t is platform specific u_int64_t dev; u_int64_t ino; int64_t mtime; int64_t size; u_int32_t owner_uid; u_int32_t file_mode; // st_mode from struct stat int64_t f_type; // file system type, it's for Linux u_int8_t fstypelen; // it is zero on Linux char strings[0]; // fstypename,filename } CheckFileData2; // ANSWER_FILE typedef struct { ProtocolHeader header; u_int8_t result; // result u_int16_t queue_id; // used only in MONITOR, but probably will be used in SAMBA // in the future } CheckFileResultData; // string "viruses" removed from answer_file, its unused // SAMBA_CONNECT typedef struct { ProtocolHeader header; u_int16_t queue_id; // session_id char data[0]; // user,ip,host } SambaConnectData; // NOTIFY_FILE enum FileNotifyType { FILE_UNLINK_OPER, FILE_RENAME_OPER, FILE_NAME_TOO_LONG }; typedef struct { ProtocolHeader header; u_int8_t file_type; // enum file_notify_type u_int64_t dev; u_int64_t ino; char name[0]; // filename } NotifyFileData; enum FileAccessType { FILE_ACCESS_ACCEPT, FILE_ACCESS_DENY, FILE_ACCESS_NO_CHECK }; typedef struct { char* data; size_t length; } PackedBuffer; #pragma pack() typedef struct { u_int16_t queue_id; enum FileAccessType result; } CheckFileResultInfoData; typedef void CheckFileResultCallback(void* context, const CheckFileResultInfoData* data); typedef void ModuleShutdownCallback(void* context); typedef struct { uid_t user; // effective user id gid_t group; // effective group id pid_t process; u_int16_t queue_id; const char* filename; enum FileOpType oper; int flags; dev_t device; ino_t inode; const char* host; // added in version 2 u_int8_t version; int64_t mtime; int64_t size; u_int32_t owner_uid; u_int32_t file_mode; // st_mode from struct stat int64_t f_type; // file system type, it's for Linux u_int8_t fstypelen; // it is zero on Linux const char* fstypename; } CheckFileInfoData; typedef void CheckFileCallback(void* context, const CheckFileInfoData* data); typedef struct { const char* filename; enum FileNotifyType oper; dev_t device; ino_t inode; } NotifyFileInfoData; typedef void NotifyFileCallback(void* context, const NotifyFileInfoData* data); typedef struct { u_int16_t queue_id; const char* user; const char* ip; const char* host; } SambaConnectInfoData; typedef void SambaConnectCallback(void* context, SambaConnectInfoData* data); typedef struct { CheckFileCallback* check_file; // CHECK_FILE NotifyFileCallback* notify_file; // NOTIFY_FILE SambaConnectCallback* samba_connect; // SAMBA_CONNECT CheckFileResultCallback* check_file_result; // ANSWER_FILE ModuleShutdownCallback* shutdown; // MONITOR_SHUTDOWN CheckFileCallback* check_sign; // CHECK_SIGN } ProtocolCallbacks; #endif // KERNEL__OAS__SMALL__PROTOCOL_H
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel