示例#1
0
END_TEST



START_TEST(test_add_connection)
  {
  fail_unless(add_connection(-1, ToServerDIS, 0, 0, PBS_SOCK_INET, accept_conn, 0) == PBSE_BAD_PARAMETER);
  fail_unless(add_connection(PBS_NET_MAX_CONNECTIONS, ToServerDIS, 0, 0, PBS_SOCK_INET, accept_conn, 0) == PBSE_BAD_PARAMETER);

  }
示例#2
0
static ConnCacheEntry *
internal_get (int32_t cell,
	      uint32_t host,
	      uint16_t port,
	      uint16_t service,
	      int (*probe)(struct rx_connection *),
	      CredCacheEntry *ce)
{
    ConnCacheEntry *e;
    ConnCacheEntry key;

#if 0
    if (connected_mode == DISCONNECTED)
	return NULL;
#endif

    key.host          = host;
    key.port          = port;
    key.service       = service;
    key.cred          = ce->cred;
    key.securityindex = ce->securityindex;

    e = (ConnCacheEntry *)hashtabsearch (connhtab, (void *)&key);

    if (e == NULL) {
	ConnCacheEntry *parent = NULL;

	if (ce->securityindex || ce->cred) {
	    key.cred = 0;
	    key.securityindex = 0;
	    parent = (ConnCacheEntry *)hashtabsearch (connhtab, (void *)&key);
	    if (parent == NULL) {
		parent = add_connection (cell, host, port, service,
					 probe, NULL);
	    }
	    ++parent->refcount;
	}

	e = add_connection (cell, host, port, service, probe, ce);
	if (parent != NULL)
	    e->parent = parent;
    }

    /*
     * Since we only probe the parent entry (ie noauth), we make sure
     * the status from the parent entry is pushed down to the
     * children.
     */
    if(e->parent != NULL) {
	e->flags.alivep = e->parent->flags.alivep;
    }

    return e;
}
示例#3
0
/*
 * Resolve the entry in servers with index ind, adding connections to the list
 * *conns.  Connections are added for each of socktype1 and (if not zero)
 * socktype2.  message and udpbufp are used to initialize the connections; see
 * add_connection above.  If no addresses are available for an entry but no
 * internal name resolution failure occurs, return 0 without adding any new
 * connections.
 */
static krb5_error_code
resolve_server(krb5_context context, const struct serverlist *servers,
               size_t ind, int socktype1, int socktype2,
               const krb5_data *message, char **udpbufp,
               struct conn_state **conns)
{
    krb5_error_code retval;
    struct server_entry *entry = &servers->servers[ind];
    struct addrinfo *addrs, *a, hint, ai;
    int err, result;
    char portbuf[64];

    /* Skip any stray entries of socktypes we don't want. */
    if (entry->socktype != 0 && entry->socktype != socktype1 &&
        entry->socktype != socktype2)
        return 0;

    if (entry->hostname == NULL) {
        ai.ai_socktype = entry->socktype;
        ai.ai_family = entry->family;
        ai.ai_addrlen = entry->addrlen;
        ai.ai_addr = (struct sockaddr *)&entry->addr;
        return add_connection(conns, &ai, ind, message, udpbufp);
    }

