1/* 2 * Copyright (C) 2008 - 2010 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24#ifndef __NETSMB_SMBIO_H_INCLUDED__ 25#define __NETSMB_SMBIO_H_INCLUDED__ 26 27#include <stdint.h> 28#include <sys/types.h> 29#include <netsmb/smb_lib.h> 30 31struct open_inparms { 32 uint32_t rights; 33 uint32_t shareMode; 34 uint32_t disp; 35 uint32_t attrs; 36 uint64_t allocSize; 37 uint32_t createOptions; 38}; 39 40struct open_outparm { 41 uint64_t createTime; 42 uint64_t accessTime; 43 uint64_t writeTime; 44 uint64_t changeTime; 45 uint32_t attributes; 46 uint64_t allocationSize; 47 uint64_t fileSize; 48 uint8_t volumeGID[16]; 49 uint64_t fileInode; 50 uint32_t maxAccessRights; 51 uint32_t maxGuessAccessRights; 52}; 53 54/* Return value is -errno if < 0, otherwise the received byte count. */ 55ssize_t smbio_read(void *smbctx, int fid, uint8_t *buf, size_t bufSize); 56 57/* 58 * Perform a smb transaction call 59 * 60 * Return zero if no error or the appropriate errno. 61 */ 62int smbio_transact(void *smbctx, uint16_t *setup, int setupCnt, const char *name, 63 const uint8_t *sndPData, size_t sndPDataLen, 64 const uint8_t *sndData, size_t sndDataLen, 65 uint8_t *rcvPData, size_t *rcvPDataLen, 66 uint8_t *rcvdData, size_t *rcvDataLen); 67 68/* Open a SMB names pipe. Returns 0 on success, otherwise -errno. */ 69int smbio_open_pipe(void * smbctx, const char * pipename, int *fid); 70int smbio_close_file(void *ctx, int fid); 71int smbio_check_directory(struct smb_ctx *ctx, const void *path, 72 uint32_t /* flags2 */, uint32_t */* nt_error */); 73int smbio_ntcreatex(void *smbctx, const char *path, const char *streamName, 74 struct open_inparms *inparms, struct open_outparm *outparms, 75 int *fid); 76#endif /* __NETSMB_SMBIO_H_INCLUDED__ */ 77 78