1#ifndef _KCLIST_MAIN_H
2#define _KCLIST_MAIN_H
3
4#include <CoreFoundation/CoreFoundation.h>
5#include <IOKit/kext/OSKext.h>
6
7#include <getopt.h>
8#include <sysexits.h>
9
10#include <IOKit/kext/OSKext.h>
11
12#include "kext_tools_util.h"
13#include "kernelcache.h"
14
15#pragma mark Basic Types & Constants
16/*******************************************************************************
17* Constants
18*******************************************************************************/
19
20enum {
21    kKclistExitOK          = EX_OK,
22
23    // don't think we use it
24    kKclistExitUnspecified = 11,
25
26    // don't actually exit with this, it's just a sentinel value
27    kKclistExitHelp        = 33,
28};
29
30#pragma mark Command-line Option Definitions
31/*******************************************************************************
32* Command-line options. This data is used by getopt_long_only().
33*
34* Options common to all kext tools are in kext_tools_util.h.
35*******************************************************************************/
36
37#define kOptArch   'a'
38
39#define kOptChars  "a:hv"
40
41int longopt = 0;
42
43struct option sOptInfo[] = {
44    { kOptNameHelp,                  no_argument,        NULL,     kOptHelp },
45    { kOptNameArch,                  required_argument,  NULL,     kOptArch },
46    { kOptNameVerbose,               no_argument,        NULL,     kOptVerbose },
47
48    { NULL, 0, NULL, 0 }  // sentinel to terminate list
49};
50
51typedef struct {
52    char             * kernelcachePath;
53    CFMutableSetRef    kextIDs;
54    const NXArchInfo * archInfo;
55    Boolean            verbose;
56} KclistArgs;
57
58#pragma mark Function Prototypes
59/*******************************************************************************
60* Function Prototypes
61*******************************************************************************/
62ExitStatus readArgs(
63    int            * argc,
64    char * const  ** argv,
65    KclistArgs  * toolArgs);
66ExitStatus addBundleIdentifier(
67    KclistArgs * toolArgs,
68    char * ident);
69ExitStatus checkArgs(KclistArgs * toolArgs);
70void listPrelinkedKexts(KclistArgs * toolArgs, CFPropertyListRef kcInfoPlist);
71void printKextInfo(CFDictionaryRef kextPlist, Boolean beVerbose);
72
73void usage(UsageLevel usageLevel);
74
75#endif /* _KCLIST_MAIN_H */
76