Steve French | 929be90 | 2021-06-18 00:31:49 -0500 | [diff] [blame] | 1 | /* SPDX-License-Identifier: LGPL-2.1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Protocol Data Unit definitions for RFC 1001/1002 support |
| 5 | * |
| 6 | * Copyright (c) International Business Machines Corp., 2004 |
| 7 | * Author(s): Steve French (sfrench@us.ibm.com) |
| 8 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | /* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */ |
| 12 | |
| 13 | /* RFC 1002 session packet types */ |
Steve French | fdf7f2e | 2005-12-31 10:29:42 -0800 | [diff] [blame] | 14 | #define RFC1002_SESSION_MESSAGE 0x00 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #define RFC1002_SESSION_REQUEST 0x81 |
| 16 | #define RFC1002_POSITIVE_SESSION_RESPONSE 0x82 |
| 17 | #define RFC1002_NEGATIVE_SESSION_RESPONSE 0x83 |
Steve French | fdf7f2e | 2005-12-31 10:29:42 -0800 | [diff] [blame] | 18 | #define RFC1002_RETARGET_SESSION_RESPONSE 0x84 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #define RFC1002_SESSION_KEEP_ALIVE 0x85 |
| 20 | |
| 21 | /* RFC 1002 flags (only one defined */ |
| 22 | #define RFC1002_LENGTH_EXTEND 0x80 /* high order bit of length (ie +64K) */ |
| 23 | |
| 24 | struct rfc1002_session_packet { |
| 25 | __u8 type; |
| 26 | __u8 flags; |
| 27 | __u16 length; |
| 28 | union { |
| 29 | struct { |
| 30 | __u8 called_len; |
| 31 | __u8 called_name[32]; |
| 32 | __u8 scope1; /* null */ |
| 33 | __u8 calling_len; |
| 34 | __u8 calling_name[32]; |
| 35 | __u8 scope2; /* null */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 36 | } __attribute__((packed)) session_req; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | struct { |
| 38 | __u32 retarget_ip_addr; |
| 39 | __u16 port; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 40 | } __attribute__((packed)) retarget_resp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | __u8 neg_ses_resp_error_code; |
| 42 | /* POSITIVE_SESSION_RESPONSE packet does not include trailer. |
| 43 | SESSION_KEEP_ALIVE packet also does not include a trailer. |
| 44 | Trailer for the SESSION_MESSAGE packet is SMB/CIFS header */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 45 | } __attribute__((packed)) trailer; |
| 46 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | /* Negative Session Response error codes */ |
| 49 | #define RFC1002_NOT_LISTENING_CALLED 0x80 /* not listening on called name */ |
| 50 | #define RFC1002_NOT_LISTENING_CALLING 0x81 /* not listening on calling name */ |
| 51 | #define RFC1002_NOT_PRESENT 0x82 /* called name not present */ |
| 52 | #define RFC1002_INSUFFICIENT_RESOURCE 0x83 |
| 53 | #define RFC1002_UNSPECIFIED_ERROR 0x8F |
| 54 | |
| 55 | /* RFC 1002 Datagram service packets are not defined here as they |
| 56 | are not needed for the network filesystem client unless we plan on |
| 57 | implementing broadcast resolution of the server ip address (from |
| 58 | server netbios name). Currently server names are resolved only via DNS |
| 59 | (tcp name) or ip address or an /etc/hosts equivalent mapping to ip address.*/ |
| 60 | |
| 61 | #define DEFAULT_CIFS_CALLED_NAME "*SMBSERVER " |