forked from mirrors/linphone-iphone
Conflicts: Classes/ChatRoomViewController.m Classes/ContactsViewController.m Classes/HistoryDetailsViewController.h Classes/HistoryDetailsViewController.m Classes/LinphoneCoreSettingsStore.m Classes/LinphoneManager.m Classes/LinphoneUI/UIChatCell.m Classes/LinphoneUI/UIChatCell.xib Classes/LinphoneUI/UICompositeViewController.h Classes/LinphoneUI/UICompositeViewController.m Classes/PhoneMainView.m Classes/SettingsViewController.m Classes/WizardViewController.m Classes/en.lproj/ChatViewController.xib Classes/en.lproj/ContactDetailsViewController.xib Classes/en.lproj/DialerViewController.xib Classes/en.lproj/FirstLoginViewController.xib Classes/en.lproj/HistoryDetailsViewController.xib Classes/fr.lproj/ChatRoomViewController.xib Classes/fr.lproj/ChatViewController.xib Classes/fr.lproj/ContactDetailsViewController.xib Classes/fr.lproj/DialerViewController.xib Classes/fr.lproj/FirstLoginViewController.xib Classes/fr.lproj/HistoryDetailsViewController.xib Resources/en.lproj/Localizable.strings Resources/fr.lproj/Localizable.strings Resources/linphonerc-factory Resources/linphonerc-factory~ipad Settings.bundle/Advanced.plist Settings/InAppSettings.bundle/Advanced.plist Settings/InAppSettings.bundle/Call.plist Settings/InAppSettings.bundle/en.lproj/Audio.strings Settings/InAppSettings.bundle/en.lproj/Call.strings Settings/InAppSettings.bundle/en.lproj/Root.strings Settings/InAppSettings.bundle/fr.lproj/Audio.strings Settings/InAppSettings.bundle/fr.lproj/Call.strings Settings/InAppSettings.bundle/fr.lproj/Video.strings linphone-Info.plist linphone.ldb/Contents.plist linphone.ldb/Resources/Classes/ChatViewController/17/ChatViewController.xib linphone.ldb/Resources/Classes/ContactDetailsViewController/5/ContactDetailsViewController.xib linphone.ldb/Resources/Classes/DialerViewController/6/DialerViewController.xib linphone.ldb/Resources/Classes/FirstLoginViewController/6/FirstLoginViewController.xib linphone.ldb/Resources/Classes/HistoryDetailsViewController/8/HistoryDetailsViewController.xib linphone.ldb/Resources/InAppSettings.bundle/Audio/1/Audio.strings linphone.ldb/Resources/InAppSettings.bundle/Call/1/Call.strings linphone.ldb/Resources/InAppSettings.bundle/Network/1/Network.strings linphone.ldb/Resources/InAppSettings.bundle/Root/1/Root.strings linphone.ldb/Resources/Resources/Localizable/1/Localizable.strings linphone.xcodeproj/project.pbxproj submodules/linphone
103 lines
4 KiB
Objective-C
103 lines
4 KiB
Objective-C
/* Network.m
|
|
*
|
|
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#import "Network.h"
|
|
#import "BuschJaegerConfiguration.h"
|
|
#import "Utils.h"
|
|
|
|
@implementation Network
|
|
|
|
@synthesize domain;
|
|
@synthesize localAddress;
|
|
@synthesize globalAddress;
|
|
@synthesize localHistory;
|
|
@synthesize globalHistory;
|
|
@synthesize tlsCertificate;
|
|
@synthesize derCertificate;
|
|
/*
|
|
domain=abb
|
|
|
|
local-address=192.168.1.1
|
|
|
|
global-address=welcome.dyndns.org
|
|
|
|
local-history=http://192.168.1.1:8080/history.ini
|
|
|
|
global-history=http://welcome.dyndns.org:8080/history.ini
|
|
|
|
tls-certificate=http://192.168.1.1:8080/cert.pem
|
|
|
|
der-certificate=http://192.168.1.1:8080/cert.der
|
|
*/
|
|
|
|
- (void)dealloc {
|
|
[domain release];
|
|
[localAddress release];
|
|
[globalAddress release];
|
|
[localHistory release];
|
|
[globalHistory release];
|
|
[tlsCertificate release];
|
|
|
|
[super dealloc];
|
|
}
|
|
|
|
- (NSString*)write {
|
|
NSMutableString *str = [NSMutableString string];
|
|
[str appendString:[NSString stringWithFormat:@"\n[network]\n"]];
|
|
[str appendString:[NSString stringWithFormat:@"domain=%@\n", domain]];
|
|
[str appendString:[NSString stringWithFormat:@"local-address=%@\n", localAddress]];
|
|
[str appendString:[NSString stringWithFormat:@"global-address=%@\n", globalAddress]];
|
|
[str appendString:[NSString stringWithFormat:@"local-history=%@\n", localHistory]];
|
|
[str appendString:[NSString stringWithFormat:@"global-history=%@\n", globalHistory]];
|
|
[str appendString:[NSString stringWithFormat:@"tls-certificate=%@\n", tlsCertificate]];
|
|
[str appendString:[NSString stringWithFormat:@"der-certificate=%@\n", derCertificate]];
|
|
return str;
|
|
}
|
|
|
|
+ (id)parse:(NSString*)section array:(NSArray*)array {
|
|
NSString *gparam;
|
|
Network *net = nil;
|
|
if((gparam = [BuschJaegerConfiguration getRegexValue:@"^\\[(network)\\]$" data:section]) != nil) {
|
|
net = [[[Network alloc] init] autorelease];
|
|
NSString *param;
|
|
for(NSString *entry in array) {
|
|
if((param = [BuschJaegerConfiguration getRegexValue:@"^domain=(.*)$" data:entry]) != nil) {
|
|
net.domain = param;
|
|
} else if((param = [BuschJaegerConfiguration getRegexValue:@"^local-address=(.*)$" data:entry]) != nil) {
|
|
net.localAddress = param;
|
|
} else if((param = [BuschJaegerConfiguration getRegexValue:@"^global-address=(.*)$" data:entry]) != nil) {
|
|
net.globalAddress = param;
|
|
} else if((param = [BuschJaegerConfiguration getRegexValue:@"^local-history=(.*)$" data:entry]) != nil) {
|
|
net.localHistory = param;
|
|
} else if((param = [BuschJaegerConfiguration getRegexValue:@"^global-history=(.*)$" data:entry]) != nil) {
|
|
net.globalHistory = param;
|
|
} else if((param = [BuschJaegerConfiguration getRegexValue:@"^tls-certificate=(.*)$" data:entry]) != nil) {
|
|
net.tlsCertificate = param;
|
|
} else if((param = [BuschJaegerConfiguration getRegexValue:@"^der-certificate=(.*)$" data:entry]) != nil) {
|
|
net.derCertificate = param;
|
|
} else if([[entry stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] != 0){
|
|
[LinphoneLogger log:LinphoneLoggerWarning format:@"Unknown entry in %@ section: %@", section, entry];
|
|
}
|
|
}
|
|
}
|
|
|
|
return net;
|
|
}
|
|
|
|
@end
|