    memset(&hint, 0, sizeof(hint));
    hint.ai_family = entry->family;
    hint.ai_socktype = (entry->socktype != 0) ? entry->socktype : socktype1;
#ifdef AI_NUMERICSERV
    hint.ai_flags = AI_NUMERICSERV;
#endif
    result = snprintf(portbuf, sizeof(portbuf), "%d", ntohs(entry->port));
    if (SNPRINTF_OVERFLOW(result, sizeof(portbuf)))
        return EINVAL;
    TRACE_SENDTO_KDC_RESOLVING(context, entry->hostname);
    err = getaddrinfo(entry->hostname, portbuf, &hint, &addrs);
    if (err)
        return translate_ai_error(err);
    /* Add each address with the preferred socktype. */
    retval = 0;
    for (a = addrs; a != 0 && retval == 0; a = a->ai_next)
        retval = add_connection(conns, a, ind, message, udpbufp);
    if (retval == 0 && entry->socktype == 0 && socktype2 != 0) {
        /* Add each address again with the non-preferred socktype. */
        for (a = addrs; a != 0 && retval == 0; a = a->ai_next) {
            a->ai_socktype = socktype2;
            retval = add_connection(conns, a, ind, message, udpbufp);
        }
    }
    freeaddrinfo(addrs);
    return retval;
}
int
main (int argc, char *argv[])
{
	NMClient *client;
	GMainLoop *loop;
	GError *error = NULL;

#if !GLIB_CHECK_VERSION (2, 35, 0)
	/* Initialize GType system */
	g_type_init ();
#endif

	loop = g_main_loop_new (NULL, FALSE);

	/* Connect to NetworkManager */
	client = nm_client_new (NULL, &error);
	if (!client) {
		g_message ("Error: Could not connect to NetworkManager: %s.", error->message);
		g_error_free (error);
		return 1;
	}

	/* Ask NM to add the new connection */
	add_connection (client, loop, "__Test connection__");
	/* Wait for the connection to be added */
	g_main_loop_run (loop);

	/* Clean up */
	g_object_unref (client);

	return 0;
}
int
main (int argc, char *argv[])
{
	NMRemoteSettings *settings;
	GMainLoop *loop;
	GError *error = NULL;

#if !GLIB_CHECK_VERSION (2, 35, 0)
	/* Initialize GType system */
	g_type_init ();
#endif

	loop = g_main_loop_new (NULL, FALSE);

	/* Create our proxy for NetworkManager's settings service */
	settings = nm_remote_settings_new (NULL, &error);
	if (!settings) {
		g_message ("Error: Could not get system settings: %s.", error->message);
		g_error_free (error);
		return 1;
	}

	/* Ask the settings service to add the new connection */
	if (add_connection (settings, loop, "__Test connection__")) {
		/* Wait for the connection to be added */
		g_main_loop_run (loop);
	} else
		g_print ("Error adding connection to NetworkManager\n");

	/* Clean up */
	g_object_unref (settings);

	return 0;
}
示例#6
0
void accept_cb(EV_P_ struct ev_io *w, int revent)
{
    client_t *client = (client_t *) w->data;
    drizzle_con_st     *dc = (drizzle_con_st *) malloc(sizeof(drizzle_con_st));
    drizzle_return_t    ret;
    int                 fd;
    connection_t       *con;

    dbgin();

    /* Manually set connection to ready */
    drizzle_con_add_options(client->dc, DRIZZLE_CON_IO_READY);

    drizzle_con_accept(client->drizzle, dc, &ret);
    if (ret != DRIZZLE_RETURN_OK)
    {
        if (ret == DRIZZLE_RETURN_IO_WAIT) {
            printf("io_wait\n");
            return;
        }
        printf("drizzle_con_accpet error:%s\n", drizzle_error(client->drizzle));
        return;
    }

    fd = drizzle_con_fd(dc);
    printf("Accepted. fd:%d\n", fd);

    con = (connection_t *) calloc(1, sizeof(connection_t));
    con->fd = fd;
    con->client = client;
    con->dc = dc;

    add_connection(client, con);

}
示例#7
0
err_t http_cache_lookup (const char *name, struct http_conn *cs)
{
    struct http_cache_entry *e;
    assert(cs != NULL);

    e = find_cacheline(name);
    if (e->valid == 1) {
        /* fresh matching cache-entry found */
        DEBUGPRINT ("%d: Fresh cache-entry, returning page [%s]\n",
                cs->request_no, name);
        trigger_callback (cs, e);
        return ERR_OK;
    } /* end if: valid cacheline */

    /* data not in cache */
    /* add this connection to the list of waiting on cacheline */
    add_connection (e, cs);

    /* Check if no-one is loading the data */
    if (e->loading == 0 ) {
        e->loading = 1;
        DEBUGPRINT ("%d: starting the page loading\n", cs->request_no);
        async_load_cache_entry(e);
    } /* end if: no-one else is loading the data */
    else {
        DEBUGPRINT ("%d: someone else is loading the page, so just waiting\n",
            cs->request_no);
    }

    return ERR_OK;
} /* end function: http_cache_lookup */
示例#8
0
/*
 * An outgoing connection has become ready to write to.  Start polling for
 * incoming packets.
 */
