00001 #ifndef __ISMB_H
00002 #define __ISMB_H
00003
00004 #include "INet.h"
00005
00006
00007 #define SMB_TCP_PORT 3020 // I think
00008
00009
00010 #define SMB_COM_CREATE_DIRECTORY 0x00
00011 #define SMB_COM_DELETE_DIRECTORY 0x01
00012 #define SMB_COM_OPEN 0x02
00013 #define SMB_COM_CREATE 0x03
00014 #define SMB_COM_CLOSE 0x04
00015 #define SMB_COM_FLUSH 0x05
00016 #define SMB_COM_DELETE 0x06
00017 #define SMB_COM_RENAME 0x07
00018 #define SMB_COM_QUERY_INFORMATION 0x08
00019 #define SMB_COM_SET_INFORMATION 0x09
00020 #define SMB_COM_READ 0x0A
00021 #define SMB_COM_WRITE 0x0B
00022 #define SMB_COM_LOCK_BYTE_RANGE 0x0C
00023 #define SMB_COM_UNLOCK_BYTE_RANGE 0x0D
00024 #define SMB_COM_CREATE_TEMPORARY 0x0E
00025 #define SMB_COM_CREATE_NEW 0x0F
00026 #define SMB_COM_CHECK_DIRECTORY 0x10
00027 #define SMB_COM_PROCESS_EXIT 0x11
00028 #define SMB_COM_SEEK 0x12
00029 #define SMB_COM_LOCK_AND_READ 0x13
00030 #define SMB_COM_WRITE_AND_UNLOCK 0x14
00031 #define SMB_COM_READ_RAW 0x1A
00032 #define SMB_COM_READ_MPX 0x1B
00033 #define SMB_COM_READ_MPX_SECONDARY 0x1C
00034 #define SMB_COM_WRITE_RAW 0x1D
00035 #define SMB_COM_WRITE_MPX 0x1E
00036 #define SMB_COM_WRITE_COMPLETE 0x20
00037 #define SMB_COM_SET_INFORMATION2 0x22
00038 #define SMB_COM_QUERY_INFORMATION2 0x23
00039 #define SMB_COM_LOCKING_ANDX 0x24
00040 #define SMB_COM_TRANSACTION 0x25
00041 #define SMB_COM_TRANSACTION_SECONDARY 0x26
00042 #define SMB_COM_IOCTL 0x27
00043 #define SMB_COM_IOCTL_SECONDARY 0x28
00044 #define SMB_COM_COPY 0x29
00045 #define SMB_COM_MOVE 0x2A
00046 #define SMB_COM_ECHO 0x2B
00047 #define SMB_COM_WRITE_AND_CLOSE 0x2C
00048 #define SMB_COM_OPEN_ANDX 0x2D
00049 #define SMB_COM_READ_ANDX 0x2E
00050 #define SMB_COM_WRITE_ANDX 0x2F
00051 #define SMB_COM_CLOSE_AND_TREE_DISC 0x31
00052 #define SMB_COM_TRANSACTION2 0x32
00053 #define SMB_COM_TRANSACTION2_SECONDARY 0x33
00054 #define SMB_COM_FIND_CLOSE2 0x34
00055 #define SMB_COM_FIND_NOTIFY_CLOSE 0x35
00056 #define SMB_COM_TREE_CONNECT 0x70
00057 #define SMB_COM_TREE_DISCONNECT 0x71
00058 #define SMB_COM_NEGOTIATE 0x72
00059 #define SMB_COM_SESSION_SETUP_ANDX 0x73
00060 #define SMB_COM_LOGOFF_ANDX 0x74
00061 #define SMB_COM_TREE_CONNECT_ANDX 0x75
00062 #define SMB_COM_QUERY_INFORMATION_DISK 0x80
00063 #define SMB_COM_SEARCH 0x81
00064 #define SMB_COM_FIND 0x82
00065 #define SMB_COM_FIND_UNIQUE 0x83
00066 #define SMB_COM_NT_TRANSACT 0xA0
00067 #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1
00068 #define SMB_COM_NT_CREATE_ANDX 0xA2
00069 #define SMB_COM_NT_CANCEL 0xA4
00070 #define SMB_COM_OPEN_PRINT_FILE 0xC0
00071 #define SMB_COM_WRITE_PRINT_FILE 0xC1
00072 #define SMB_COM_CLOSE_PRINT_FILE 0xC2
00073 #define SMB_COM_GET_PRINT_QUEUE 0xC3
00074 #define SMB_COM_READ_BULK 0xD8
00075 #define SMB_COM_WRITE_BULK 0xD9
00076 #define SMB_COM_WRITE_BULK_DATA 0xDA
00077
00078
00079 #define SMB_FLAGS_CASELESS 0x04
00080 #define SMB_FLAGS_SERVER_RESP 0x80
00081
00082
00083 #define SMB_FLAGS2_KNOWS_LONG_NAMES 0x0001
00084 #define SMB_FLAGS2_KNOWS_EAS 0x0002
00085 #define SMB_FLAGS2_SECURITY_SIGNATURE 0x0004
00086 #define SMB_FLAGS2_IS_LONG_NAME 0x0040
00087 #define SMB_FLAGS2_EXT_SEC 0x0800
00088 #define SMB_FLAGS2_DFS 0x1000
00089 #define SMB_FLAGS2_PAGING_IO 0x2000
00090 #define SMB_FLAGS2_ERR_STATUS 0x4000
00091 #define SMB_FLAGS2_UNICODE 0x8000
00092
00093
00094 class ISmb
00095 {
00096 char Buffer[1024];
00097 GSocketI *Socket;
00098 int ResumeFrom;
00099
00100 public:
00101 Progress *Meter;
00102
00103 ISmb();
00104 virtual ~ISmb();
00105
00106
00107 GSocketI *Handle() { return Socket; }
00108
00109
00110 bool Open(GSocketI *S, char *RemoteHost, int Port = 0);
00111 bool Close();
00112 bool IsOpen();
00113
00114
00115 void SetResume(int i) { ResumeFrom = i; }
00116 bool GetFile(char *File, GBytePipe &Out);
00117 };
00118
00119 #endif