18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * fs/cifs/rfc1002pdu.h 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Protocol Data Unit definitions for RFC 1001/1002 support 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (c) International Business Machines Corp., 2004 78c2ecf20Sopenharmony_ci * Author(s): Steve French (sfrench@us.ibm.com) 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This library is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of the GNU Lesser General Public License as published 118c2ecf20Sopenharmony_ci * by the Free Software Foundation; either version 2.1 of the License, or 128c2ecf20Sopenharmony_ci * (at your option) any later version. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * This library is distributed in the hope that it will be useful, 158c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 168c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 178c2ecf20Sopenharmony_ci * the GNU Lesser General Public License for more details. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU Lesser General Public License 208c2ecf20Sopenharmony_ci * along with this library; if not, write to the Free Software 218c2ecf20Sopenharmony_ci * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci /* RFC 1002 session packet types */ 278c2ecf20Sopenharmony_ci#define RFC1002_SESSION_MESSAGE 0x00 288c2ecf20Sopenharmony_ci#define RFC1002_SESSION_REQUEST 0x81 298c2ecf20Sopenharmony_ci#define RFC1002_POSITIVE_SESSION_RESPONSE 0x82 308c2ecf20Sopenharmony_ci#define RFC1002_NEGATIVE_SESSION_RESPONSE 0x83 318c2ecf20Sopenharmony_ci#define RFC1002_RETARGET_SESSION_RESPONSE 0x84 328c2ecf20Sopenharmony_ci#define RFC1002_SESSION_KEEP_ALIVE 0x85 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci /* RFC 1002 flags (only one defined */ 358c2ecf20Sopenharmony_ci#define RFC1002_LENGTH_EXTEND 0x80 /* high order bit of length (ie +64K) */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistruct rfc1002_session_packet { 388c2ecf20Sopenharmony_ci __u8 type; 398c2ecf20Sopenharmony_ci __u8 flags; 408c2ecf20Sopenharmony_ci __u16 length; 418c2ecf20Sopenharmony_ci union { 428c2ecf20Sopenharmony_ci struct { 438c2ecf20Sopenharmony_ci __u8 called_len; 448c2ecf20Sopenharmony_ci __u8 called_name[32]; 458c2ecf20Sopenharmony_ci __u8 scope1; /* null */ 468c2ecf20Sopenharmony_ci __u8 calling_len; 478c2ecf20Sopenharmony_ci __u8 calling_name[32]; 488c2ecf20Sopenharmony_ci __u8 scope2; /* null */ 498c2ecf20Sopenharmony_ci } __attribute__((packed)) session_req; 508c2ecf20Sopenharmony_ci struct { 518c2ecf20Sopenharmony_ci __u32 retarget_ip_addr; 528c2ecf20Sopenharmony_ci __u16 port; 538c2ecf20Sopenharmony_ci } __attribute__((packed)) retarget_resp; 548c2ecf20Sopenharmony_ci __u8 neg_ses_resp_error_code; 558c2ecf20Sopenharmony_ci /* POSITIVE_SESSION_RESPONSE packet does not include trailer. 568c2ecf20Sopenharmony_ci SESSION_KEEP_ALIVE packet also does not include a trailer. 578c2ecf20Sopenharmony_ci Trailer for the SESSION_MESSAGE packet is SMB/CIFS header */ 588c2ecf20Sopenharmony_ci } __attribute__((packed)) trailer; 598c2ecf20Sopenharmony_ci} __attribute__((packed)); 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* Negative Session Response error codes */ 628c2ecf20Sopenharmony_ci#define RFC1002_NOT_LISTENING_CALLED 0x80 /* not listening on called name */ 638c2ecf20Sopenharmony_ci#define RFC1002_NOT_LISTENING_CALLING 0x81 /* not listening on calling name */ 648c2ecf20Sopenharmony_ci#define RFC1002_NOT_PRESENT 0x82 /* called name not present */ 658c2ecf20Sopenharmony_ci#define RFC1002_INSUFFICIENT_RESOURCE 0x83 668c2ecf20Sopenharmony_ci#define RFC1002_UNSPECIFIED_ERROR 0x8F 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* RFC 1002 Datagram service packets are not defined here as they 698c2ecf20Sopenharmony_ciare not needed for the network filesystem client unless we plan on 708c2ecf20Sopenharmony_ciimplementing broadcast resolution of the server ip address (from 718c2ecf20Sopenharmony_ciserver netbios name). Currently server names are resolved only via DNS 728c2ecf20Sopenharmony_ci(tcp name) or ip address or an /etc/hosts equivalent mapping to ip address.*/ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define DEFAULT_CIFS_CALLED_NAME "*SMBSERVER " 75