static void
outgoing_connection(int fd, short revents, void *arg)
{
	struct node *node = arg;

	assert(fd == node->connecting_fd);
	node->connecting_fd = -1;
	if (revents & POLLERR) {
		int socket_error;
		socklen_t len;

		remove_poll_callback(&cbs, fd);
		len = sizeof(socket_error);
		if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &socket_error, &len) == -1)
			fail(NULL);
		close(fd);
		if (socket_error != ECONNREFUSED) {
			errno = socket_error;
			fail(NULL);
		}
	} else {
		update_poll_callback(&cbs, fd, POLLIN, proto_read, node);
		add_connection(fd, node);
	}
}
int main (int argc, char *argv[])
{
	DBusGConnection *bus;
	NMRemoteSettings *settings;
	GMainLoop *loop;

	/* Initialize GType system */
	g_type_init ();

	loop = g_main_loop_new (NULL, FALSE);

	/* Get system bus */
	bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);

	/* Create our proxy for NetworkManager's settings service */
	settings = nm_remote_settings_new (bus);

	/* Ask the settings service to add the new connection */
	if (add_connection (settings, loop, "__Test connection__")) {
		/* Wait for the connection to be added */
		g_main_loop_run (loop);
	} else
		g_print ("Error adding connection to NetworkManager\n");

	/* Clean up */
	g_object_unref (settings);
	dbus_g_connection_unref (bus);

	return 0;
}
示例#10
0
static inline void obs_encoder_start_internal(obs_encoder_t *encoder,
		void (*new_packet)(void *param, struct encoder_packet *packet),
		void *param)
{
	struct encoder_callback cb = {false, new_packet, param};
	bool first   = false;

	if (!encoder->context.data)
		return;

	pthread_mutex_lock(&encoder->callbacks_mutex);

	first = (encoder->callbacks.num == 0);

	size_t idx = get_callback_idx(encoder, new_packet, param);
	if (idx == DARRAY_INVALID)
		da_push_back(encoder->callbacks, &cb);

	pthread_mutex_unlock(&encoder->callbacks_mutex);

	if (first) {
		encoder->cur_pts = 0;
		add_connection(encoder);
	}
}
int on_channel(int epoll_fd, int fd)
{
	channel ch;
	if(recv_fd(fd, &ch) == L_HTTP_FAIL) {
		printf("receive fd fail\n");
		return L_HTTP_FAIL;
	}	

	switch(ch.cmd) {
		case HTTP_COMMAND_TRANS_FD:
			return add_connection(epoll_fd, ch.fd);		

		case HTTP_COMMAND_RESTART:
				break;

		case HTTP_COMMAND_EXIT:
			syslog(LOG_INFO, "proc:%d receive shutdown cmd", getpid());
			worker_shutdown(epoll_fd);
			break;

		default:
			printf("unknown cmd type\n");
			return L_HTTP_FAIL;
	}
	
	return L_HTTP_SUCCESS;
}
示例#12
0
文件: vpn.c 项目: manjurajv/connman
static gboolean connection_added(DBusConnection *conn, DBusMessage *message,
				void *user_data)
{
	DBusMessageIter iter, properties;
	const char *path;
	const char *signature = DBUS_TYPE_OBJECT_PATH_AS_STRING
		DBUS_TYPE_ARRAY_AS_STRING
		DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
		DBUS_TYPE_STRING_AS_STRING
		DBUS_TYPE_VARIANT_AS_STRING
		DBUS_DICT_ENTRY_END_CHAR_AS_STRING;

	if (dbus_message_has_signature(message, signature) == FALSE) {
		connman_error("vpn ConnectionAdded signature \"%s\" does not "
						"match expected \"%s\"",
			dbus_message_get_signature(message), signature);
		return TRUE;
	}

	DBG("");

	if (dbus_message_iter_init(message, &iter) == FALSE)
		return TRUE;

	dbus_message_iter_get_basic(&iter, &path);

	dbus_message_iter_next(&iter);
	dbus_message_iter_recurse(&iter, &properties);

	add_connection(path, &properties, user_data);

	return TRUE;
}
int
main (int argc, char *argv[])
{
	GDBusProxy *proxy;
	GError *error = NULL;

#if !GLIB_CHECK_VERSION (2, 35, 0)
	/* Initialize GType system */
	g_type_init ();
#endif

	/* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */
	proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
	                                       G_DBUS_PROXY_FLAGS_NONE,
	                                       NULL,
	                                       NM_DBUS_SERVICE,
	                                       NM_DBUS_PATH_SETTINGS,
	                                       NM_DBUS_INTERFACE_SETTINGS,
	                                       NULL, &error);
	if (!proxy) {
		g_dbus_error_strip_remote_error (error);
		g_print ("Could not create NetworkManager D-Bus proxy: %s\n", error->message);
		g_error_free (error);
		return 1;
	}

	/* Add a connection */
	add_connection (proxy, "__Test connection__");

	g_object_unref (proxy);

	return 0;
}
示例#14
0
int main(int argc, char** argv) {
	int sockfd = socket(AF_INET, SOCK_STREAM, 0);
	if (sockfd == -1) {
		perror("socket()");
		exit(-1);
	}
	struct sockaddr_in addr;
	addr.sin_family = AF_INET;
	addr.sin_port = htons(PORT);
	inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr);

	if (bind(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) == -1) {
		perror("bind()");
		exit(-1);
	}
	if (listen(sockfd, PENDING) == -1) {
		perror("listen()");
		exit(-1);
	}

	memset(connections, 0, sizeof(struct client *) * MAXCONN);

	for(;;) {
		int newfd = accept(sockfd, NULL, NULL);
		add_connection(newfd);
	}
}
示例#15
0
unsigned agent_impl::connect(const char* ipaddr, unsigned short port, 
				 int32_t timeout_millis, unsigned short local_port)
{
	connection_ptr new_conn(new connection(*this, get_io_service(), net_callback_));
	add_connection(new_conn);
	new_conn->async_connect(ipaddr, port, timeout_millis, local_port);
	return new_conn->get_id();
}
示例#16
0
connection_ptr Engine::open_connection(std::string host, int port)
{
	std::string port_str = boost::lexical_cast<std::string>(port);
	int fd = SocketUtils::socket_connection_new(host.c_str(), port_str.c_str(), 0);
	if (fd < 0) return connection_ptr();
	SocketUtils::make_socket_non_blocking(fd);
	connection_ptr conn = add_connection(fd);
	return conn;
}
示例#17
0
/*****************************************************************
 ***************************I/O***********************************
 *****************************************************************/
