diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-08-06 09:29:40 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-08-07 11:16:36 +0200 |
commit | 357110c10be1e4d2e295e3362bbd484463c8af78 (patch) | |
tree | 44d95dc53f7113a708c5b137e25ec6d1882fdec2 /source3/smbd/smb2_server.c | |
parent | 5ac4d3d27448c7ccc7e0ae0b7ee3c83409821d43 (diff) | |
download | samba-357110c10be1e4d2e295e3362bbd484463c8af78.tar.gz samba-357110c10be1e4d2e295e3362bbd484463c8af78.tar.xz samba-357110c10be1e4d2e295e3362bbd484463c8af78.zip |
s3:smb2_server: introduce a smbd_smb2_dispatch_table (for now just with names)
metze
Diffstat (limited to 'source3/smbd/smb2_server.c')
-rw-r--r-- | source3/smbd/smb2_server.c | 68 |
1 files changed, 46 insertions, 22 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 625859e9148..89728928503 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -32,34 +32,58 @@ #define OUTVEC_ALLOC_SIZE (SMB2_HDR_BODY + 9) -static const char *smb2_names[] = { - "SMB2_NEGPROT", - "SMB2_SESSSETUP", - "SMB2_LOGOFF", - "SMB2_TCON", - "SMB2_TDIS", - "SMB2_CREATE", - "SMB2_CLOSE", - "SMB2_FLUSH", - "SMB2_READ", - "SMB2_WRITE", - "SMB2_LOCK", - "SMB2_IOCTL", - "SMB2_CANCEL", - "SMB2_KEEPALIVE", - "SMB2_FIND", - "SMB2_NOTIFY", - "SMB2_GETINFO", - "SMB2_SETINFO", - "SMB2_BREAK" +static const struct smbd_smb2_dispatch_table { + uint16_t opcode; + const char *name; +} smbd_smb2_table[] = { +#define _OP(o) .opcode = o, .name = #o + { + _OP(SMB2_OP_NEGPROT), + },{ + _OP(SMB2_OP_SESSSETUP), + },{ + _OP(SMB2_OP_LOGOFF), + },{ + _OP(SMB2_OP_TCON), + },{ + _OP(SMB2_OP_TDIS), + },{ + _OP(SMB2_OP_CREATE), + },{ + _OP(SMB2_OP_CLOSE), + },{ + _OP(SMB2_OP_FLUSH), + },{ + _OP(SMB2_OP_READ), + },{ + _OP(SMB2_OP_WRITE), + },{ + _OP(SMB2_OP_LOCK), + },{ + _OP(SMB2_OP_IOCTL), + },{ + _OP(SMB2_OP_CANCEL), + },{ + _OP(SMB2_OP_KEEPALIVE), + },{ + _OP(SMB2_OP_FIND), + },{ + _OP(SMB2_OP_NOTIFY), + },{ + _OP(SMB2_OP_GETINFO), + },{ + _OP(SMB2_OP_SETINFO), + },{ + _OP(SMB2_OP_BREAK), + } }; const char *smb2_opcode_name(uint16_t opcode) { - if (opcode > 0x12) { + if (opcode >= ARRAY_SIZE(smbd_smb2_table)) { return "Bad SMB2 opcode"; } - return smb2_names[opcode]; + return smbd_smb2_table[opcode].name; } static void print_req_vectors(struct smbd_smb2_request *req) |