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 kOptUUID 'u' 40#define kOptNameUUID "uuid" 41 42#define kOptChars "a:hvu" 43 44int longopt = 0; 45 46struct option sOptInfo[] = { 47 { kOptNameHelp, no_argument, NULL, kOptHelp }, 48 { kOptNameArch, required_argument, NULL, kOptArch }, 49 { kOptNameUUID, no_argument, NULL, kOptUUID }, 50 { kOptNameVerbose, no_argument, NULL, kOptVerbose }, 51 52 { NULL, 0, NULL, 0 } // sentinel to terminate list 53}; 54 55typedef struct { 56 char * kernelcachePath; 57 CFMutableSetRef kextIDs; 58 const NXArchInfo * archInfo; 59 Boolean verbose; 60 Boolean printUUIDs; 61} KclistArgs; 62 63#pragma mark Function Prototypes 64/******************************************************************************* 65* Function Prototypes 66*******************************************************************************/ 67ExitStatus readArgs( 68 int * argc, 69 char * const ** argv, 70 KclistArgs * toolArgs); 71ExitStatus checkArgs(KclistArgs * toolArgs); 72void listPrelinkedKexts(KclistArgs * toolArgs, CFPropertyListRef kcInfoPlist, const char *prelinkTextBytes, uint64_t prelinkTextSourceAddress, uint64_t prelinkTextSourceSize); 73void printKextInfo(CFDictionaryRef kextPlist, Boolean beVerbose, Boolean printUUIDs, const char *kextTextBytes); 74 75void usage(UsageLevel usageLevel); 76 77#endif /* _KCLIST_MAIN_H */ 78