The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netsmb/smb_subr.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2000-2001, Boris Popov
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. All advertising materials mentioning features or use of this software
   14  *    must display the following acknowledgement:
   15  *    This product includes software developed by Boris Popov.
   16  * 4. Neither the name of the author nor the names of any co-contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  *
   32  * $FreeBSD: releng/5.1/sys/netsmb/smb_subr.h 112888 2003-03-31 22:49:17Z jeff $
   33  */
   34 #ifndef _NETSMB_SMB_SUBR_H_
   35 #define _NETSMB_SMB_SUBR_H_
   36 
   37 #ifndef _KERNEL
   38 #error "This file shouldn't be included from userland programs"
   39 #endif
   40 
   41 #ifdef MALLOC_DECLARE
   42 MALLOC_DECLARE(M_SMBTEMP);
   43 #endif
   44 
   45 #define SMBERROR(format, args...) printf("%s: "format, __func__ ,## args)
   46 #define SMBPANIC(format, args...) printf("%s: "format, __func__ ,## args)
   47 
   48 #ifdef SMB_SOCKET_DEBUG
   49 #define SMBSDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
   50 #else
   51 #define SMBSDEBUG(format, args...)
   52 #endif
   53 
   54 #ifdef SMB_IOD_DEBUG
   55 #define SMBIODEBUG(format, args...) printf("%s: "format, __func__ ,## args)
   56 #else
   57 #define SMBIODEBUG(format, args...)
   58 #endif
   59 
   60 #ifdef SMB_SOCKETDATA_DEBUG
   61 void m_dumpm(struct mbuf *m);
   62 #else
   63 #define m_dumpm(m)
   64 #endif
   65 
   66 #define SMB_SIGMASK(set)                                                \
   67         (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) ||       \
   68          SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) ||       \
   69          SIGISMEMBER(set, SIGQUIT))
   70 
   71 #define smb_suser(cred) suser_cred(cred, 0)
   72 
   73 /*
   74  * Compatibility wrappers for simple locks
   75  */
   76 
   77 #include <sys/lock.h>
   78 #include <sys/mutex.h>
   79 
   80 #define smb_slock                       mtx
   81 #define smb_sl_init(mtx, desc)          mtx_init(mtx, desc, NULL, MTX_DEF)
   82 #define smb_sl_destroy(mtx)             mtx_destroy(mtx)
   83 #define smb_sl_lock(mtx)                mtx_lock(mtx)
   84 #define smb_sl_unlock(mtx)              mtx_unlock(mtx)
   85 
   86 
   87 #define SMB_STRFREE(p)  do { if (p) smb_strfree(p); } while(0)
   88 
   89 /*
   90  * The simple try/catch/finally interface.
   91  * With GCC it is possible to allow more than one try/finally block per
   92  * function, but we'll avoid it to maintain portability.
   93  */
   94 #define itry            {                                               \
   95                                 __label__ _finlab, _catchlab;           \
   96                                 int _tval;                              \
   97 
   98 #define icatch(var)                                                     \
   99                                 goto _finlab;                           \
  100                                 (void)&&_catchlab;                      \
  101                                 _catchlab:                              \
  102                                 var = _tval;
  103 
  104 #define ifinally                (void)&&_finlab;                        \
  105                                 _finlab:                                
  106 #define iendtry         }
  107 
  108 #define inocatch                                                        \
  109                                 goto _finlab;                           \
  110                                 (void)&&_catchlab;                      \
  111                                 _catchlab:                              \
  112 
  113 #define ithrow(t)       do {                                            \
  114                                 if ((_tval = (int)(t)) != 0)            \
  115                                         goto _catchlab;                 \
  116                         } while (0)
  117 
  118 #define ierror(t,e)     do {                                            \
  119                                 if (t) {                                \
  120                                         _tval = e;                      \
  121                                         goto _catchlab;                 \
  122                                 }                                       \
  123                         } while (0)
  124 
  125 typedef u_int16_t       smb_unichar;
  126 typedef smb_unichar     *smb_uniptr;
  127 
  128 /*
  129  * Crediantials of user/process being processing in the connection procedures
  130  */
  131 struct smb_cred {
  132         struct thread * scr_td;
  133         struct ucred *  scr_cred;
  134 };
  135 
  136 extern smb_unichar smb_unieol;
  137 
  138 struct mbchain;
  139 struct smb_vc;
  140 struct smb_rq;
  141 
  142 void smb_makescred(struct smb_cred *scred, struct thread *td, struct ucred *cred);
  143 int  smb_td_intr(struct thread *);
  144 char *smb_strdup(const char *s);
  145 void *smb_memdup(const void *umem, int len);
  146 char *smb_strdupin(char *s, int maxlen);
  147 void *smb_memdupin(void *umem, int len);
  148 void smb_strtouni(u_int16_t *dst, const char *src);
  149 void smb_strfree(char *s);
  150 void smb_memfree(void *s);
  151 void *smb_zmalloc(unsigned long size, struct malloc_type *type, int flags);
  152 
  153 int  smb_encrypt(const u_char *apwd, u_char *C8, u_char *RN);
  154 int  smb_ntencrypt(const u_char *apwd, u_char *C8, u_char *RN);
  155 int  smb_maperror(int eclass, int eno);
  156 int  smb_put_dmem(struct mbchain *mbp, struct smb_vc *vcp,
  157         const char *src, int len, int caseopt);
  158 int  smb_put_dstring(struct mbchain *mbp, struct smb_vc *vcp,
  159         const char *src, int caseopt);
  160 int  smb_put_string(struct smb_rq *rqp, const char *src);
  161 int  smb_put_asunistring(struct smb_rq *rqp, const char *src);
  162 
  163 #endif /* !_NETSMB_SMB_SUBR_H_ */

Cache object: caef1149e05baf1a5ab90ccf15ee4703


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.