Reverted GX FIFO breakage.
[libogc.git] / gc / smb.h
blob6d87f075ace3e04e3d808c0873fdca2052cb3d4a
1 /****************************************************************************
2 * TinySMB
3 * Nintendo Wii/GameCube SMB implementation
5 * Copyright softdev
6 * Modified by Tantric to utilize NTLM authentication
7 * PathInfo added by rodries
8 * SMB devoptab by scip, rodries
10 * You will find WireShark (http://www.wireshark.org/)
11 * invaluable for debugging SAMBA implementations.
13 * Recommended Reading
14 * Implementing CIFS - Christopher R Hertel
15 * http://www.ubiqx.org/cifs/SMB.html
17 * License:
19 * This library is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU Lesser General Public
21 * License as published by the Free Software Foundation; either
22 * version 2.1 of the License, or (at your option) any later version.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 ****************************************************************************/
34 #ifndef __NBTSMB_H__
35 #define __NBTSMB_H__
37 #include <gctypes.h>
39 #define SMB_MAXPATH 4096
41 /**
42 * SMB Error codes
44 #define SMB_SUCCESS 0
45 #define SMB_ERROR -1
46 #define SMB_BAD_PROTOCOL -2
47 #define SMB_BAD_COMMAND -3
48 #define SMB_PROTO_FAIL -4
49 #define SMB_NOT_USER -5
50 #define SMB_BAD_KEYLEN -6
51 #define SMB_BAD_DATALEN -7
53 /**
54 * SMB File Open Function
56 #define SMB_OF_OPEN 1
57 #define SMB_OF_TRUNCATE 2
58 #define SMB_OF_CREATE 16
60 /**
61 * FileSearch
63 #define SMB_SRCH_READONLY 1
64 #define SMB_SRCH_HIDDEN 2
65 #define SMB_SRCH_SYSTEM 4
66 #define SMB_SRCH_VOLUME 8
67 #define SMB_SRCH_DIRECTORY 16
68 #define SMB_SRCH_ARCHIVE 32
70 /**
71 * SMB File Access Modes
73 #define SMB_OPEN_READING 0
74 #define SMB_OPEN_WRITING 1
75 #define SMB_OPEN_READWRITE 2
76 #define SMB_OPEN_COMPATIBLE 0
77 #define SMB_DENY_READWRITE 0x10
78 #define SMB_DENY_WRITE 0x20
79 #define SMB_DENY_READ 0x30
80 #define SMB_DENY_NONE 0x40
83 #ifdef __cplusplus
84 extern "C" {
85 #endif
87 /***
88 * SMB Connection Handle
90 typedef u32 SMBCONN;
92 /***
93 * SMB File Handle
95 typedef void* SMBFILE;
97 /*** SMB_FILEENTRY
98 SMB Long Filename Directory Entry
99 ***/
100 typedef struct
102 u64 size;
103 u64 ctime;
104 u64 atime;
105 u64 mtime;
106 u32 attributes;
107 char name[256];
108 } SMBDIRENTRY;
111 * Prototypes
114 /*** Înitialization functions to be used with stdio API ***/
115 bool smbInitDevice(const char* name, const char *user, const char *password, const char *share, const char *ip);
116 bool smbInit(const char *user, const char *password, const char *share, const char *ip);
117 void smbClose(const char* name);
118 bool CheckSMBConnection(const char* name);
119 s32 SMB_Reconnect(SMBCONN *_smbhndl, BOOL test_conn);
121 /*** Session ***/
122 s32 SMB_Connect(SMBCONN *smbhndl, const char *user, const char *password, const char *share, const char *IP);
123 void SMB_Close(SMBCONN smbhndl);
125 /*** File Find ***/
126 s32 SMB_PathInfo(const char *filename, SMBDIRENTRY *sdir, SMBCONN smbhndl);
127 s32 SMB_FindFirst(const char *filename, unsigned short flags, SMBDIRENTRY *sdir,SMBCONN smbhndl);
128 s32 SMB_FindNext(SMBDIRENTRY *sdir,SMBCONN smbhndl);
129 s32 SMB_FindClose(SMBCONN smbhndl);
131 /*** File I/O ***/
132 SMBFILE SMB_OpenFile(const char *filename, unsigned short access, unsigned short creation,SMBCONN smbhndl);
133 void SMB_CloseFile(SMBFILE sfid);
134 s32 SMB_ReadFile(char *buffer, int size, int offset, SMBFILE sfid);
135 s32 SMB_WriteFile(const char *buffer, int size, int offset, SMBFILE sfid);
137 #ifdef __cplusplus
139 #endif
141 #endif