void read_graph() {
	int line;
	int orig_id, dest_id;

	scanf("%d %d", &V, &E);
	graph = create_graph(V);

	for (line = 0; line < E; line++) {
		scanf("%d %d", &orig_id, &dest_id);
		add_connection(graph, orig_id, dest_id);
		add_connection(graph, dest_id, orig_id);
		graph->vertexs[orig_id]->edges->anti_parallel =
				graph->vertexs[dest_id]->edges;
		graph->vertexs[dest_id]->edges->anti_parallel =
				graph->vertexs[orig_id]->edges;

	}
}
示例#18
0
main(int argc, char *argv[])
{
    int   len;
    err_t err = NULL;
    char *infile;
    char *conn_name;
    int  lineno=0;
    struct starter_config *cfg = NULL;
    struct starter_conn *conn = NULL;

    //EF_PROTECT_FREE=1;

    progname = argv[0];
    leak_detective = 1;

    if(argc < 4) {
	fprintf(stderr, "Usage: %s <cfgrootdir> <cfgfile> <conn-name>.. \n", progname);
	exit(10);
    }
    /* argv[1] == "-r" */

    tool_init_log();
    //init_fake_vendorid();

    rootdir[0]='\0';
    strlcat(rootdir, argv[1], sizeof(rootdir));

    starter_use_log(1, 1, 1);
    cfg = confread_load(argv[2], &err, FALSE, NULL,FALSE);
    argv+=3;
    argc-=3;

    /* load all conns marked as auto=add or better */
    for(conn = cfg->conns.tqh_first;
	conn != NULL;
	conn = conn->link.tqe_next)
    {
        for(; argc>0; argc--, argv++) {
            conn_name = *argv;
            printf("processing conn: %s\n", conn_name);
            if(strcasecmp(conn->name, conn_name)==0) {
                struct whack_message msg1;
                if(starter_whack_build_basic_conn(cfg, &msg1, conn)==0) {
                    add_connection(&msg1);
                }
            }
        }
    }

    confread_free(cfg);

    report_leaks();

    tool_close_log();
    exit(0);
}
示例#19
0
bool Slot::connect(Slot *slot) {  
  if (slot == NULL) return false;
  // outlet --> inlet
  if (add_connection(slot)) {
    // two way connection
    slot->add_connection(this);
    return true;
  }
  return false;
}
ConnectionResult DronecodeSDKImpl::add_serial_connection(const std::string &dev_path, int baudrate)
{
    auto new_conn = std::make_shared<SerialConnection>(
        std::bind(&DronecodeSDKImpl::receive_message, this, std::placeholders::_1),
        dev_path,
        baudrate);

    ConnectionResult ret = new_conn->start();
    if (ret == ConnectionResult::SUCCESS) {
        add_connection(new_conn);
    }
    return ret;
}
ConnectionResult DronecodeSDKImpl::add_tcp_connection(const std::string &remote_ip, int remote_port)
{
    auto new_conn = std::make_shared<TcpConnection>(
        std::bind(&DronecodeSDKImpl::receive_message, this, std::placeholders::_1),
        remote_ip,
        remote_port);

    ConnectionResult ret = new_conn->start();
    if (ret == ConnectionResult::SUCCESS) {
        add_connection(new_conn);
    }
    return ret;
}
示例#22
0
static void
accept_ssld(rb_fde_t *F, struct sockaddr *addr, struct sockaddr *laddr, struct Listener *listener)
{
    ssl_ctl_t *ctl;
    rb_fde_t *xF[2];
    if(rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF[0], &xF[1], "Incoming ssld Connection") == -1) {
        ilog_error("creating SSL/TLS socket pairs");
        rb_close(F);
        return;
    }
    ctl = start_ssld_accept(F, xF[1], rb_get_fd(xF[0])); /* this will close F for us */
    add_connection(listener, xF[0], addr, laddr, ctl);
}
示例#23
0
void
Local::Heap::common_add (PresentityPtr presentity)
{
  gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");

  // Add the presentity to this Heap
  add_presentity (presentity);

  // Fetch presence
  presence_core->fetch_presence (presentity->get_uri ());

  // Connect the Local::Presentity signals.
  add_connection (presentity, presentity->trigger_saving.connect (sigc::mem_fun (this, &Local::Heap::save)));
}
示例#24
0
int read_problem(t_graph graph) {
	int n_crit_nodes, crit_node_id;

	scanf("%d", &n_crit_nodes);

	if (n_crit_nodes < 2) {
		return 0;
	}

	while (n_crit_nodes > 0) {
		scanf("%d", &crit_node_id);
		graph->vertexs[crit_node_id]->is_critical = TRUE;
		add_connection(graph, crit_node_id, V);
		add_connection(graph, V, crit_node_id);
		graph->vertexs[crit_node_id]->edges->anti_parallel =
				graph->vertexs[V]->edges;
		graph->vertexs[V]->edges->anti_parallel =
				graph->vertexs[crit_node_id]->edges;
		n_crit_nodes--;
	}

	return -1;
}
示例#25
0
void
Local::Heap::common_add (PresentityPtr presentity)
{
  boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();

  // Add the presentity to this Heap
  add_presentity (presentity);

  // Fetch presence
  if (pcore)
    pcore->fetch_presence (presentity->get_uri ());

  // Connect the Local::Presentity signals.
  add_connection (presentity, presentity->trigger_saving.connect (boost::bind (&Local::Heap::save, this)));
}
示例#26
0
bool test_connections(){
  web_context * ctx = alloc0(sizeof(web_context));
  for(int i = 0; i < 100; i++){
    char namebuf[100];
    sprintf(namebuf, "__test%i", i);
    add_connection(ctx, namebuf, "aa", "bb");
  }
  ASSERT(get_connection_by_name(ctx, "__test1"));
  remove_connection(ctx, "__test1");
  //ASSERT(get_connection_by_name(ctx, "__test1") == NULL);
  //ASSERT(get_connection_by_name(ctx, "__test14")->connection == (udpc_connection *) 14);
  dealloc(ctx->active_connections);
  dealloc(ctx);
  return true;
}
示例#27
0
/*-----------------------------------------------------------------*
 * open each of the appropriate /dev/input/event* files for input  */
