fix varargs SPrintf. dont use 'args' as a paramater name since it is used in the...
[AROS.git] / workbench / network / smbfs / source_code / smbfs.h
blob627338612e57714b5ec0fff8f1ea3ce790a3ac31
1 /*
2 * $Id: smbfs.h,v 1.4 2009/04/14 11:32:51 obarthel Exp $
4 * :ts=4
6 * SMB file system wrapper for AmigaOS, using the AmiTCP V3 API
8 * Copyright (C) 2000-2009 by Olaf `Olsen' Barthel <obarthel -at- gmx -dot- net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #ifndef _SMBFS_H
26 #define _SMBFS_H 1
28 /****************************************************************************/
30 #ifndef _SYSTEM_HEADERS_H
31 #include "system_headers.h"
32 #endif /* _SYSTEM_HEADERS_H */
34 #ifndef _ASSERT_H
35 #include "assert.h"
36 #endif /* _ASSERT_H */
38 /****************************************************************************/
40 #define SAME (0)
41 #define OK (0)
42 #define NOT !
44 /****************************************************************************/
46 #ifndef ZERO
47 #define ZERO ((BPTR)NULL)
48 #endif /* ZERO */
50 /****************************************************************************/
52 #ifndef AMIGA_COMPILER_H
54 /****************************************************************************/
56 #if defined(__SASC)
57 #define FAR __far
58 #define ASM __asm
59 #define REG(r,p) register __##r p
60 #define INLINE __inline
61 #endif /* __SASC */
63 #if defined(__GNUC__)
64 #define FAR
65 #define ASM
66 #define REG(r,p) p __asm(#r)
67 #define INLINE __inline__
68 #endif /* __GNUC__ */
70 /****************************************************************************/
72 #ifndef VARARGS68K
73 #define VARARGS68K
74 #endif /* VARARGS68K */
76 /*****************************************************************************/
78 #endif /* AMIGA_COMPILER_H */
80 /*****************************************************************************/
82 #ifndef min
83 #define min(a,b) ((a) < (b) ? (a) : (b))
84 #endif /* min */
86 /****************************************************************************/
88 #if defined(__SASC)
89 extern struct Library * FAR AbsExecBase;
90 #else
91 #ifndef AbsExecBase
92 #define AbsExecBase (*(struct Library **)4)
93 #endif /* AbsExecBase */
94 #endif /* __SASC */
96 /****************************************************************************/
98 extern struct Library * SocketBase;
99 extern struct Library * SysBase;
100 extern struct Library * DOSBase;
102 /****************************************************************************/
104 #if defined(__amigaos4__)
106 /****************************************************************************/
108 extern struct ExecIFace * IExec;
109 extern struct DOSIFace * IDOS;
110 extern struct SocketIFace * ISocket;
112 /****************************************************************************/
114 #endif /* __amigaos4__ */
116 /****************************************************************************/
118 #ifndef h_errno
119 extern int h_errno;
120 #endif
122 /****************************************************************************/
124 extern int BroadcastNameQuery(char *name, char *scope, UBYTE *address);
125 extern LONG CompareNames(STRPTR a,STRPTR b);
126 extern LONG GetTimeZoneDelta(VOID);
127 extern STRPTR amitcp_strerror(int error);
128 extern STRPTR host_strerror(int error);
129 extern time_t MakeTime(const struct tm * const tm);
130 extern ULONG GetCurrentTime(VOID);
131 extern VOID GMTime(time_t seconds,struct tm * tm);
132 #ifdef __AROS__
133 extern VOID VReportError(STRPTR fmt, IPTR *args);
134 #define ReportError(fmt, ...) do { \
135 IPTR vargs[] = { AROS_PP_VARIADIC_CAST2IPTR(__VA_ARGS__) }; \
136 VReportError(fmt, vargs); } while (0)
137 #define SPrintf(buf, fmt, ...) do { \
138 IPTR vargs[] = { AROS_PP_VARIADIC_CAST2IPTR(__VA_ARGS__) }; \
139 VSPrintf(buf, fmt, vargs); } while (0)
140 #else
141 extern VOID VARARGS68K ReportError(STRPTR fmt,...);
142 extern VOID VARARGS68K SPrintf(STRPTR buffer, STRPTR formatString,...);
143 #endif
144 extern VOID StringToUpper(STRPTR s);
146 /****************************************************************************/
148 size_t strlcpy(char *dst, const char *src, size_t siz);
149 size_t strlcat(char *dst, const char *src, size_t siz);
151 /****************************************************************************/
153 extern void smb_encrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
154 extern void smb_nt_encrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24);
156 /****************************************************************************/
158 extern VOID FreeMemory(APTR address);
159 extern APTR AllocateMemory(ULONG size);
161 #define malloc(s) AllocateMemory(s)
162 #define free(m) FreeMemory(m)
164 /****************************************************************************/
166 #undef memcpy
167 #define memcpy(to,from,size) ((void)CopyMem((APTR)(from),(APTR)(to),(ULONG)(size)))
169 /****************************************************************************/
171 #endif /* _SMBFS_H */