Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
NetworkInterface.cpp
00001 /* Socket 00002 * Copyright (c) 2015 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #include "netsocket/NetworkInterface.h" 00018 #include "netsocket/NetworkStack.h" 00019 #include <string.h> 00020 00021 00022 // Default network-interface state 00023 const char *NetworkInterface::get_mac_address() 00024 { 00025 return 0; 00026 } 00027 00028 const char *NetworkInterface::get_ip_address() 00029 { 00030 return 0; 00031 } 00032 00033 const char *NetworkInterface::get_netmask() 00034 { 00035 return 0; 00036 } 00037 00038 const char *NetworkInterface::get_gateway() 00039 { 00040 return 0; 00041 } 00042 00043 nsapi_error_t NetworkInterface::set_network(const char *ip_address, const char *netmask, const char *gateway) 00044 { 00045 return NSAPI_ERROR_UNSUPPORTED ; 00046 } 00047 00048 nsapi_error_t NetworkInterface::set_dhcp(bool dhcp) 00049 { 00050 if (!dhcp) { 00051 return NSAPI_ERROR_UNSUPPORTED ; 00052 } else { 00053 return NSAPI_ERROR_OK ; 00054 } 00055 } 00056 00057 // DNS operations go through the underlying stack by default 00058 nsapi_error_t NetworkInterface::gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version) 00059 { 00060 return get_stack()->gethostbyname(name, address, version); 00061 } 00062 00063 nsapi_value_or_error_t NetworkInterface::gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version) 00064 { 00065 return get_stack()->gethostbyname_async(host, callback, version); 00066 } 00067 00068 nsapi_error_t NetworkInterface::gethostbyname_async_cancel(int id) 00069 { 00070 return get_stack()->gethostbyname_async_cancel(id); 00071 } 00072 00073 nsapi_error_t NetworkInterface::add_dns_server(const SocketAddress &address) 00074 { 00075 return get_stack()->add_dns_server(address); 00076 } 00077 00078 void NetworkInterface::attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb) 00079 { 00080 } 00081 00082 nsapi_connection_status_t NetworkInterface::get_connection_status() const 00083 { 00084 return NSAPI_STATUS_ERROR_UNSUPPORTED; 00085 } 00086 00087 nsapi_error_t NetworkInterface::set_blocking(bool blocking) 00088 { 00089 return NSAPI_ERROR_UNSUPPORTED ; 00090 } 00091
Generated on Tue Jul 12 2022 12:45:36 by