void open_input(void)
{
	char *filename = NULL;
	glob_t globbuf;
	unsigned i;
	int fd;
	struct connection c;
	int had_some_success = 0;
	char evname[256];

	/* get all the matching event filenames */
	glob(INPUT_LAYER_FS, 0, NULL, &globbuf);

	/* for each event file */
	for (i = 0; i < globbuf.gl_pathc; ++i)
	{
		filename = globbuf.gl_pathv[i];

		fd = open(filename, O_RDONLY | O_NONBLOCK);
		if (fd >= 0) {
			/* get this event file's name */
			strcpy(evname, "Unknown");
			ioctl(fd, EVIOCGNAME(sizeof(evname)), evname);

			printf("%s (%s) opened successfully\n", filename, evname);
			had_some_success = 1;

			/* add a connection to the list */
			c.fd = fd;
			c.process = process_input;
			add_connection(&c);
		}
		else
		{
			if (had_some_success == 1)
				continue;
			int errno2 = errno;
			printf("open for %s failed: %s (%d)\n", 
				filename, strerror(errno2), errno2);
			if (errno2 == EACCES)
				printf("  (try running as root)\n");
			if (errno2 == ENOENT)
				printf("  (input layer driver may not be present)\n");
		}
	}

	globfree(&globbuf);
}
示例#28
0
static void
accept_callback(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t addrlen, void *data)
{
	struct Listener *listener = data;
	struct rb_sockaddr_storage lip;
	unsigned int locallen = sizeof(struct rb_sockaddr_storage);

	ServerStats.is_ac++;

	if(getsockname(rb_get_fd(F), (struct sockaddr *) &lip, &locallen) < 0)
	{
		/* this can fail if the connection disappeared in the meantime */
		rb_close(F);
		return;
	}

	add_connection(listener, F, addr, (struct sockaddr *)&lip);
}
示例#29
0
/*
 * We have a new incoming connection.  Accept the connection and start polling
 * for incoming packets.
 */
