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.
Dependencies: X_NUCLEO_IKS01A1 mbed FP MQTTPacket DnsQuery ATParser
NetworkStack.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 "DnsQuery.h" 00018 #include "mbed.h" 00019 00020 int NetworkStack::gethostbyname(SocketAddress *address, const char *name) 00021 { 00022 char buffer[NSAPI_IP_SIZE]; 00023 UDPSocket sock(this); 00024 00025 sock.set_timeout(3000); 00026 00027 int err = dnsQuery(&sock, name, buffer); 00028 00029 if (err) 00030 { 00031 return err; 00032 } 00033 00034 address->set_ip_address(buffer); 00035 return 0; 00036 } 00037 00038 int NetworkStack::setstackopt(int level, int optname, const void *optval, unsigned optlen) 00039 { 00040 return NSAPI_ERROR_UNSUPPORTED; 00041 } 00042 00043 int NetworkStack::getstackopt(int level, int optname, void *optval, unsigned *optlen) 00044 { 00045 return NSAPI_ERROR_UNSUPPORTED; 00046 } 00047 00048 int NetworkStack::setsockopt(void *handle, int level, int optname, const void *optval, unsigned optlen) 00049 { 00050 return NSAPI_ERROR_UNSUPPORTED; 00051 } 00052 00053 int NetworkStack::getsockopt(void *handle, int level, int optname, void *optval, unsigned *optlen) 00054 { 00055 return NSAPI_ERROR_UNSUPPORTED; 00056 }
Generated on Wed Jul 13 2022 20:28:49 by
1.7.2