[hipl-commit] [trunk] Rev 4366: Remove unused function main_client_native().

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Tue, 20 Apr 2010 18:06:36 +0300

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: 20/04/2010 at 18:06:36
Revision: 4366
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Remove unused function main_client_native().

Modified:
  M  test/conntest.c

=== modified file 'test/conntest.c'
--- test/conntest.c     2010-04-15 22:49:30 +0000
+++ test/conntest.c     2010-04-20 15:06:25 +0000
@@ -756,106 +756,3 @@
 
     return err;
 }
-
-/**
- * main_client_native - it handles the functionality of the client-native
- * @param proto type of protocol
- * @param socktype the type of socket
- * @param peer_name the peer name
- * @param peer_port_name the prot number
- *
- * @return 1 with success, 0 otherwise.
- */
-int main_client_native(int socktype, char *peer_name, char *peer_port_name)
-{
-    struct timeval stats_before, stats_after;
-    struct sockaddr_hip peer_sock;
-    unsigned long stats_diff_sec, stats_diff_usec;
-    char mylovemostdata[IP_MAXPACKET];
-    char receiveddata[IP_MAXPACKET];
-    int recvnum, sendnum;
-    int datalen      = 0;
-    int datasent     = 0;
-    int datareceived = 0;
-    int ch;
-    int err          = 0;
-    int sockfd       = -1;
-    se_family_t endpoint_family;
-
-    endpoint_family = PF_HIP;
-
-    sockfd          = socket(endpoint_family, socktype, 0);
-    HIP_IFEL(sockfd < 0, 1, "creation of socket failed\n");
-
-    /* XX TODO: Do a proper getaddrinfo() */
-    memset(&peer_sock, 0, sizeof(peer_sock));
-    peer_sock.ship_family = PF_HIP;
-    HIP_IFEL(inet_pton(AF_INET6, peer_name, &peer_sock.ship_hit) != 1, 1, 
"Failed to parse HIT\n");
-    peer_sock.ship_port   = htons(atoi(peer_port_name));
-    HIP_DEBUG("Connecting to %s port %d\n", peer_name, peer_sock.ship_port);
-
-    // data from stdin to buffer
-    memset(receiveddata, 0, IP_MAXPACKET);
-    memset(mylovemostdata, 0, IP_MAXPACKET);
-
-    printf("Input some text, press enter and ctrl+d\n");
-
-    // horrible code
-    while ((ch = fgetc(stdin)) != EOF && (datalen < IP_MAXPACKET)) {
-        mylovemostdata[datalen] = (unsigned char) ch;
-        datalen++;
-    }
-
-    gettimeofday(&stats_before, NULL);
-
-    err = connect(sockfd, (struct sockaddr *) &peer_sock, sizeof(peer_sock));
-    if (err) {
-        HIP_PERROR("connect: ");
-        goto out_err;
-    }
-
-    gettimeofday(&stats_after, NULL);
-    stats_diff_sec  = (stats_after.tv_sec - stats_before.tv_sec) * 1000000;
-    stats_diff_usec = stats_after.tv_usec - stats_before.tv_usec;
-
-    HIP_DEBUG("connect took %.10f sec\n",
-              (stats_diff_sec + stats_diff_usec) / 1000000.0);
-
-    /* Send the data read from stdin to the server and read the response.
-     * The server should echo all the data received back to here. */
-    while ((datasent < datalen) || (datareceived < datalen)) {
-        if (datasent < datalen) {
-            sendnum = send(sockfd, mylovemostdata + datasent, datalen - 
datasent, 0);
-
-            if (sendnum < 0) {
-                HIP_PERROR("send");
-                err = 1;
-                goto out_err;
-            }
-            datasent += sendnum;
-        }
-
-        if (datareceived < datalen) {
-            recvnum = recv(sockfd, receiveddata + datareceived,
-                           datalen - datareceived, 0);
-            if (recvnum <= 0) {
-                HIP_PERROR("recv");
-                err = 1;
-                goto out_err;
-            }
-            datareceived += recvnum;
-        }
-    }
-
-    HIP_IFEL(memcmp(mylovemostdata, receiveddata, IP_MAXPACKET),
-             1, "Sent and received data did not match\n");
-
-out_err:
-
-    if (sockfd > -1) {
-        close(sockfd);         // discard errors
-    }
-    HIP_INFO("Result of data transfer: %s.\n", (err ? "FAIL" : "OK"));
-
-    return err;
-}

Other related posts:

  • » [hipl-commit] [trunk] Rev 4366: Remove unused function main_client_native(). - Diego Biurrun