static void
incoming_connection(int fd, short revents, void *arg)
{
	struct sockaddr sa;
	socklen_t sa_len;
	int client_fd;
	struct node *node;

	for(;;) {
		sa_len = sizeof(sa);
		client_fd = accept4(fd, &sa, &sa_len, SOCK_NONBLOCK);
		if (client_fd == -1) {
			if (errno == EAGAIN || errno == EWOULDBLOCK)
				return;
			fail(NULL);
		}

		node = sockaddr_to_node(&sa, sa_len);
		if (!node) {
			char hbuf[NI_MAXHOST];
			int g;

			g = getnameinfo(&sa, sa_len, hbuf, sizeof(hbuf), NULL, 0,
					NI_NUMERICHOST);
			if (g) {
				fprintf(stderr, "%s\n", gai_strerror(g));
				exit(1);
			}
			fprintf(stderr, "Could not determine node-id for node at %s\n",
				hbuf);
			close(client_fd);
		} else {
			if (node->connecting_fd != -1) {
				close(node->connecting_fd);
				remove_poll_callback(&cbs, node->connecting_fd);
				node->connecting_fd = -1;
			}
			add_poll_callback(&cbs, client_fd, POLLIN, proto_read, node);
			add_connection(client_fd, node);
		}
	}
}
示例#30
0
void load_available_con(web_context * ctx){
  dirscan dir = scan_directories("shareinfo");
  for(size_t i = 0; i < dir.cnt; i++){
    char * f = dir.files[i];
    logd("File: %s\n", f);
    char fname[100];
    sprintf(fname, "shareinfo/%s", f);
    void * buffer = read_file_to_string(fname);
    void * bufptr = buffer;
    char * dir = udpc_unpack_string(&bufptr);
    char * name = udpc_unpack_string(&bufptr);
    char * service = udpc_unpack_string(&bufptr);
    if(NULL != get_connection_by_name(ctx, name)){
      dealloc(buffer);
      continue;
    }
    logd(" %s %s %s \n", dir, name, service);
    add_connection(ctx, name, service, dir);
    dealloc(buffer);
  }
}