NetworkSocketAPI
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
NetworkInterface.cpp@95:b3c679f20d13, 2016-04-19 (annotated)
- Committer:
- Christopher Haster
- Date:
- Tue Apr 19 18:24:24 2016 -0500
- Revision:
- 95:b3c679f20d13
- Parent:
- 89:b1d417383c0d
- Child:
- 99:f51358e506c1
Move to SocketAddress in gethostbyname
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Christopher Haster |
89:b1d417383c0d | 1 | /* Socket |
Christopher Haster |
89:b1d417383c0d | 2 | * Copyright (c) 2015 ARM Limited |
Christopher Haster |
89:b1d417383c0d | 3 | * |
Christopher Haster |
89:b1d417383c0d | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Christopher Haster |
89:b1d417383c0d | 5 | * you may not use this file except in compliance with the License. |
Christopher Haster |
89:b1d417383c0d | 6 | * You may obtain a copy of the License at |
Christopher Haster |
89:b1d417383c0d | 7 | * |
Christopher Haster |
89:b1d417383c0d | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Christopher Haster |
89:b1d417383c0d | 9 | * |
Christopher Haster |
89:b1d417383c0d | 10 | * Unless required by applicable law or agreed to in writing, software |
Christopher Haster |
89:b1d417383c0d | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Christopher Haster |
89:b1d417383c0d | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Christopher Haster |
89:b1d417383c0d | 13 | * See the License for the specific language governing permissions and |
Christopher Haster |
89:b1d417383c0d | 14 | * limitations under the License. |
Christopher Haster |
89:b1d417383c0d | 15 | */ |
Christopher Haster |
89:b1d417383c0d | 16 | |
Christopher Haster |
89:b1d417383c0d | 17 | #include "DnsQuery.h" |
Christopher Haster |
89:b1d417383c0d | 18 | #include "mbed.h" |
Christopher Haster |
89:b1d417383c0d | 19 | |
Christopher Haster |
95:b3c679f20d13 | 20 | int NetworkInterface::gethostbyname(SocketAddress *address, const char *name) |
Christopher Haster |
89:b1d417383c0d | 21 | { |
Christopher Haster |
95:b3c679f20d13 | 22 | char buffer[NSAPI_IP_SIZE]; |
Christopher Haster |
95:b3c679f20d13 | 23 | int err = dnsQuery(this, name, buffer); |
Christopher Haster |
95:b3c679f20d13 | 24 | if (err) { |
Christopher Haster |
95:b3c679f20d13 | 25 | return err; |
Christopher Haster |
95:b3c679f20d13 | 26 | } |
Christopher Haster |
95:b3c679f20d13 | 27 | |
Christopher Haster |
95:b3c679f20d13 | 28 | address->set_ip_address(buffer); |
Christopher Haster |
95:b3c679f20d13 | 29 | return 0; |
Christopher Haster |
89:b1d417383c0d | 30 | } |