Annotation of src/sys/netsmb/smb_subr.h, Revision 1.16
1.16 ! christos 1: /* $NetBSD: smb_subr.h,v 1.15 2006/05/14 21:20:13 elad Exp $ */
1.1 deberg 2:
3: /*
1.2 deberg 4: * Copyright (c) 2000-2001, Boris Popov
1.1 deberg 5: * All rights reserved.
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: * 3. All advertising materials mentioning features or use of this software
16: * must display the following acknowledgement:
17: * This product includes software developed by Boris Popov.
18: * 4. Neither the name of the author nor the names of any co-contributors
19: * may be used to endorse or promote products derived from this software
20: * without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
1.2 deberg 33: *
34: * FreeBSD: src/sys/netsmb/smb_subr.h,v 1.4 2001/12/10 08:09:48 obrien Exp
1.1 deberg 35: */
36: #ifndef _NETSMB_SMB_SUBR_H_
37: #define _NETSMB_SMB_SUBR_H_
38:
1.2 deberg 39: #ifndef _KERNEL
1.13 elad 40: #error not supposed to be exposed to userland.
41: #endif /* !_KERNEL */
1.2 deberg 42:
1.1 deberg 43: MALLOC_DECLARE(M_SMBTEMP);
44:
1.2 deberg 45: #define SMBERROR(format, args...) printf("%s: "format, __func__ ,## args)
46: #define SMBPANIC(format, args...) printf("%s: "format, __func__ ,## args)
1.1 deberg 47:
48: #ifdef SMB_SOCKET_DEBUG
1.2 deberg 49: #define SMBSDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
1.1 deberg 50: #else
51: #define SMBSDEBUG(format, args...)
52: #endif
53:
1.2 deberg 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:
1.1 deberg 60: #ifdef SMB_SOCKETDATA_DEBUG
1.16 ! christos 61: struct mbuf;
1.1 deberg 62: void m_dumpm(struct mbuf *m);
63: #else
64: #define m_dumpm(m)
65: #endif
66:
1.2 deberg 67: #ifdef __NetBSD__
68: #define SIGISMEMBER(s,n) sigismember(&(s),n)
69: #endif
70:
1.1 deberg 71: #define SMB_SIGMASK(set) \
72: (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
73: SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
74: SIGISMEMBER(set, SIGQUIT))
75:
1.15 elad 76: #define smb_suser(cred) kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER, NULL)
1.2 deberg 77:
78: /*
79: * Compatibility wrappers for simple locks
80: */
81:
82: #define smb_slock simplelock
83: #define smb_sl_init(mtx, desc) simple_lock_init(mtx)
84: #define smb_sl_destroy(mtx) /*simple_lock_destroy(mtx)*/
85: #define smb_sl_lock(mtx) simple_lock(mtx)
86: #define smb_sl_unlock(mtx) simple_unlock(mtx)
87:
88: #define SMB_STRFREE(p) do { if (p) smb_strfree(p); } while(0)
1.1 deberg 89:
90: typedef u_int16_t smb_unichar;
91: typedef smb_unichar *smb_uniptr;
92:
93: /*
94: * Crediantials of user/process being processing in the connection procedures
95: */
96: struct smb_cred {
1.2 deberg 97: /* struct thread * scr_td; */
1.14 christos 98: struct lwp * scr_l;
1.15 elad 99: kauth_cred_t scr_cred;
1.1 deberg 100: };
101:
1.7 jdolecek 102: extern const smb_unichar smb_unieol;
1.1 deberg 103:
1.2 deberg 104: struct mbchain;
105: struct smb_vc;
1.1 deberg 106: struct smb_rq;
107:
1.15 elad 108: void smb_makescred(struct smb_cred *scred, struct lwp *l,
109: kauth_cred_t cred);
1.14 christos 110: int smb_proc_intr(struct lwp *);
1.1 deberg 111: char *smb_strdup(const char *s);
112: char *smb_strdupin(char *s, int maxlen);
113: void *smb_memdupin(void *umem, int len);
114: void smb_strtouni(u_int16_t *dst, const char *src);
115: void smb_strfree(char *s);
116: void smb_memfree(void *s);
1.5 jdolecek 117: void *smb_zmalloc(unsigned long size, struct malloc_type *type, int flags);
1.2 deberg 118:
119: int smb_encrypt(const u_char *apwd, u_char *C8, u_char *RN);
120: int smb_ntencrypt(const u_char *apwd, u_char *C8, u_char *RN);
1.1 deberg 121: int smb_maperror(int eclass, int eno);
1.2 deberg 122: int smb_put_dmem(struct mbchain *mbp, struct smb_vc *vcp,
1.1 deberg 123: const char *src, int len, int caseopt);
1.2 deberg 124: int smb_put_dstring(struct mbchain *mbp, struct smb_vc *vcp,
1.1 deberg 125: const char *src, int caseopt);
126: int smb_put_string(struct smb_rq *rqp, const char *src);
1.8 jdolecek 127: #if 0
1.1 deberg 128: int smb_put_asunistring(struct smb_rq *rqp, const char *src);
1.8 jdolecek 129: #endif
1.1 deberg 130:
1.2 deberg 131: struct sockaddr *dup_sockaddr(struct sockaddr *, int);
1.1 deberg 132:
133: #endif /* !_NETSMB_SMB_SUBR_H_ */
CVSweb <webmaster@jp.NetBSD.org>