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