1 /* SPDX-License-Identifier: LGPL-2.1 */
2 /*
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  *
9  */
10 
11 /* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */
12 
13 	/* RFC 1002 session packet types */
14 #define RFC1002_SESSION_MESSAGE 0x00
15 #define RFC1002_SESSION_REQUEST  0x81
16 #define RFC1002_POSITIVE_SESSION_RESPONSE 0x82
17 #define RFC1002_NEGATIVE_SESSION_RESPONSE 0x83
18 #define RFC1002_RETARGET_SESSION_RESPONSE 0x84
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 */
36 		} __attribute__((packed)) session_req;
37 		struct {
38 			__u32 retarget_ip_addr;
39 			__u16 port;
40 		} __attribute__((packed)) retarget_resp;
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 */
45 	} __attribute__((packed)) trailer;
46 } __attribute__((packed));
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      "
62