I have fixed quite a few important bugs in this commit.
[jra/samba/.git] / source / include / smb.h
index b9dd13a802b8387162c1af883330bdbb44ca4ecd..af6e24c4aba1add34a67ff467ec1d5311f53e3e2 100644 (file)
@@ -36,8 +36,9 @@
 #define BUFFER_SIZE (0xFFFF)
 #define SAFETY_MARGIN 1024
 
-#ifndef EXTERN
-#      define EXTERN extern
+/* size of shared memory used for share mode locking */
+#ifndef SHMEM_SIZE
+#define SHMEM_SIZE 102400
 #endif
 
 #define NMB_PORT 137
 
 typedef int BOOL;
 
+/* offset in shared memory */
+typedef  int shm_offset_t;
+#define NULL_OFFSET (shm_offset_t)(0)
+
+
 /*
    Samba needs type definitions for int16, int32, uint16 and uint32.
    
@@ -95,23 +101,24 @@ typedef unsigned int uint32;
 #define DEF_CREATE_MASK (0755)
 #endif
 
-#ifndef DEFAULT_PIPE_TIMEOUT
-#define DEFAULT_PIPE_TIMEOUT 10000000 /* Ten seconds */
-#endif
-
-/* how long to wait for secondary SMB packets (seconds) */
-#define SMB_SECONDARY_WAIT 30
+/* how long to wait for secondary SMB packets (milli-seconds) */
+#define SMB_SECONDARY_WAIT (60*1000)
 
 /* debugging code */
 #ifndef SYSLOG
 #define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0)
 #else
-EXTERN int syslog_level;
+extern int syslog_level;
 
-#define DEBUG(level,body) ((DEBUGLEVEL>=(level))? \
-                                                  (syslog_level = (level), Debug1 body):0)
+#define DEBUG(level,body) ((DEBUGLEVEL>=(level))? (syslog_level = (level), Debug1 body):0)
 #endif
 
+/* this defines the error codes that receive_smb can put in smb_read_error */
+#define READ_TIMEOUT 1
+#define READ_EOF 2
+#define READ_ERROR 3
+
+
 #define DIR_STRUCT_SIZE 43
 
 /* these define all the command types recognised by the server - there
@@ -286,6 +293,7 @@ typedef struct
   int pos;
   int size;
   int mode;
+  int uid;
   char *mmap_ptr;
   int mmap_size;
   write_bmpx_struct *wbmpx_ptr;
@@ -381,6 +389,29 @@ struct server_info_struct
 };
 
 
+/* used for network interfaces */
+struct interface
+{
+       struct interface *next;
+       struct in_addr ip;
+       struct in_addr bcast;
+       struct in_addr nmask;
+};
+
+/* share mode record in shared memory */
+typedef struct
+{
+  shm_offset_t next_offset; /* offset of next record in list in shared mem */
+  int locking_version;
+  int share_mode;
+  time_t time;
+  int pid;
+  dev_t st_dev;
+  ino_t st_ino;
+  char file_name[1];   /* dynamically allocated with correct size */
+} share_mode_record;
+
+
 /* this is used for smbstatus */
 struct connect_record
 {
@@ -623,13 +654,6 @@ struct connect_record
 #define ERRHRD 0x03  /* Error is an hardware error. */
 #define ERRCMD 0xFF  /* Command was not in the "SMB" format. */
 
-/* structure used to hold the incoming hosts info */
-struct from_host {
-    char   *name;                      /* host name */
-    char   *addr;                      /* host address */
-    struct sockaddr_in *sin;           /* their side of the link */
-};
-
 #ifdef __STDC__
 int Debug1(char *, ...);
 #else
@@ -751,6 +775,7 @@ char *Strstr(char *s, char *p);
 #define SV_TYPE_DOMAIN_ENUM         0x80000000
 #define SV_TYPE_ALL                 0xFFFFFFFF  
 
+/* what server type are we currently */
 
 
 /* protocol types. It assumes that higher protocols include lower protocols
@@ -762,7 +787,7 @@ enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER};
 
 /* printing types */
 enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
-                    PRINT_QNX,PRINT_PLP};
+                    PRINT_QNX,PRINT_PLP,PRINT_LPRNG};
 
 
 /* case handling */