33 lines
996 B
Matlab
33 lines
996 B
Matlab
|
|
#import <appvest_framework/appvest.h>
|
||
|
|
|
||
|
|
static AppVest *appvest;
|
||
|
|
|
||
|
|
const int _Init(const char *key, const char *uid) {
|
||
|
|
appvest = [[AppVest alloc] init];
|
||
|
|
NSString *key_string = key != NULL ? [NSString stringWithUTF8String:key] : nil;
|
||
|
|
NSString *uid_string = uid != NULL ? [NSString stringWithUTF8String:uid] : nil;
|
||
|
|
|
||
|
|
NSLog(@"key : %@ %@", key_string, uid_string);
|
||
|
|
|
||
|
|
int init = [appvest init: key_string uuid: uid_string];
|
||
|
|
|
||
|
|
NSLog(@"init : %d", init);
|
||
|
|
return init;
|
||
|
|
}
|
||
|
|
|
||
|
|
const char *_GetServerIPAndPort(const char * hostStr,int port){
|
||
|
|
NSString *hot_string = hostStr != NULL ? [NSString stringWithUTF8String:hostStr] : nil;
|
||
|
|
security_connection_t conn;
|
||
|
|
int rc = [appvest getServerIPAndPort:&conn host:hot_string port:port];
|
||
|
|
if (rc < 0) {
|
||
|
|
NSLog(@"invalid local port\n");
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
NSLog(@"ip : %s %d", conn.ip, conn.port);
|
||
|
|
return strdup([[NSString stringWithFormat:@"%s:%d", conn.ip
|
||
|
|
, conn.port] UTF8String]);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|