remove unused file 23/11523/2
authorho.namkoong <ho.namkoong@samsung.com>
Tue, 29 Oct 2013 08:07:27 +0000 (17:07 +0900)
committerho.namkoong <ho.namkoong@samsung.com>
Tue, 29 Oct 2013 08:07:57 +0000 (17:07 +0900)
Change-Id: Ibe99a2f18926e2842105d81665342d7fbb951bd7
Signed-off-by: ho.namkoong <ho.namkoong@samsung.com>
src/services.c [deleted file]

diff --git a/src/services.c b/src/services.c
deleted file mode 100755 (executable)
index 0b82a68..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include "utils.h"
-#include "fdevent.h"
-
-#define  TRACE_TAG  TRACE_SERVICES
-#include "sdb.h"
-#include "file_sync_service.h"
-
-#  ifndef OS_WINDOWS
-#    include <netinet/in.h>
-#    include <netdb.h>
-#    include <sys/ioctl.h>
-#  endif
-
-typedef struct stinfo stinfo;
-
-struct stinfo {
-    void (*func)(int fd, void *cookie);
-    int fd;
-    void *cookie;
-};
-
-
-void *service_bootstrap_func(void *x)
-{
-    stinfo *sti = x;
-    sti->func(sti->fd, sti->cookie);
-    free(sti);
-    return 0;
-}
-
-SDB_MUTEX_DEFINE( dns_lock );
-
-static int create_service_thread(void (*func)(int, void *), void *cookie)
-{
-    stinfo *sti;
-    sdb_thread_t t;
-    int s[2];
-
-    if(sdb_socketpair(s)) {
-        printf("cannot create service socket pair\n");
-        return -1;
-    }
-
-    sti = malloc(sizeof(stinfo));
-    if(sti == 0) fatal("cannot allocate stinfo");
-    sti->func = func;
-    sti->cookie = cookie;
-    sti->fd = s[1];
-
-    if(sdb_thread_create( &t, service_bootstrap_func, sti)){
-        free(sti);
-        sdb_close(s[0]);
-        sdb_close(s[1]);
-        printf("cannot create service thread\n");
-        return -1;
-    }
-
-    D("service thread started, %d:%d\n",s[0], s[1]);
-    return s[0];
-}
-
-int service_to_fd(const char *name)
-{
-    int ret = -1;
-
-    if(!strncmp(name, "tcp:", 4)) {
-        int port = atoi(name + 4);
-        name = strchr(name + 4, ':');
-        if(name == 0) {
-            ret = socket_loopback_client(port, SOCK_STREAM);
-            if (ret >= 0)
-                disable_tcp_nagle(ret);
-        } else {
-
-            sdb_mutex_lock(&dns_lock);
-            ret = socket_network_client(name + 1, port, SOCK_STREAM);
-            sdb_mutex_unlock(&dns_lock);
-        }
-    }
-    if (ret >= 0) {
-        close_on_exec(ret);
-    }
-    return ret;
-}
-
-struct state_info {
-    transport_type transport;
-    char* serial;
-    int state;
-};
-
-static void wait_for_state(int fd, void* cookie)
-{
-    struct state_info* sinfo = cookie;
-    char* err = "unknown error";
-
-    D("wait_for_state %d\n", sinfo->state);
-
-    atransport *t = acquire_one_transport(sinfo->state, sinfo->transport, sinfo->serial, &err);
-    if(t != 0) {
-        writex(fd, "OKAY", 4);
-    } else {
-        sendfailmsg(fd, err);
-    }
-
-    if (sinfo->serial)
-        free(sinfo->serial);
-    free(sinfo);
-    sdb_close(fd);
-    D("wait_for_state is done\n");
-}
-
-asocket*  host_service_to_socket(const char*  name, const char *serial)
-{
-    if (!strcmp(name,"track-devices")) {
-        return create_device_tracker();
-    } else if (!strncmp(name, "wait-for-", strlen("wait-for-"))) {
-        struct state_info* sinfo = malloc(sizeof(struct state_info));
-
-        if (serial)
-            sinfo->serial = strdup(serial);
-        else
-            sinfo->serial = NULL;
-
-        name += strlen("wait-for-");
-
-        if (!strncmp(name, "local", strlen("local"))) {
-            sinfo->transport = kTransportLocal;
-            sinfo->state = CS_DEVICE;
-        } else if (!strncmp(name, "usb", strlen("usb"))) {
-            sinfo->transport = kTransportUsb;
-            sinfo->state = CS_DEVICE;
-        } else if (!strncmp(name, "any", strlen("any"))) {
-            sinfo->transport = kTransportAny;
-            sinfo->state = CS_DEVICE;
-        } else {
-            free(sinfo);
-            return NULL;
-        }
-
-        int fd = create_service_thread(wait_for_state, sinfo);
-        return create_local_socket(fd);
-    }
-    return NULL;
-}
-