added server side SMB2 signing
[kai/samba.git] / source4 / smb_server / smb_server.h
index edd9deeafb216625a605c842633ee40544549791..ac3e0f3bd3d48da003d436768d18c487dbcd6cc4 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "libcli/raw/request.h"
 #include "libcli/raw/interfaces.h"
 #include "lib/events/events.h"
 #include "lib/socket/socket.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
 
 /*
   this header declares the core context structures associated with smb
@@ -185,13 +184,14 @@ struct smbsrv_handle {
        /*
         * the value passed over the wire
         * - 16 bit for smb
-        * - 64 bit for smb2
+        * - 32 bit for smb2
         *   Note: for SMB2 handles are 128 bit
-        *         we'll fill the 2nd 64 bit with:
+        *         we'll fill them with
+        *         - 32 bit HID
         *         - 32 bit TID
-        *         - 32 bit 0xFFFFFFFF
+        *         - 64 bit VUID
         */
-       uint64_t hid;
+       uint32_t hid;
 
        /*
         * the ntvfs handle passed to the ntvfs backend
@@ -254,8 +254,8 @@ struct smbsrv_request {
        /* the sequence number for signing */
        uint64_t seq_num;
 
-       struct request_buffer in;
-       struct request_buffer out;
+       struct smb_request_buffer in;
+       struct smb_request_buffer out;
 };
 
 enum security_types {SEC_SHARE,SEC_USER};
@@ -267,14 +267,14 @@ struct smbsrv_connection {
        /* context that has been negotiated between the client and server */
        struct {
                /* have we already done the NBT session establishment? */
-               BOOL done_nbt_session;
+               bool done_nbt_session;
        
                /* only one negprot per connection is allowed */
-               BOOL done_negprot;
+               bool done_negprot;
        
                /* multiple session setups are allowed, but some parameters are
                   ignored in any but the first */
-               BOOL done_sesssetup;
+               bool done_sesssetup;
                
                /* 
                 * Size of data we can send to client. Set
@@ -291,7 +291,7 @@ struct smbsrv_connection {
        
                /* the negotiatiated protocol */
                enum protocol_types protocol;
-       
+
                /* authentication context for multi-part negprot */
                struct auth_context *auth_context;
        
@@ -299,7 +299,7 @@ struct smbsrv_connection {
                struct cli_credentials *server_credentials;
        
                /* did we tell the client we support encrypted passwords? */
-               BOOL encrypted_passwords;
+               bool encrypted_passwords;
        
                /* Did we choose SPNEGO, or perhaps raw NTLMSSP, or even no extended security at all? */
                const char *oid;
@@ -362,7 +362,7 @@ struct smbsrv_connection {
        /* configuration parameters */
        struct {
                enum security_types security;
-               BOOL nt_status_support;
+               bool nt_status_support;
        } config;
 
        /* some statictics for the management tools */
@@ -374,15 +374,29 @@ struct smbsrv_connection {
        } statistics;
 
        struct share_context *share_context;
+
+       struct loadparm_context *lp_ctx;
+
+       bool doing_signing;
 };
 
+struct model_ops;
+struct loadparm_context;
+
+NTSTATUS smbsrv_add_socket(struct event_context *event_context,
+                          struct loadparm_context *lp_ctx,
+                              const struct model_ops *model_ops,
+                              const char *address);
+
+struct loadparm_context;
+
 #include "smb_server/smb_server_proto.h"
 #include "smb_server/smb/smb_proto.h"
 
 /* useful way of catching wct errors with file and line number */
 #define SMBSRV_CHECK_WCT(req, wcount) do { \
        if ((req)->in.wct != (wcount)) { \
-               DEBUG(1,("Unexpected WCT %d at %s(%d) - expected %d\n", \
+               DEBUG(1,("Unexpected WCT %u at %s(%d) - expected %d\n", \
                         (req)->in.wct, __FILE__, __LINE__, wcount)); \
                smbsrv_send_error(req, NT_STATUS_DOS(ERRSRV, ERRerror)); \
                return; \