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: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
socket_api_stub.c
00001 /* 00002 * Copyright (c) 2015 ARM Limited. All Rights Reserved. 00003 */ 00004 #include "socket_api.h" 00005 #include "socket_api_stub.h" 00006 00007 socket_api_stub_data_t socket_api_stub; 00008 00009 int8_t socket_raw_open(void (*passed_fptr)(void *)) 00010 { 00011 if( socket_api_stub.counter >= 0){ 00012 return socket_api_stub.values[socket_api_stub.counter--]; 00013 } 00014 00015 return socket_api_stub.int8_value; 00016 } 00017 int8_t socket_open(uint8_t protocol, uint16_t identifier, void (*passed_fptr)(void *)) 00018 { 00019 socket_api_stub.recv_cb = passed_fptr; 00020 if( socket_api_stub.counter >= 0){ 00021 return socket_api_stub.values[socket_api_stub.counter--]; 00022 } 00023 00024 return socket_api_stub.int8_value; 00025 } 00026 00027 int8_t socket_free(int8_t socket) 00028 { 00029 if( socket_api_stub.counter >= 0){ 00030 return socket_api_stub.values[socket_api_stub.counter--]; 00031 } 00032 00033 return socket_api_stub.int8_value; 00034 } 00035 int8_t socket_listen(int8_t socket) 00036 { 00037 if( socket_api_stub.counter >= 0){ 00038 return socket_api_stub.values[socket_api_stub.counter--]; 00039 } 00040 00041 return socket_api_stub.int8_value; 00042 } 00043 int8_t socket_connect(int8_t socket, ns_address_t *address, uint8_t randomly_take_src_number) 00044 { 00045 if( socket_api_stub.counter >= 0){ 00046 return socket_api_stub.values[socket_api_stub.counter--]; 00047 } 00048 00049 return socket_api_stub.int8_value; 00050 } 00051 int8_t socket_bind(int8_t socket, const ns_address_t *address) 00052 { 00053 if( socket_api_stub.counter >= 0){ 00054 return socket_api_stub.values[socket_api_stub.counter--]; 00055 } 00056 00057 return socket_api_stub.int8_value; 00058 } 00059 int8_t socket_close(int8_t socket, ns_address_t *address) 00060 { 00061 if( socket_api_stub.counter >= 0){ 00062 return socket_api_stub.values[socket_api_stub.counter--]; 00063 } 00064 00065 return socket_api_stub.int8_value; 00066 } 00067 int8_t socket_send(int8_t socket, uint8_t *buffer, uint16_t length) 00068 { 00069 if( socket_api_stub.counter >= 0){ 00070 return socket_api_stub.values[socket_api_stub.counter--]; 00071 } 00072 00073 return socket_api_stub.int8_value; 00074 } 00075 int16_t socket_read(int8_t socket, ns_address_t *address, uint8_t *buffer, uint16_t length) 00076 { 00077 if( address ){ 00078 memset(&address->address, 0, 16); 00079 address->identifier = 0; 00080 } 00081 if( socket_api_stub.counter >= 0){ 00082 return socket_api_stub.values[socket_api_stub.counter--]; 00083 } 00084 00085 return socket_api_stub.int8_value; 00086 } 00087 int8_t socket_sendto(int8_t socket, ns_address_t *address, uint8_t *buffer, uint16_t length) 00088 { 00089 if( socket_api_stub.counter >= 0){ 00090 return socket_api_stub.values[socket_api_stub.counter--]; 00091 } 00092 00093 return socket_api_stub.int8_value; 00094 } 00095 int8_t socket_read_session_address(int8_t socket, ns_address_t *address) 00096 { 00097 if( socket_api_stub.counter >= 0){ 00098 return socket_api_stub.values[socket_api_stub.counter--]; 00099 } 00100 00101 return socket_api_stub.int8_value; 00102 } 00103 int8_t socket_setsockopt(int8_t socket, uint8_t level, uint8_t opt_name, const void *opt_value, uint16_t opt_len) 00104 { 00105 if( socket_api_stub.counter >= 0){ 00106 return socket_api_stub.values[socket_api_stub.counter--]; 00107 } 00108 00109 return socket_api_stub.int8_value; 00110 } 00111 int8_t socket_getsockopt(int8_t socket, uint8_t level, uint8_t opt_name, void *opt_value, uint16_t *opt_len) 00112 { 00113 if( socket_api_stub.counter >= 0){ 00114 return socket_api_stub.values[socket_api_stub.counter--]; 00115 } 00116 00117 return socket_api_stub.int8_value; 00118 }
Generated on Tue Jul 12 2022 12:28:49 by
