Ethernet test for tinydtls-0.5.0
Dependencies: EthernetInterface mbed-rtos mbed tinydtls
Fork of tinydtls_test_ethernet by
Revision 3:0caeed7fd9f0, committed 2013-10-11
- Comitter:
- ashleymills
- Date:
- Fri Oct 11 14:04:03 2013 +0000
- Parent:
- 2:21019cad4c93
- Child:
- 4:4d466a913c11
- Commit message:
- Removed some junk.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| tinydtls.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Oct 10 22:07:32 2013 +0000
+++ b/main.cpp Fri Oct 11 14:04:03 2013 +0000
@@ -61,49 +61,6 @@
#define APN_PASSWORD "web"
#endif
-/* stolen from libcoap: */
-int
-resolve_address(const char *server, struct sockaddr *dst) {
-
- struct addrinfo *res, *ainfo;
- struct addrinfo hints;
- static char addrstr[256];
- int error;
-
- memset(addrstr, 0, sizeof(addrstr));
- if (server && strlen(server) > 0)
- memcpy(addrstr, server, strlen(server));
- else
- memcpy(addrstr, "localhost", 9);
-
- memset ((char *)&hints, 0, sizeof(hints));
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_family = AF_UNSPEC;
-
- error = getaddrinfo(addrstr, "", &hints, &res);
-
- if (error != 0) {
- DBG("Some bullshit error");//fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(error));
- return error;
- }
-
- for (ainfo = res; ainfo != NULL; ainfo = ainfo->ai_next) {
-
- switch (ainfo->ai_family) {
- case AF_INET:
-
- memcpy(dst, ainfo->ai_addr, ainfo->ai_addrlen);
- return ainfo->ai_addrlen;
- default:
- ;
- }
- }
-
- freeaddrinfo(res);
- return -1;
-}
-
-
sockaddr_in bindAddr,serverAddress;
bool connectToSocketUDP(char *ipAddress, int port, int *sockfd) {
*sockfd = -1;
@@ -276,27 +233,6 @@
dsrv_log(LOG_ALERT, "setsockopt SO_REUSEADDR: %s\n", strerror(errno));
}*/
- /*
- memset(&dst, 0, sizeof(session_t));
- // resolve destination address where server should be sent
- //int res = resolve_address("192.168.1.99", &dst.addr.sa);
- int res = resolve_address("109.74.199.96", &dst.addr.sa);
- if (res < 0) {
- dsrv_log(LOG_EMERG, "failed to resolve address\n");
- fail(9);
- }
- dst.size = res;
-
- // use port number from command line when specified or the listen port, otherwise
- dst.addr.sin.sin_port = htons(4433);//atoi(optind < argc ? argv[optind++] : port_str));
-
- // init socket and set it to non-blocking
- sockfd = socket(dst.addr.sa.sa_family, SOCK_DGRAM, 0);
- if (sockfd < 0) {
- dsrv_log(LOG_ALERT, "socket: %s\n", strerror(errno));
- return 0;
- }*/
-
// tinydtls stuff
// destination address is stored in a session type
--- a/tinydtls.lib Thu Oct 10 22:07:32 2013 +0000 +++ b/tinydtls.lib Fri Oct 11 14:04:03 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/ashleymills/code/tinydtls/#04990d454f45 +http://mbed.org/users/ashleymills/code/tinydtls/#bc8a649bad13
