cc3000 hostdriver with the mbed socket interface
Dependents: cc3000_hello_world_demo cc3000_simple_socket_demo cc3000_ntp_demo cc3000_ping_demo ... more
Diff: cc3000_socket.cpp
- Revision:
- 42:bd2c631a031a
- Parent:
- 20:30b6ed7bf8fd
- Child:
- 45:50ab13d8f2dc
diff -r eb1999bd50fb -r bd2c631a031a cc3000_socket.cpp
--- a/cc3000_socket.cpp Sat Oct 12 21:03:45 2013 +0000
+++ b/cc3000_socket.cpp Sat Oct 12 21:53:28 2013 +0000
@@ -600,4 +600,39 @@
#endif
+char * cc3000_socket::inet_ntoa_r(uint32_t s_addr, char *buf, int buflen)
+{
+ char inv[3];
+ char *rp;
+ uint8_t *ap;
+ uint8_t rem;
+ uint8_t n;
+ uint8_t i;
+ int len = 0;
+
+ rp = buf;
+ ap = (uint8_t *)&s_addr;
+ for(n = 0; n < 4; n++) {
+ i = 0;
+ do {
+ rem = *ap % (uint8_t)10;
+ *ap /= (uint8_t)10;
+ inv[i++] = '0' + rem;
+ } while(*ap);
+ while(i--) {
+ if (len++ >= buflen) {
+ return NULL;
+ }
+ *rp++ = inv[i];
+ }
+ if (len++ >= buflen) {
+ return NULL;
+ }
+ *rp++ = '.';
+ ap++;
+ }
+ *--rp = 0;
+ return buf;
+}
+
} /* end of cc3000 namespace */
SimpleLink Wi-Fi CC3000
Avnet Wi-Go System