^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * fs/cifs/rfc1002pdu.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Protocol Data Unit definitions for RFC 1001/1002 support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) International Business Machines Corp., 2004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Author(s): Steve French (sfrench@us.ibm.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * This library is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * it under the terms of the GNU Lesser General Public License as published
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * by the Free Software Foundation; either version 2.1 of the License, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * (at your option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * This library is distributed in the hope that it will be useful,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * but WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * the GNU Lesser General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * You should have received a copy of the GNU Lesser General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * along with this library; if not, write to the Free Software
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* RFC 1002 session packet types */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define RFC1002_SESSION_MESSAGE 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define RFC1002_SESSION_REQUEST 0x81
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define RFC1002_POSITIVE_SESSION_RESPONSE 0x82
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define RFC1002_NEGATIVE_SESSION_RESPONSE 0x83
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define RFC1002_RETARGET_SESSION_RESPONSE 0x84
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define RFC1002_SESSION_KEEP_ALIVE 0x85
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* RFC 1002 flags (only one defined */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define RFC1002_LENGTH_EXTEND 0x80 /* high order bit of length (ie +64K) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct rfc1002_session_packet {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) __u8 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) __u8 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) __u16 length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) __u8 called_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) __u8 called_name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) __u8 scope1; /* null */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) __u8 calling_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) __u8 calling_name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) __u8 scope2; /* null */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) } __attribute__((packed)) session_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) __u32 retarget_ip_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) __u16 port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) } __attribute__((packed)) retarget_resp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) __u8 neg_ses_resp_error_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* POSITIVE_SESSION_RESPONSE packet does not include trailer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) SESSION_KEEP_ALIVE packet also does not include a trailer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) Trailer for the SESSION_MESSAGE packet is SMB/CIFS header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) } __attribute__((packed)) trailer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) } __attribute__((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* Negative Session Response error codes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define RFC1002_NOT_LISTENING_CALLED 0x80 /* not listening on called name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define RFC1002_NOT_LISTENING_CALLING 0x81 /* not listening on calling name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define RFC1002_NOT_PRESENT 0x82 /* called name not present */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define RFC1002_INSUFFICIENT_RESOURCE 0x83
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define RFC1002_UNSPECIFIED_ERROR 0x8F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) /* RFC 1002 Datagram service packets are not defined here as they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) are not needed for the network filesystem client unless we plan on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) implementing broadcast resolution of the server ip address (from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) server netbios name). Currently server names are resolved only via DNS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) (tcp name) or ip address or an /etc/hosts equivalent mapping to ip address.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define DEFAULT_CIFS_CALLED_NAME "*SMBSERVER "