#include <CoreFoundation/CFBundle.h>
#include <unistd.h>
#include <sys/param.h>
#include <string.h>
#include "server.h"
#include "controller.h"
#include "mylog.h"
char * eapolclient_path = NULL;
void
load(CFBundleRef bundle, Boolean bundleVerbose)
{
Boolean ok;
uint8_t path[MAXPATHLEN];
CFURLRef url;
url = CFBundleCopyResourceURL(bundle, CFSTR("eapolclient"), NULL, NULL);
if (url == NULL) {
my_log(LOG_NOTICE,
"EAPOLController: failed to get URL for eapolclient");
return;
}
ok = CFURLGetFileSystemRepresentation(url, TRUE, path, sizeof(path));
CFRelease(url);
if (ok == FALSE) {
my_log(LOG_NOTICE,
"EAPOLController: failed to get path for eapolclient");
return;
}
eapolclient_path = strdup((const char *)path);
#if 0
S_bundle = (CFBundleRef)CFRetain(bundle);
S_verbose = bundleVerbose;
#endif 0
return;
}
void
start(const char *bundleName, const char *bundleDir)
{
if (eapolclient_path != NULL) {
if (server_active()) {
fprintf(stderr, "ipconfig server already active\n");
return;
}
_ControllerInitialize();
}
return;
}
void
prime()
{
if (eapolclient_path != NULL) {
server_init();
_ControllerBegin();
}
return;
}