]>
git.saurik.com Git - apple/security.git/blob - Keychain/ExecCLITool.h
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
18 #ifndef _H_EXECCLITOOL
19 #define _H_EXECCLITOOL
21 #include <sys/types.h>
22 #include <sys/ioctl.h>
33 #include <CoreFoundation/CFString.h>
39 ~VAArgList() { if (argv
) free(argv
); }
41 typedef const char * ArgvArgPtr
;
43 int VAArgList::set(const char *path
,va_list params
);
45 const char* const*get() { return argv
; }
47 int size() { return argn
; }
50 ArgvArgPtr
*argv
; // array for list of pointers
51 int argn
; // count of elements in argv
52 bool mSet
; // params have been passed in
61 int run(const char *toolPath
, const char *toolEnvVar
, ...);
62 void input(const char *data
,unsigned int length
);
63 void input(CFStringRef theString
, bool appendNULL
=false);
64 const char * data() const { return dataRead
; }
65 unsigned int length() const { return dataLength
; }
69 void child(const char *toolPath
, const char *toolEnvVar
, VAArgList
& arglist
);
70 void parent(pid_t pid
);
71 void parentReadOutput();
72 void parentWriteInput();
77 int stdoutpipe
[2]; // for reading data from child into parent (child uses stdout)
78 int stdinpipe
[2]; // for writing data from parent to child (child uses stdin)
81 unsigned int dataLength
;
84 unsigned int dataToWriteLength
;
86 static const unsigned int kReadBufSize
= 1024;
91 #endif //_H_EXECCLITOOL