NetworkSocketAPI
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
NetworkInterface.cpp@99:f51358e506c1, 2016-04-19 (annotated)
- Committer:
- Christopher Haster
- Date:
- Tue Apr 19 18:25:12 2016 -0500
- Revision:
- 99:f51358e506c1
- Parent:
- 95:b3c679f20d13
Revised stack specific configurations
Adds the following functions for direct configuration of interface
- (set|get)stackopt
- (set|get)sockopt
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 | } |
Christopher Haster |
99:f51358e506c1 | 31 | |
Christopher Haster |
99:f51358e506c1 | 32 | int NetworkInterface::setstackopt(int level, int optname, const void *optval, unsigned optlen) |
Christopher Haster |
99:f51358e506c1 | 33 | { |
Christopher Haster |
99:f51358e506c1 | 34 | return NSAPI_ERROR_UNSUPPORTED; |
Christopher Haster |
99:f51358e506c1 | 35 | } |
Christopher Haster |
99:f51358e506c1 | 36 | |
Christopher Haster |
99:f51358e506c1 | 37 | int NetworkInterface::getstackopt(int level, int optname, void *optval, unsigned *optlen) |
Christopher Haster |
99:f51358e506c1 | 38 | { |
Christopher Haster |
99:f51358e506c1 | 39 | return NSAPI_ERROR_UNSUPPORTED; |
Christopher Haster |
99:f51358e506c1 | 40 | } |
Christopher Haster |
99:f51358e506c1 | 41 | |
Christopher Haster |
99:f51358e506c1 | 42 | int NetworkInterface::setsockopt(void *handle, int level, int optname, const void *optval, unsigned optlen) |
Christopher Haster |
99:f51358e506c1 | 43 | { |
Christopher Haster |
99:f51358e506c1 | 44 | return NSAPI_ERROR_UNSUPPORTED; |
Christopher Haster |
99:f51358e506c1 | 45 | } |
Christopher Haster |
99:f51358e506c1 | 46 | |
Christopher Haster |
99:f51358e506c1 | 47 | int NetworkInterface::getsockopt(void *handle, int level, int optname, void *optval, unsigned *optlen) |
Christopher Haster |
99:f51358e506c1 | 48 | { |
Christopher Haster |
99:f51358e506c1 | 49 | return NSAPI_ERROR_UNSUPPORTED; |
Christopher Haster |
99:f51358e506c1 | 50 | } |