Ram Gandikota
/
ABCD
A metronome using the FRDM K64F board
mbed-client/test/mbedclient/utest/stub/common_stub.cpp@0:a7a43371b306, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:40:18 2017 +0000
- Revision:
- 0:a7a43371b306
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:a7a43371b306 | 1 | /* |
ram54288 | 0:a7a43371b306 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
ram54288 | 0:a7a43371b306 | 3 | * SPDX-License-Identifier: Apache-2.0 |
ram54288 | 0:a7a43371b306 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
ram54288 | 0:a7a43371b306 | 5 | * not use this file except in compliance with the License. |
ram54288 | 0:a7a43371b306 | 6 | * You may obtain a copy of the License at |
ram54288 | 0:a7a43371b306 | 7 | * |
ram54288 | 0:a7a43371b306 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ram54288 | 0:a7a43371b306 | 9 | * |
ram54288 | 0:a7a43371b306 | 10 | * Unless required by applicable law or agreed to in writing, software |
ram54288 | 0:a7a43371b306 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
ram54288 | 0:a7a43371b306 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ram54288 | 0:a7a43371b306 | 13 | * See the License for the specific language governing permissions and |
ram54288 | 0:a7a43371b306 | 14 | * limitations under the License. |
ram54288 | 0:a7a43371b306 | 15 | */ |
ram54288 | 0:a7a43371b306 | 16 | #include "common_stub.h" |
ram54288 | 0:a7a43371b306 | 17 | #include "sn_grs.h" |
ram54288 | 0:a7a43371b306 | 18 | #include <sys/socket.h> |
ram54288 | 0:a7a43371b306 | 19 | |
ram54288 | 0:a7a43371b306 | 20 | socket_error_t common_stub::error; |
ram54288 | 0:a7a43371b306 | 21 | socket_event_t * common_stub::event; |
ram54288 | 0:a7a43371b306 | 22 | socket_addr * common_stub::addr; |
ram54288 | 0:a7a43371b306 | 23 | void * common_stub::void_value; |
ram54288 | 0:a7a43371b306 | 24 | bool common_stub::visited; |
ram54288 | 0:a7a43371b306 | 25 | bool common_stub::bool_value; |
ram54288 | 0:a7a43371b306 | 26 | int common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 27 | int common_stub::int2_value; |
ram54288 | 0:a7a43371b306 | 28 | addrinfo* common_stub::addrinfo; |
ram54288 | 0:a7a43371b306 | 29 | uint16_t common_stub::uint_value; |
ram54288 | 0:a7a43371b306 | 30 | sn_coap_hdr_s *common_stub::coap_header; |
ram54288 | 0:a7a43371b306 | 31 | sn_nsdl_dynamic_resource_parameters_s *common_stub::resource; |
ram54288 | 0:a7a43371b306 | 32 | pthread_t common_stub::thread; |
ram54288 | 0:a7a43371b306 | 33 | const char* common_stub::char_value; |
ram54288 | 0:a7a43371b306 | 34 | |
ram54288 | 0:a7a43371b306 | 35 | using namespace mbed; |
ram54288 | 0:a7a43371b306 | 36 | using namespace mbed::Sockets::v0; |
ram54288 | 0:a7a43371b306 | 37 | |
ram54288 | 0:a7a43371b306 | 38 | void common_stub::clear() |
ram54288 | 0:a7a43371b306 | 39 | { |
ram54288 | 0:a7a43371b306 | 40 | int_value = -1; |
ram54288 | 0:a7a43371b306 | 41 | int2_value = -1; |
ram54288 | 0:a7a43371b306 | 42 | uint_value = 0; |
ram54288 | 0:a7a43371b306 | 43 | error = SOCKET_ERROR_NONE; |
ram54288 | 0:a7a43371b306 | 44 | event = NULL; |
ram54288 | 0:a7a43371b306 | 45 | addr = NULL; |
ram54288 | 0:a7a43371b306 | 46 | void_value = NULL; |
ram54288 | 0:a7a43371b306 | 47 | visited = false; |
ram54288 | 0:a7a43371b306 | 48 | bool_value= false; |
ram54288 | 0:a7a43371b306 | 49 | coap_header = NULL; |
ram54288 | 0:a7a43371b306 | 50 | resource = NULL; |
ram54288 | 0:a7a43371b306 | 51 | addrinfo = NULL; |
ram54288 | 0:a7a43371b306 | 52 | char_value = NULL; |
ram54288 | 0:a7a43371b306 | 53 | } |
ram54288 | 0:a7a43371b306 | 54 | |
ram54288 | 0:a7a43371b306 | 55 | UDPSocket::UDPSocket(socket_stack_t stack) :Socket(stack) |
ram54288 | 0:a7a43371b306 | 56 | { |
ram54288 | 0:a7a43371b306 | 57 | } |
ram54288 | 0:a7a43371b306 | 58 | |
ram54288 | 0:a7a43371b306 | 59 | UDPSocket::~UDPSocket() |
ram54288 | 0:a7a43371b306 | 60 | { |
ram54288 | 0:a7a43371b306 | 61 | } |
ram54288 | 0:a7a43371b306 | 62 | |
ram54288 | 0:a7a43371b306 | 63 | socket_error_t UDPSocket::connect(const SocketAddr *, const uint16_t ) |
ram54288 | 0:a7a43371b306 | 64 | { |
ram54288 | 0:a7a43371b306 | 65 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 66 | } |
ram54288 | 0:a7a43371b306 | 67 | |
ram54288 | 0:a7a43371b306 | 68 | //SocketAddr |
ram54288 | 0:a7a43371b306 | 69 | |
ram54288 | 0:a7a43371b306 | 70 | void SocketAddr::setAddr(const struct socket_addr *) |
ram54288 | 0:a7a43371b306 | 71 | { |
ram54288 | 0:a7a43371b306 | 72 | } |
ram54288 | 0:a7a43371b306 | 73 | |
ram54288 | 0:a7a43371b306 | 74 | void SocketAddr::setAddr(const SocketAddr *) |
ram54288 | 0:a7a43371b306 | 75 | { |
ram54288 | 0:a7a43371b306 | 76 | } |
ram54288 | 0:a7a43371b306 | 77 | |
ram54288 | 0:a7a43371b306 | 78 | bool SocketAddr::SocketAddr::is_v4() |
ram54288 | 0:a7a43371b306 | 79 | { |
ram54288 | 0:a7a43371b306 | 80 | return common_stub::bool_value; |
ram54288 | 0:a7a43371b306 | 81 | } |
ram54288 | 0:a7a43371b306 | 82 | |
ram54288 | 0:a7a43371b306 | 83 | void mbed::Ticker::detach() |
ram54288 | 0:a7a43371b306 | 84 | { |
ram54288 | 0:a7a43371b306 | 85 | common_stub::visited = true; |
ram54288 | 0:a7a43371b306 | 86 | } |
ram54288 | 0:a7a43371b306 | 87 | |
ram54288 | 0:a7a43371b306 | 88 | |
ram54288 | 0:a7a43371b306 | 89 | // SN_NSDL_LIB |
ram54288 | 0:a7a43371b306 | 90 | |
ram54288 | 0:a7a43371b306 | 91 | struct nsdl_s *sn_nsdl_init (uint8_t (*sn_nsdl_tx_cb)(struct nsdl_s *, sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *), |
ram54288 | 0:a7a43371b306 | 92 | uint8_t (*sn_nsdl_rx_cb)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *), |
ram54288 | 0:a7a43371b306 | 93 | void *(*sn_nsdl_alloc)(uint16_t),void (*sn_nsdl_free)(void *)) |
ram54288 | 0:a7a43371b306 | 94 | { |
ram54288 | 0:a7a43371b306 | 95 | return NULL; |
ram54288 | 0:a7a43371b306 | 96 | } |
ram54288 | 0:a7a43371b306 | 97 | |
ram54288 | 0:a7a43371b306 | 98 | uint16_t sn_nsdl_register_endpoint(struct nsdl_s *, sn_nsdl_ep_parameters_s *) |
ram54288 | 0:a7a43371b306 | 99 | { |
ram54288 | 0:a7a43371b306 | 100 | return common_stub::uint_value; |
ram54288 | 0:a7a43371b306 | 101 | } |
ram54288 | 0:a7a43371b306 | 102 | |
ram54288 | 0:a7a43371b306 | 103 | uint16_t sn_nsdl_unregister_endpoint(struct nsdl_s *) |
ram54288 | 0:a7a43371b306 | 104 | { |
ram54288 | 0:a7a43371b306 | 105 | return common_stub::uint_value; |
ram54288 | 0:a7a43371b306 | 106 | } |
ram54288 | 0:a7a43371b306 | 107 | |
ram54288 | 0:a7a43371b306 | 108 | uint16_t sn_nsdl_update_registration(struct nsdl_s *,uint8_t *, uint8_t) |
ram54288 | 0:a7a43371b306 | 109 | { |
ram54288 | 0:a7a43371b306 | 110 | return common_stub::uint_value; |
ram54288 | 0:a7a43371b306 | 111 | } |
ram54288 | 0:a7a43371b306 | 112 | |
ram54288 | 0:a7a43371b306 | 113 | uint16_t sn_nsdl_send_observation_notification_with_uri_path(struct nsdl_s *, uint8_t *, uint8_t, |
ram54288 | 0:a7a43371b306 | 114 | uint8_t *, uint16_t, |
ram54288 | 0:a7a43371b306 | 115 | uint8_t *, uint8_t, |
ram54288 | 0:a7a43371b306 | 116 | sn_coap_msg_type_e , uint8_t, |
ram54288 | 0:a7a43371b306 | 117 | uint8_t *, uint16_t) |
ram54288 | 0:a7a43371b306 | 118 | { |
ram54288 | 0:a7a43371b306 | 119 | return common_stub::uint_value; |
ram54288 | 0:a7a43371b306 | 120 | } |
ram54288 | 0:a7a43371b306 | 121 | uint16_t sn_nsdl_send_observation_notification(struct nsdl_s *, uint8_t *, uint8_t, |
ram54288 | 0:a7a43371b306 | 122 | uint8_t *, uint16_t, |
ram54288 | 0:a7a43371b306 | 123 | uint8_t *, uint8_t, |
ram54288 | 0:a7a43371b306 | 124 | sn_coap_msg_type_e , uint8_t) |
ram54288 | 0:a7a43371b306 | 125 | { |
ram54288 | 0:a7a43371b306 | 126 | return common_stub::uint_value; |
ram54288 | 0:a7a43371b306 | 127 | } |
ram54288 | 0:a7a43371b306 | 128 | |
ram54288 | 0:a7a43371b306 | 129 | int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *, uint8_t *, uint8_t) |
ram54288 | 0:a7a43371b306 | 130 | { |
ram54288 | 0:a7a43371b306 | 131 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 132 | } |
ram54288 | 0:a7a43371b306 | 133 | |
ram54288 | 0:a7a43371b306 | 134 | int8_t sn_nsdl_destroy(struct nsdl_s *handle) |
ram54288 | 0:a7a43371b306 | 135 | { |
ram54288 | 0:a7a43371b306 | 136 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 137 | } |
ram54288 | 0:a7a43371b306 | 138 | |
ram54288 | 0:a7a43371b306 | 139 | sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *, sn_coap_hdr_s *, uint8_t ) |
ram54288 | 0:a7a43371b306 | 140 | { |
ram54288 | 0:a7a43371b306 | 141 | return common_stub::coap_header; |
ram54288 | 0:a7a43371b306 | 142 | } |
ram54288 | 0:a7a43371b306 | 143 | |
ram54288 | 0:a7a43371b306 | 144 | sn_nsdl_dynamic_resource_parameters_s *sn_nsdl_get_resource(struct nsdl_s *, uint16_t, uint8_t *) |
ram54288 | 0:a7a43371b306 | 145 | { |
ram54288 | 0:a7a43371b306 | 146 | return common_stub::resource; |
ram54288 | 0:a7a43371b306 | 147 | } |
ram54288 | 0:a7a43371b306 | 148 | |
ram54288 | 0:a7a43371b306 | 149 | int8_t sn_nsdl_process_coap(struct nsdl_s *, uint8_t *, uint16_t , sn_nsdl_addr_s *) |
ram54288 | 0:a7a43371b306 | 150 | { |
ram54288 | 0:a7a43371b306 | 151 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 152 | } |
ram54288 | 0:a7a43371b306 | 153 | |
ram54288 | 0:a7a43371b306 | 154 | int8_t sn_nsdl_exec(struct nsdl_s *, uint32_t) |
ram54288 | 0:a7a43371b306 | 155 | { |
ram54288 | 0:a7a43371b306 | 156 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 157 | } |
ram54288 | 0:a7a43371b306 | 158 | |
ram54288 | 0:a7a43371b306 | 159 | int8_t sn_nsdl_set_retransmission_parameters(struct nsdl_s *, uint8_t, uint8_t) |
ram54288 | 0:a7a43371b306 | 160 | { |
ram54288 | 0:a7a43371b306 | 161 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 162 | } |
ram54288 | 0:a7a43371b306 | 163 | |
ram54288 | 0:a7a43371b306 | 164 | void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *, sn_coap_hdr_s *header) |
ram54288 | 0:a7a43371b306 | 165 | { |
ram54288 | 0:a7a43371b306 | 166 | if(header && header != common_stub::coap_header){ |
ram54288 | 0:a7a43371b306 | 167 | if( header->options_list_ptr){ |
ram54288 | 0:a7a43371b306 | 168 | free(header->options_list_ptr); |
ram54288 | 0:a7a43371b306 | 169 | header->options_list_ptr = NULL; |
ram54288 | 0:a7a43371b306 | 170 | } |
ram54288 | 0:a7a43371b306 | 171 | free(header); |
ram54288 | 0:a7a43371b306 | 172 | header = NULL; |
ram54288 | 0:a7a43371b306 | 173 | } |
ram54288 | 0:a7a43371b306 | 174 | } |
ram54288 | 0:a7a43371b306 | 175 | |
ram54288 | 0:a7a43371b306 | 176 | sn_coap_options_list_s *sn_nsdl_alloc_options_list(struct nsdl_s *handle, sn_coap_hdr_s *coap_msg_ptr) |
ram54288 | 0:a7a43371b306 | 177 | { |
ram54288 | 0:a7a43371b306 | 178 | if( common_stub::coap_header ) { |
ram54288 | 0:a7a43371b306 | 179 | return common_stub::coap_header->options_list_ptr; |
ram54288 | 0:a7a43371b306 | 180 | } |
ram54288 | 0:a7a43371b306 | 181 | return NULL; |
ram54288 | 0:a7a43371b306 | 182 | } |
ram54288 | 0:a7a43371b306 | 183 | |
ram54288 | 0:a7a43371b306 | 184 | int8_t sn_nsdl_create_resource(struct nsdl_s *, sn_nsdl_dynamic_resource_parameters_s *) |
ram54288 | 0:a7a43371b306 | 185 | { |
ram54288 | 0:a7a43371b306 | 186 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 187 | } |
ram54288 | 0:a7a43371b306 | 188 | |
ram54288 | 0:a7a43371b306 | 189 | int8_t sn_nsdl_delete_resource(struct nsdl_s *, uint16_t , uint8_t *) |
ram54288 | 0:a7a43371b306 | 190 | { |
ram54288 | 0:a7a43371b306 | 191 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 192 | } |
ram54288 | 0:a7a43371b306 | 193 | |
ram54288 | 0:a7a43371b306 | 194 | int8_t sn_nsdl_put_resource(struct nsdl_s *handle, sn_nsdl_dynamic_resource_parameters_s *res) |
ram54288 | 0:a7a43371b306 | 195 | { |
ram54288 | 0:a7a43371b306 | 196 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 197 | } |
ram54288 | 0:a7a43371b306 | 198 | |
ram54288 | 0:a7a43371b306 | 199 | int8_t sn_nsdl_pop_resource(struct nsdl_s *handle, sn_nsdl_dynamic_resource_parameters_s *res) |
ram54288 | 0:a7a43371b306 | 200 | { |
ram54288 | 0:a7a43371b306 | 201 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 202 | } |
ram54288 | 0:a7a43371b306 | 203 | |
ram54288 | 0:a7a43371b306 | 204 | int8_t sn_nsdl_send_coap_message(struct nsdl_s *, sn_nsdl_addr_s *, sn_coap_hdr_s *) |
ram54288 | 0:a7a43371b306 | 205 | { |
ram54288 | 0:a7a43371b306 | 206 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 207 | } |
ram54288 | 0:a7a43371b306 | 208 | |
ram54288 | 0:a7a43371b306 | 209 | int8_t sn_nsdl_update_resource(struct nsdl_s *, sn_nsdl_dynamic_resource_parameters_s *) |
ram54288 | 0:a7a43371b306 | 210 | { |
ram54288 | 0:a7a43371b306 | 211 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 212 | } |
ram54288 | 0:a7a43371b306 | 213 | |
ram54288 | 0:a7a43371b306 | 214 | int8_t set_NSP_address(struct nsdl_s *, uint8_t *, uint8_t, uint16_t, sn_nsdl_addr_type_e) |
ram54288 | 0:a7a43371b306 | 215 | { |
ram54288 | 0:a7a43371b306 | 216 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 217 | } |
ram54288 | 0:a7a43371b306 | 218 | |
ram54288 | 0:a7a43371b306 | 219 | uint16_t sn_nsdl_oma_bootstrap(struct nsdl_s *, sn_nsdl_addr_s *, |
ram54288 | 0:a7a43371b306 | 220 | sn_nsdl_ep_parameters_s *, |
ram54288 | 0:a7a43371b306 | 221 | sn_nsdl_bs_ep_info_t *) |
ram54288 | 0:a7a43371b306 | 222 | { |
ram54288 | 0:a7a43371b306 | 223 | return common_stub::uint_value; |
ram54288 | 0:a7a43371b306 | 224 | } |
ram54288 | 0:a7a43371b306 | 225 | |
ram54288 | 0:a7a43371b306 | 226 | //Coap Headers |
ram54288 | 0:a7a43371b306 | 227 | |
ram54288 | 0:a7a43371b306 | 228 | sn_coap_hdr_s *sn_coap_build_response(struct coap_s *, sn_coap_hdr_s *, uint8_t ) |
ram54288 | 0:a7a43371b306 | 229 | { |
ram54288 | 0:a7a43371b306 | 230 | return common_stub::coap_header; |
ram54288 | 0:a7a43371b306 | 231 | } |
ram54288 | 0:a7a43371b306 | 232 | |
ram54288 | 0:a7a43371b306 | 233 | void sn_coap_parser_release_allocated_coap_msg_mem(struct coap_s *, sn_coap_hdr_s *) |
ram54288 | 0:a7a43371b306 | 234 | { |
ram54288 | 0:a7a43371b306 | 235 | } |
ram54288 | 0:a7a43371b306 | 236 | |
ram54288 | 0:a7a43371b306 | 237 | int8_t sn_coap_protocol_set_retransmission_parameters(uint8_t, uint8_t) |
ram54288 | 0:a7a43371b306 | 238 | { |
ram54288 | 0:a7a43371b306 | 239 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 240 | } |
ram54288 | 0:a7a43371b306 | 241 | |
ram54288 | 0:a7a43371b306 | 242 | // IP6String.h |
ram54288 | 0:a7a43371b306 | 243 | uint_fast8_t ip6tos(const void *ip6addr, char *p) |
ram54288 | 0:a7a43371b306 | 244 | { |
ram54288 | 0:a7a43371b306 | 245 | // Just set at least something there, or the valgrind will scream when |
ram54288 | 0:a7a43371b306 | 246 | // client tries to use the result string. |
ram54288 | 0:a7a43371b306 | 247 | p[0] = '\0'; |
ram54288 | 0:a7a43371b306 | 248 | return 0; |
ram54288 | 0:a7a43371b306 | 249 | } |
ram54288 | 0:a7a43371b306 | 250 | |
ram54288 | 0:a7a43371b306 | 251 | //Socket |
ram54288 | 0:a7a43371b306 | 252 | Socket::Socket(const socket_stack_t ) : _irq(this) |
ram54288 | 0:a7a43371b306 | 253 | { |
ram54288 | 0:a7a43371b306 | 254 | _socket.api = NULL; |
ram54288 | 0:a7a43371b306 | 255 | } |
ram54288 | 0:a7a43371b306 | 256 | |
ram54288 | 0:a7a43371b306 | 257 | Socket::~Socket() |
ram54288 | 0:a7a43371b306 | 258 | { |
ram54288 | 0:a7a43371b306 | 259 | } |
ram54288 | 0:a7a43371b306 | 260 | |
ram54288 | 0:a7a43371b306 | 261 | socket_error_t Socket::open(const socket_address_family_t , const socket_proto_family_t ) |
ram54288 | 0:a7a43371b306 | 262 | { |
ram54288 | 0:a7a43371b306 | 263 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 264 | } |
ram54288 | 0:a7a43371b306 | 265 | |
ram54288 | 0:a7a43371b306 | 266 | bool Socket::error_check(socket_error_t ) |
ram54288 | 0:a7a43371b306 | 267 | { |
ram54288 | 0:a7a43371b306 | 268 | return common_stub::bool_value; |
ram54288 | 0:a7a43371b306 | 269 | } |
ram54288 | 0:a7a43371b306 | 270 | |
ram54288 | 0:a7a43371b306 | 271 | void Socket::_eventHandler(struct socket_event *) |
ram54288 | 0:a7a43371b306 | 272 | { |
ram54288 | 0:a7a43371b306 | 273 | } |
ram54288 | 0:a7a43371b306 | 274 | |
ram54288 | 0:a7a43371b306 | 275 | void Socket::setOnError(const ErrorHandler_t &) |
ram54288 | 0:a7a43371b306 | 276 | { |
ram54288 | 0:a7a43371b306 | 277 | } |
ram54288 | 0:a7a43371b306 | 278 | |
ram54288 | 0:a7a43371b306 | 279 | void Socket::setOnReadable(const ReadableHandler_t &) |
ram54288 | 0:a7a43371b306 | 280 | { |
ram54288 | 0:a7a43371b306 | 281 | } |
ram54288 | 0:a7a43371b306 | 282 | |
ram54288 | 0:a7a43371b306 | 283 | void Socket::setOnSent(const SentHandler_t & ) |
ram54288 | 0:a7a43371b306 | 284 | { |
ram54288 | 0:a7a43371b306 | 285 | } |
ram54288 | 0:a7a43371b306 | 286 | |
ram54288 | 0:a7a43371b306 | 287 | void Socket::_nvEventHandler(void * ) |
ram54288 | 0:a7a43371b306 | 288 | { |
ram54288 | 0:a7a43371b306 | 289 | } |
ram54288 | 0:a7a43371b306 | 290 | |
ram54288 | 0:a7a43371b306 | 291 | socket_error_t Socket::getLocalAddr(SocketAddr *) const |
ram54288 | 0:a7a43371b306 | 292 | { |
ram54288 | 0:a7a43371b306 | 293 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 294 | } |
ram54288 | 0:a7a43371b306 | 295 | |
ram54288 | 0:a7a43371b306 | 296 | socket_error_t Socket::getLocalPort(uint16_t *) const |
ram54288 | 0:a7a43371b306 | 297 | { |
ram54288 | 0:a7a43371b306 | 298 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 299 | } |
ram54288 | 0:a7a43371b306 | 300 | |
ram54288 | 0:a7a43371b306 | 301 | socket_error_t Socket::getRemoteAddr(SocketAddr *) const |
ram54288 | 0:a7a43371b306 | 302 | { |
ram54288 | 0:a7a43371b306 | 303 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 304 | } |
ram54288 | 0:a7a43371b306 | 305 | |
ram54288 | 0:a7a43371b306 | 306 | socket_error_t Socket::getRemotePort(uint16_t *) const |
ram54288 | 0:a7a43371b306 | 307 | { |
ram54288 | 0:a7a43371b306 | 308 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 309 | } |
ram54288 | 0:a7a43371b306 | 310 | |
ram54288 | 0:a7a43371b306 | 311 | socket_error_t Socket::resolve(const char* , const DNSHandler_t & ) |
ram54288 | 0:a7a43371b306 | 312 | { |
ram54288 | 0:a7a43371b306 | 313 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 314 | } |
ram54288 | 0:a7a43371b306 | 315 | |
ram54288 | 0:a7a43371b306 | 316 | socket_error_t Socket::bind(const char * , const uint16_t ) |
ram54288 | 0:a7a43371b306 | 317 | { |
ram54288 | 0:a7a43371b306 | 318 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 319 | } |
ram54288 | 0:a7a43371b306 | 320 | socket_error_t Socket::bind(const SocketAddr * , const uint16_t ) |
ram54288 | 0:a7a43371b306 | 321 | { |
ram54288 | 0:a7a43371b306 | 322 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 323 | } |
ram54288 | 0:a7a43371b306 | 324 | |
ram54288 | 0:a7a43371b306 | 325 | socket_error_t Socket::close() |
ram54288 | 0:a7a43371b306 | 326 | { |
ram54288 | 0:a7a43371b306 | 327 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 328 | } |
ram54288 | 0:a7a43371b306 | 329 | |
ram54288 | 0:a7a43371b306 | 330 | socket_error_t Socket::recv(void * , size_t *) |
ram54288 | 0:a7a43371b306 | 331 | { |
ram54288 | 0:a7a43371b306 | 332 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 333 | } |
ram54288 | 0:a7a43371b306 | 334 | socket_error_t Socket::recv_from(void * , size_t *, SocketAddr *, uint16_t *) |
ram54288 | 0:a7a43371b306 | 335 | { |
ram54288 | 0:a7a43371b306 | 336 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 337 | } |
ram54288 | 0:a7a43371b306 | 338 | |
ram54288 | 0:a7a43371b306 | 339 | socket_error_t Socket::send(const void * , const size_t ) |
ram54288 | 0:a7a43371b306 | 340 | { |
ram54288 | 0:a7a43371b306 | 341 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 342 | } |
ram54288 | 0:a7a43371b306 | 343 | socket_error_t Socket::send_to(const void * , const size_t , const SocketAddr *, uint16_t ) |
ram54288 | 0:a7a43371b306 | 344 | { |
ram54288 | 0:a7a43371b306 | 345 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 346 | } |
ram54288 | 0:a7a43371b306 | 347 | |
ram54288 | 0:a7a43371b306 | 348 | bool Socket::isConnected() const { |
ram54288 | 0:a7a43371b306 | 349 | return common_stub::error; |
ram54288 | 0:a7a43371b306 | 350 | } |
ram54288 | 0:a7a43371b306 | 351 | |
ram54288 | 0:a7a43371b306 | 352 | // pthread |
ram54288 | 0:a7a43371b306 | 353 | int pthread_equal (pthread_t , pthread_t ) __THROW |
ram54288 | 0:a7a43371b306 | 354 | { |
ram54288 | 0:a7a43371b306 | 355 | return common_stub::int2_value; |
ram54288 | 0:a7a43371b306 | 356 | } |
ram54288 | 0:a7a43371b306 | 357 | |
ram54288 | 0:a7a43371b306 | 358 | pthread_t pthread_self (void) __THROW |
ram54288 | 0:a7a43371b306 | 359 | { |
ram54288 | 0:a7a43371b306 | 360 | return common_stub::thread; |
ram54288 | 0:a7a43371b306 | 361 | } |
ram54288 | 0:a7a43371b306 | 362 | |
ram54288 | 0:a7a43371b306 | 363 | int pthread_detach (pthread_t) __THROW |
ram54288 | 0:a7a43371b306 | 364 | { |
ram54288 | 0:a7a43371b306 | 365 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 366 | } |
ram54288 | 0:a7a43371b306 | 367 | |
ram54288 | 0:a7a43371b306 | 368 | int pthread_create (pthread_t * , |
ram54288 | 0:a7a43371b306 | 369 | const pthread_attr_t *, |
ram54288 | 0:a7a43371b306 | 370 | void *(*__start_routine) (void *), |
ram54288 | 0:a7a43371b306 | 371 | void *) __THROWNL |
ram54288 | 0:a7a43371b306 | 372 | { |
ram54288 | 0:a7a43371b306 | 373 | __start_routine(NULL); |
ram54288 | 0:a7a43371b306 | 374 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 375 | } |
ram54288 | 0:a7a43371b306 | 376 | |
ram54288 | 0:a7a43371b306 | 377 | int pthread_cancel (pthread_t) |
ram54288 | 0:a7a43371b306 | 378 | { |
ram54288 | 0:a7a43371b306 | 379 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 380 | } |
ram54288 | 0:a7a43371b306 | 381 | |
ram54288 | 0:a7a43371b306 | 382 | int pthread_join (pthread_t , void **) |
ram54288 | 0:a7a43371b306 | 383 | { |
ram54288 | 0:a7a43371b306 | 384 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 385 | } |
ram54288 | 0:a7a43371b306 | 386 | |
ram54288 | 0:a7a43371b306 | 387 | void pthread_exit (void *__retval)/* __attribute__ ((__noreturn__))*/ |
ram54288 | 0:a7a43371b306 | 388 | { |
ram54288 | 0:a7a43371b306 | 389 | |
ram54288 | 0:a7a43371b306 | 390 | } |
ram54288 | 0:a7a43371b306 | 391 | |
ram54288 | 0:a7a43371b306 | 392 | // sys/socket |
ram54288 | 0:a7a43371b306 | 393 | #ifndef __SOCKADDR_ARG |
ram54288 | 0:a7a43371b306 | 394 | # define __SOCKADDR_ARG struct sockaddr *__restrict |
ram54288 | 0:a7a43371b306 | 395 | #endif |
ram54288 | 0:a7a43371b306 | 396 | |
ram54288 | 0:a7a43371b306 | 397 | #ifndef __CONST_SOCKADDR_ARG |
ram54288 | 0:a7a43371b306 | 398 | # define __CONST_SOCKADDR_ARG const struct sockaddr * |
ram54288 | 0:a7a43371b306 | 399 | #endif |
ram54288 | 0:a7a43371b306 | 400 | |
ram54288 | 0:a7a43371b306 | 401 | #ifndef __socklen_t_defined |
ram54288 | 0:a7a43371b306 | 402 | typedef __socklen_t socklen_t; |
ram54288 | 0:a7a43371b306 | 403 | # define __socklen_t_defined |
ram54288 | 0:a7a43371b306 | 404 | #endif |
ram54288 | 0:a7a43371b306 | 405 | |
ram54288 | 0:a7a43371b306 | 406 | int bind (int , __CONST_SOCKADDR_ARG , socklen_t ) |
ram54288 | 0:a7a43371b306 | 407 | __THROW |
ram54288 | 0:a7a43371b306 | 408 | { |
ram54288 | 0:a7a43371b306 | 409 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 410 | } |
ram54288 | 0:a7a43371b306 | 411 | |
ram54288 | 0:a7a43371b306 | 412 | ssize_t sendto (int , const void *, size_t , |
ram54288 | 0:a7a43371b306 | 413 | int , __CONST_SOCKADDR_ARG , |
ram54288 | 0:a7a43371b306 | 414 | socklen_t ) |
ram54288 | 0:a7a43371b306 | 415 | { |
ram54288 | 0:a7a43371b306 | 416 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 417 | } |
ram54288 | 0:a7a43371b306 | 418 | |
ram54288 | 0:a7a43371b306 | 419 | ssize_t recvfrom (int , void * , size_t , |
ram54288 | 0:a7a43371b306 | 420 | int , __SOCKADDR_ARG , |
ram54288 | 0:a7a43371b306 | 421 | socklen_t * ) |
ram54288 | 0:a7a43371b306 | 422 | { |
ram54288 | 0:a7a43371b306 | 423 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 424 | } |
ram54288 | 0:a7a43371b306 | 425 | |
ram54288 | 0:a7a43371b306 | 426 | int getaddrinfo (const char *__restrict, |
ram54288 | 0:a7a43371b306 | 427 | const char *__restrict, |
ram54288 | 0:a7a43371b306 | 428 | const struct addrinfo *__restrict, |
ram54288 | 0:a7a43371b306 | 429 | struct addrinfo **__restrict addr) |
ram54288 | 0:a7a43371b306 | 430 | { |
ram54288 | 0:a7a43371b306 | 431 | //*addr = (addrinfo*)malloc(sizeof(addrinfo)); |
ram54288 | 0:a7a43371b306 | 432 | //(*addr)->ai_addr = (sockaddr*)malloc(sizeof(sockaddr)); |
ram54288 | 0:a7a43371b306 | 433 | *addr = common_stub::addrinfo; |
ram54288 | 0:a7a43371b306 | 434 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 435 | } |
ram54288 | 0:a7a43371b306 | 436 | |
ram54288 | 0:a7a43371b306 | 437 | void freeaddrinfo (struct addrinfo * addr) |
ram54288 | 0:a7a43371b306 | 438 | __THROW |
ram54288 | 0:a7a43371b306 | 439 | { |
ram54288 | 0:a7a43371b306 | 440 | // free(addr->ai_addr); |
ram54288 | 0:a7a43371b306 | 441 | // free(addr); |
ram54288 | 0:a7a43371b306 | 442 | } |
ram54288 | 0:a7a43371b306 | 443 | |
ram54288 | 0:a7a43371b306 | 444 | const char *inet_ntop (int, const void *__restrict, |
ram54288 | 0:a7a43371b306 | 445 | char *__restrict, socklen_t) |
ram54288 | 0:a7a43371b306 | 446 | __THROW |
ram54288 | 0:a7a43371b306 | 447 | { |
ram54288 | 0:a7a43371b306 | 448 | return common_stub::char_value; |
ram54288 | 0:a7a43371b306 | 449 | } |
ram54288 | 0:a7a43371b306 | 450 | |
ram54288 | 0:a7a43371b306 | 451 | int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) |
ram54288 | 0:a7a43371b306 | 452 | { |
ram54288 | 0:a7a43371b306 | 453 | return common_stub::int_value; |
ram54288 | 0:a7a43371b306 | 454 | } |
ram54288 | 0:a7a43371b306 | 455 |