1 /* 2 * Copyright 2016, Rene Gollent, rene@gollent.com. 3 * Distributed under the terms of the MIT License. 4 */ 5 #include "LocalTargetHostInterfaceInfo.h" 6 7 #include "LocalTargetHostInterface.h" 8 9 10 LocalTargetHostInterfaceInfo::LocalTargetHostInterfaceInfo() 11 : 12 TargetHostInterfaceInfo("Local") 13 { 14 } 15 16 17 LocalTargetHostInterfaceInfo::~LocalTargetHostInterfaceInfo() 18 { 19 } 20 21 22 status_t 23 LocalTargetHostInterfaceInfo::Init() 24 { 25 return B_OK; 26 } 27 28 29 bool 30 LocalTargetHostInterfaceInfo::IsLocal() const 31 { 32 return true; 33 } 34 35 36 bool 37 LocalTargetHostInterfaceInfo::IsConfigured(Settings* settings) const 38 { 39 return true; 40 } 41 42 43 SettingsDescription* 44 LocalTargetHostInterfaceInfo::GetSettingsDescription() const 45 { 46 // the local interface requires no configuration, therefore 47 // it returns no settings description, and has no real work 48 // to do as far as settings validation is concerned. 49 return NULL; 50 } 51 52 53 status_t 54 LocalTargetHostInterfaceInfo::CreateInterface(Settings* settings, 55 TargetHostInterface*& _interface) const 56 { 57 LocalTargetHostInterface* interface 58 = new(std::nothrow) LocalTargetHostInterface; 59 if (interface == NULL) 60 return B_NO_MEMORY; 61 62 status_t error = interface->Init(settings); 63 if (error != B_OK) { 64 delete interface; 65 return error; 66 } 67 68 _interface = interface; 69 return B_OK; 70 } 71 72