コード例 #1
0
ファイル: usbnet.c プロジェクト: pettair/libusbnet
int usb_set_altinterface(usb_dev_handle *dev, int alternate)
{
   // Get remote fd
   Packet* pkt = pkt_claim();
   int fd = session_get();

   // Prepare packet
   pkt_init(pkt, UsbSetAltInterface);
   pkt_addint(pkt, dev->fd);
   pkt_addint(pkt, alternate);
   pkt_send(pkt, fd);

   // Get response
   int res = -1;
   if(pkt_recv(fd, pkt) > 0 && pkt_op(pkt) == UsbSetAltInterface) {
      Iterator it;
      pkt_begin(pkt, &it);

      // Read result
      res = iter_getint(&it);

      // Read callback configuration
      alternate = iter_getint(&it);
   }

   // Save configuration
   dev->altsetting = alternate;

   // Return response
   pkt_release();
   debug_msg("returned %d", res);
   return res;
}
コード例 #2
0
ファイル: main.c プロジェクト: hiciu/ekg2
/*
 * logs_session_var_changed()
 *
 * "session-variable-changed" handler
 */
static QUERY(logs_session_var_changed) {
	char *session	= *(va_arg(ap, char**));
	char *var	= *(va_arg(ap, char**));
	int i;

	if (!logs_logs || (0 == logs_logs->len))
		return 0;

	if (!xstrcmp(var, "log_formats")) {
		session_t *s = session_find(session);
		int newformat = logs_log_format(s);

		debug_function("logs_session_var_changed() s=%s, %s=%s\n", session, var, session_get(s, var));

		for (i = logs_logs->len - 1; 0 <= i; i--) {
			logs_log_t *ll = g_ptr_array_index(logs_logs, i);
			if (LOG_FORMAT_RAW == ll->format) continue;
			if (xstrcmp(ll->session, session)) continue;
			if (ll->format != newformat)
				logs_log_reopen(ll);
		}
	}

	return 0;
}
コード例 #3
0
ファイル: usbnet.c プロジェクト: pettair/libusbnet
/* libusb(5):
 * Interrupt transfers.
 */
int usb_interrupt_write(usb_dev_handle *dev, int ep, usb_buf_t bytes, int size, int timeout)
{
   // Get remote fd
   Packet* pkt = pkt_claim();
   int fd = session_get();

   // Prepare packet
   pkt_init(pkt, UsbInterruptWrite);
   pkt_addint(pkt, dev->fd);
   pkt_addint(pkt, ep);
   pkt_addstr(pkt, size, bytes);
   pkt_addint(pkt, timeout);
   pkt_send(pkt, fd);

   // Get response
   int res = -1;
   if(pkt_recv(fd, pkt) > 0 && pkt_op(pkt) == UsbInterruptWrite) {
      Iterator it;
      pkt_begin(pkt, &it);
      res = iter_getint(&it);
   }

   // Return response
   pkt_release();
   debug_msg("returned %d", res);
   return res;
}
コード例 #4
0
ファイル: usbnet.c プロジェクト: pettair/libusbnet
int usb_close(usb_dev_handle *dev)
{
   // Get remote fd
   Packet* pkt = pkt_claim();
   int fd = session_get();

   // Send packet
   pkt_init(pkt, UsbClose);
   pkt_addint(pkt, dev->fd);
   pkt_send(pkt, fd);

   // Free device
   free(dev);

   // Get response
   int res = -1;
   if(pkt_recv(fd, pkt) > 0 && pkt_op(pkt) == UsbClose) {
      Iterator it;
      pkt_begin(pkt, &it);
      res = iter_getint(&it);
   }

   pkt_release();
   debug_msg("returned %d", res);
   return res;
}
コード例 #5
0
ファイル: application_local.c プロジェクト: chrisy/vpp
static void
ct_session_close (u32 ct_index, u32 thread_index)
{
  ct_connection_t *ct, *peer_ct;
  app_worker_t *app_wrk;
  session_t *s;

  ct = ct_connection_get (ct_index);
  peer_ct = ct_connection_get (ct->peer_index);
  if (peer_ct)
    {
      peer_ct->peer_index = ~0;
      session_transport_closing_notify (&peer_ct->connection);
    }

  s = session_get (ct->c_s_index, 0);
  app_wrk = app_worker_get_if_valid (s->app_wrk_index);
  if (app_wrk)
    app_worker_del_segment_notify (app_wrk, ct->segment_handle);
  session_free_w_fifos (s);
  if (ct->is_client)
    segment_manager_dealloc_fifos (ct->client_rx_fifo, ct->client_tx_fifo);

  ct_connection_free (ct);
  ct_enable_disable_main_pre_input_node (0 /* is_add */ );
}
コード例 #6
0
ファイル: usbnet.c プロジェクト: pettair/libusbnet
int usb_get_driver_np(usb_dev_handle *dev, int interface, char *name, unsigned int namelen)
{
   // Get remote fd
   Packet* pkt = pkt_claim();
   int fd = session_get();

   // Send packet
   pkt_init(pkt, UsbGetKernelDriver);
   pkt_addint(pkt,  dev->fd);
   pkt_addint(pkt,  interface);
   pkt_adduint(pkt, namelen);
   pkt_send(pkt, fd);

   // Get response
   int res = -1;
   if(pkt_recv(fd, pkt) > 0 && pkt_op(pkt) == UsbGetKernelDriver) {
      Iterator it;
      pkt_begin(pkt, &it);
      res = iter_getint(&it);

      // Error
      if(res) {
         error_msg("%s: could not get bound driver", __func__);
      }

      // Save string
      strncpy(name, iter_getstr(&it), namelen - 1);
      name[namelen - 1] = '\0';
   }

   pkt_release();
   debug_msg("returned %d (%s)", res, name);
   return res;
}
コード例 #7
0
ファイル: usbnet.c プロジェクト: pettair/libusbnet
int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout)
{
   // Get remote fd
   Packet* pkt = pkt_claim();
   int fd = session_get();

   // Prepare packet
   pkt_init(pkt, UsbInterruptRead);
   pkt_addint(pkt, dev->fd);
   pkt_addint(pkt, ep);
   pkt_addint(pkt, size);
   pkt_addint(pkt, timeout);
   pkt_send(pkt, fd);

   // Get response
   int res = -1;
   if(pkt_recv(fd, pkt) > 0 && pkt_op(pkt) == UsbInterruptRead) {
      Iterator it;
      pkt_begin(pkt, &it);
      res = iter_getint(&it);

      if(res > 0) {
         int minlen = (res > size) ? size : res;
         memcpy(bytes, it.val, minlen);
      }

   }

   // Return response
   pkt_release();
   debug_msg("returned %d", res);
   return res;
}
コード例 #8
0
int
session_tx_fifo_peek_bytes (transport_connection_t * tc, u8 * buffer,
			    u32 offset, u32 max_bytes)
{
  session_t *s = session_get (tc->s_index, tc->thread_index);
  return svm_fifo_peek (s->tx_fifo, offset, max_bytes, buffer);
}
コード例 #9
0
ファイル: server_io.c プロジェクト: marc-inn/tin
int s_lock (IncomingRequest *inc_request)
{
    FsResponse response;
    FsLockC data_c = inc_request->request.data.lock;
    int server_handler = data_c.server_handler;
    int fd = data_c.fd;

    if (session_check_if_exist(server_handler) == -1)
    {
        response.answer= EC_SESSION_TIMED_OUT;
        response.data.lock.status = -1;
        status = sendto(sockd, &response, sizeof(FsResponse), 0,(struct sockaddr*) &(inc_request->client_addr), inc_request->client_addr_len);
        return -1;
    }

    int file = session_get (server_handler, fd);

    if (file == -1)
    {
        VDP0 ("Could not get file descriptor in lock\n");
        response.data.lock.status = -1;
    }
    else
    {
        // @todo ustawiamy flocka jedynie gdy chcemy czytac cos po kryjomu
        response.data.lock.status = flock(file, data_c.mode);
    }

    return sendto(sockd, &response, sizeof(FsResponse), 0,(struct sockaddr*) &(inc_request->client_addr), inc_request->client_addr_len);
}
コード例 #10
0
ファイル: server_io.c プロジェクト: marc-inn/tin
int s_lseek (IncomingRequest *inc_request)
{
    FsResponse response;
    FsLseekC data_c = inc_request->request.data.lseek;
    int server_handler = data_c.server_handler;
    int fd = data_c.fd;

    if (session_check_if_exist(server_handler) == -1)
    {
        response.answer= EC_SESSION_TIMED_OUT;
        response.data.lseek.status = -1;
        status = sendto(sockd, &response, sizeof(FsResponse), 0,(struct sockaddr*) &(inc_request->client_addr), inc_request->client_addr_len);
        return -1;
    }

    int file = session_get (server_handler, fd);

    if (file == -1)
    {
        VDP0 ("Could not get file descriptor in lseek\n");
        response.data.lseek.status = -1;
    }
    else
    {
        off_t offset = lseek (file, data_c.offset, data_c.whence);
        if (offset < 0) offset = 0;
        off_t status = session_set_offset (server_handler, fd, offset);
        if (status < 0) response.answer = EF_ACCESS_ERROR;
        response.data.lseek.status = status;
    }

    return sendto(sockd, &response, sizeof(FsResponse), 0,(struct sockaddr*) &(inc_request->client_addr), inc_request->client_addr_len);
}
コード例 #11
0
ファイル: usbnet.c プロジェクト: pettair/libusbnet
usb_dev_handle *usb_open(struct usb_device *dev)
{
   // Get remote fd
   Packet* pkt = pkt_claim();
   int fd = session_get();

   // Send packet
   pkt_init(pkt, UsbOpen);
   pkt_adduint(pkt, dev->bus->location);
   pkt_adduint(pkt, dev->devnum);
   pkt_send(pkt, fd);

   // Get response
   int res = -1, devfd = -1;
   if(pkt_recv(fd, pkt) > 0 && pkt_op(pkt) == UsbOpen) {
      Iterator it;
      pkt_begin(pkt, &it);
      res = iter_getint(&it);
      devfd = iter_getint(&it);
   }

   // Evaluate
   usb_dev_handle* udev = NULL;
   if(res >= 0) {
      udev = malloc(sizeof(usb_dev_handle));
      udev->fd = devfd;
      udev->device = dev;
      udev->bus = dev->bus;
      udev->config = udev->interface = udev->altsetting = -1;
   }

   pkt_release();
   debug_msg("returned %d (fd %d)", res, devfd);
   return udev;
}
コード例 #12
0
ファイル: usbnet.c プロジェクト: pettair/libusbnet
int usb_reset(usb_dev_handle *dev)
{
   // Get remote fd
   Packet* pkt = pkt_claim();
   int fd = session_get();

   // Prepare packet
   pkt_init(pkt, UsbReset);
   pkt_addint(pkt, dev->fd);
   pkt_send(pkt, fd);

   // Get response
   int res = -1;
   if(pkt_recv(fd, pkt) > 0 && pkt_op(pkt) == UsbReset) {
      Iterator it;
      pkt_begin(pkt, &it);

      // Read result
      res = iter_getint(&it);
   }

   // Return response
   pkt_release();
   debug_msg("returned %d", res);
   return res;
}
コード例 #13
0
ファイル: application_local.c プロジェクト: chrisy/vpp
session_t *
ct_session_get_peer (session_t * s)
{
  ct_connection_t *ct, *peer_ct;
  ct = ct_connection_get (s->connection_index);
  peer_ct = ct_connection_get (ct->peer_index);
  return session_get (peer_ct->c_s_index, 0);
}
コード例 #14
0
ファイル: session.c プロジェクト: emmanuj/kemi
/* Check if we have data waiting. */
NBBOOL session_data_waiting(sessions_t *sessions, char *session_name)
{
	session_t *session = session_get(sessions, session_name);
	if(!session)
		return FALSE;

	return buffer_can_read_int8(session->buffer) || buffer_can_read_int8(sessions->buffer_data);
}
コード例 #15
0
ファイル: session.c プロジェクト: emmanuj/kemi
uint32_t session_get_seq(sessions_t *sessions, char *session_name)
{
	session_t *session = session_get(sessions, session_name);
	if(!session)
		return -1;

	session->seq = session->seq + 1;

	return session->seq;
}
コード例 #16
0
u32
session_tx_fifo_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
{
  session_t *s = session_get (tc->s_index, tc->thread_index);

  if (svm_fifo_needs_tx_ntf (s->tx_fifo, max_bytes))
    session_dequeue_notify (s);

  return svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
}
コード例 #17
0
ファイル: session.c プロジェクト: emmanuj/kemi
/* This is the "front door" for data coming into the session through
 * stdin. When data arrives on stdin, the data should be passed to this
 * function. If the session is actually using stdin for input, this will
 * be read and, more then likely, come back out a session_read() call.
 */
static void session_feed(sessions_t *sessions, char *name, uint8_t *data, uint32_t length)
{
	session_t *session = session_get(sessions, name);

	if(!session)
	{
		fprintf(stderr, "Session not found: %s\n", name);
		return;
	}

	buffer_add_bytes(session->buffer, data, length);
}
コード例 #18
0
/*
 * Enqueue data for delivery to session peer. Does not notify peer of enqueue
 * event but on request can queue notification events for later delivery by
 * calling stream_server_flush_enqueue_events().
 *
 * @param tc Transport connection which is to be enqueued data
 * @param b Buffer to be enqueued
 * @param offset Offset at which to start enqueueing if out-of-order
 * @param queue_event Flag to indicate if peer is to be notified or if event
 *                    is to be queued. The former is useful when more data is
 *                    enqueued and only one event is to be generated.
 * @param is_in_order Flag to indicate if data is in order
 * @return Number of bytes enqueued or a negative value if enqueueing failed.
 */
int
session_enqueue_stream_connection (transport_connection_t * tc,
				   vlib_buffer_t * b, u32 offset,
				   u8 queue_event, u8 is_in_order)
{
  session_t *s;
  int enqueued = 0, rv, in_order_off;

  s = session_get (tc->s_index, tc->thread_index);

  if (is_in_order)
    {
      enqueued = svm_fifo_enqueue (s->rx_fifo,
				   b->current_length,
				   vlib_buffer_get_current (b));
      if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_NEXT_PRESENT)
			 && enqueued >= 0))
	{
	  in_order_off = enqueued > b->current_length ? enqueued : 0;
	  rv = session_enqueue_chain_tail (s, b, in_order_off, 1);
	  if (rv > 0)
	    enqueued += rv;
	}
    }
  else
    {
      rv = svm_fifo_enqueue_with_offset (s->rx_fifo, offset,
					 b->current_length,
					 vlib_buffer_get_current (b));
      if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_NEXT_PRESENT) && !rv))
	session_enqueue_chain_tail (s, b, offset + b->current_length, 0);
      /* if something was enqueued, report even this as success for ooo
       * segment handling */
      return rv;
    }

  if (queue_event)
    {
      /* Queue RX event on this fifo. Eventually these will need to be flushed
       * by calling stream_server_flush_enqueue_events () */
      session_worker_t *wrk;

      wrk = session_main_get_worker (s->thread_index);
      if (!(s->flags & SESSION_F_RX_EVT))
	{
	  s->flags |= SESSION_F_RX_EVT;
	  vec_add1 (wrk->session_to_enqueue[tc->proto], s->session_index);
	}
    }

  return enqueued;
}
コード例 #19
0
ファイル: session.c プロジェクト: emmanuj/kemi
NBBOOL session_is_closed(sessions_t *sessions, char *session_name)
{
	session_t *session;

	session = session_get(sessions, session_name);

	if(!session)
		return FALSE;

	if(session->is_eof && !session_data_waiting(sessions, session_name))
		return TRUE;

	return FALSE;
}
コード例 #20
0
ファイル: usbnet.c プロジェクト: pettair/libusbnet
/** Initialize USB subsystem. */
void usb_init(void)
{
   // Initialize packet & remote fd
   Packet* pkt = pkt_claim();
   int fd = session_get();

   // Create buffer
   pkt_init(pkt, UsbInit);
   pkt_send(pkt, fd);
   pkt_release();

   // Initialize locally
   debug_msg("called");
}
コード例 #21
0
ファイル: xmsg.c プロジェクト: dmilith/ekg2-bsd
/* kind = 0 for sent, 1 for toobig */
static void xmsg_unlink_dotfiles(session_t *s, const char *varname)
{
	if (session_int_get(s, varname)) {
		const int kind = !xstrcasecmp(varname, "unlink_sent");
		const int maxfs = session_int_get(s, "max_filesize");
		const char *dfsuffix = session_get(s, "dotfile_suffix");
		const char *dir = xmsg_dirfix(session_uid_get(s)+XMSG_UID_DIROFFSET);
		DIR *d;
		struct dirent *de;
		struct stat st, std;
		char *df, *dfd, *dp, *dpd;
		
		if (!dir || !(d = opendir(dir))) {
			xdebug("unable to open specified directory");
			return;
		}
		
		df = xmalloc(xstrlen(dir) + NAME_MAX + 2);
		dfd = xmalloc(xstrlen(dir) + NAME_MAX + 3 + xstrlen(dfsuffix));
		xstrcpy(df, dir);
		dp = df + xstrlen(df);
		*(dp++) = '/';
		xstrcpy(dfd, df);
		dpd = dfd + xstrlen(dfd);
		*(dpd++) = '.';
		
		while ((de = readdir(d))) {
			if (de->d_name[0] == '.')
				continue;
			if (xstrlen(de->d_name) > NAME_MAX) {
				xdebug2(DEBUG_ERROR, "Filename longer than NAME_MAX (%s), skipping.", de->d_name);
				continue;
			}
			xstrcpy(dp, de->d_name);
			xstrcpy(dpd, de->d_name);
			xstrcat(dpd, dfsuffix);
			if (!stat(df, &st) && !stat(dfd, &std)
					&& ((!maxfs || (st.st_size < maxfs)) == kind)) {
				xdebug("removing %s", de->d_name);
				unlink(df);
				unlink(dfd);
			}
		}

		closedir(d);
		xfree(df);
		xfree(dfd);
	}
}
コード例 #22
0
ファイル: sessiontest.c プロジェクト: macrofengye/cweb
int cgiMain() {
	int result;
#ifdef DEBUG
	fprintf(stderr, "========== LED.CGI Start ===========.\n");
#endif
	// 初始化 session
	session_start(g_session_datadir);

	do {
		if (session_get("USERNAME") != NULL) {
			if (strcmp(session_get("USERNAME"), g_login_username) == 0) {
				result = control_process();
				break;
			}
		}
		result = login_process();
	} while (0);

#ifdef DEBUG
	fprintf(cgiOut, "========== LED.CGI End ===========.\n");
#endif

	return result;
}
コード例 #23
0
ファイル: session.c プロジェクト: emmanuj/kemi
void session_initialize(sessions_t *sessions, char *session_name, uint32_t seq)
{
	if(!session_get(sessions, session_name))
	{
		session_t *session;
		fprintf(stderr, "Creating new session %s with sequence number %d\n", session_name, seq);
		session = session_create(sessions, session_name, seq);

		/* If we're in exec mode, attach the process. */
		/* TODO: This is likely where I'll bind it to a socket. */
		if(sessions->exec)
		{
			session_attach_process(sessions, session, sessions->exec);
		}
	}
}
コード例 #24
0
ファイル: python-session.c プロジェクト: dmilith/ekg2-bsd
PyObject *ekg_session_get(ekg_sessionObj * self, PyObject * key)
{
	const char * name = PyString_AsString(key);
	const char * out;
	char buf[100];
	session_t * s;
	s = session_find(self->name);
	debug("[python] Getting '%s' value for '%s' session\n", name, self->name);
	out = session_get(s, name);
	if (out) {
		return Py_BuildValue("s", out);
	} else {
		snprintf(buf, 99, "Can't find variable '%s'", name);
		PyErr_SetString(PyExc_KeyError, buf);
		Py_INCREF(Py_None);
		return Py_None;
	}
}
コード例 #25
0
ファイル: main.c プロジェクト: hiciu/ekg2
static int logs_log_format(session_t *s) {
	const char *log_formats;

	if (config_logs_log == LOG_FORMAT_NONE)
		return LOG_FORMAT_NONE;

	if (!s || !(log_formats = session_get(s, "log_formats")))
		return LOG_FORMAT_NONE;

	if (xstrstr(log_formats, "irssi"))
		return LOG_FORMAT_IRSSI;
	if (config_logs_log == LOG_FORMAT_SIMPLE && xstrstr(log_formats, "simple"))
		return LOG_FORMAT_SIMPLE;
	if (config_logs_log == LOG_FORMAT_XML && xstrstr(log_formats, "xml"))
		return LOG_FORMAT_XML;

	return LOG_FORMAT_NONE;
}
コード例 #26
0
ファイル: connection.c プロジェクト: xf22001/homeserver
static void exec_asp( connection* conn )
{
	char key[20];
	key[16] = '\0';
	cookie_get( conn, "SESSIONKEY", key, 16 );
	conn->session = session_get( conn->client, key );
	if( !conn->session ){
		conn->code = 500;
	}else{
		if( !(*key) || strcmp( conn->session->key, key ) != 0 )
			cookie_set( conn, "SESSIONKEY", "/", -1, conn->session->key );
		NEW( conn->data_send, MAX_DATASEND+4 );
		conn->data_size = 0;
		if( vdir_exec( conn->server, conn->current_dir, conn ) < 0 ){
			conn->code = 404;
		}
		if( !conn->data_size )
			conn->data_size = strlen( conn->data_send );
	}
}
コード例 #27
0
ファイル: session.c プロジェクト: emmanuj/kemi
/* Read data from the session that will be sent out across the network. This
 * will return up to read_length bytes (and will return the number of bytes
 * read in read_length as well). The memory returned has to be freed. 
 *
 * If the session isn't found, NULL is returned. If no data is waiting, the
 * empty string is returned and read_length is set to 0. 
 */
uint8_t *session_read(sessions_t *sessions, char *session_name, uint32_t *read_length)
{
	uint32_t i = 0;

	buffer_t *incoming;
	buffer_t *response;
	session_t *session;

	session = session_get(sessions, session_name);
	if(!session)
		return NULL;

	if(session_is_closed(sessions, session_name))
		return NULL;

	if(buffer_can_read_int8(sessions->buffer_data))
	{
		incoming = sessions->buffer_data;
	}
	else
	{
		if(!session)
			return NULL;
		incoming = session->buffer;
	}

	response = buffer_create(BO_NETWORK);
	while(buffer_can_read_int8(incoming) && i < *read_length)
	{
		if(sessions->log)
			fputc(buffer_peek_next_int8(incoming), sessions->log);
		buffer_add_int8(response, buffer_read_next_int8(incoming));
		i++;
	}

	/* Clear whichever buffer we're using if we're at the end. */
	if(!buffer_can_read_int8(incoming))
		buffer_clear(incoming);

	return buffer_create_string_and_destroy(response, read_length);
}
コード例 #28
0
ファイル: session.c プロジェクト: emmanuj/kemi
NBBOOL session_validate_seq(sessions_t *sessions, char *name, uint32_t seq, NBBOOL do_increment)
{
	session_t *session = session_get(sessions, name);
	if(!session)
	{
		fprintf(stderr, "Session %s doesn't exist; accepting sequence number %d\n", name, seq);
		return TRUE;
	}

	/* Note: we have to validate against the next sequence number. */
	if(seq != session->seq + (do_increment ? 1 : 0))
	{
		fprintf(stderr, "Failed to validate sequence number for session %s (sequence should be %d, was %d)\n", name, session->seq, seq);
		return FALSE;
	}

	if(do_increment)
		session->seq = session->seq + 1;

	return TRUE;
}
コード例 #29
0
bool test_tcp_closed_state_handle_6( void )
{
    struct sk_buff *skb;
    struct session_entry *session;
    struct tuple tuple;
    bool success = true;

    if (!init_tuple_for_test_ipv6( &tuple, IPPROTO_TCP ))
    	return false;
    if (!(skb = init_packet_type_for_test( PACKET_TYPE_V6_SYN )))
        return false;

    success &= assert_true(tcp_closed_state_handle( skb, &tuple ), "V6 syn-result");

    session = session_get( &tuple );
    success &= assert_not_null(session, "V6 syn-session.");
    if (session)
    	success &= assert_equals_u8(V6_INIT, session->state, "V6 syn-state");
    kfree_skb(skb);

    return success;
}
コード例 #30
0
ファイル: sync.c プロジェクト: Commers/obexd
static DBusMessage *sync_getphonebook(DBusConnection *connection,
			DBusMessage *message, void *user_data)
{
	struct session_data *session = user_data;
	struct sync_data *syncdata = session_get_data(session);

	if (session->msg)
		return g_dbus_create_error(message,
			ERROR_INF ".InProgress", "Transfer in progress");

	/* set default phonebook_path to memory internal phonebook */
	if (!syncdata->phonebook_path)
		syncdata->phonebook_path = g_strdup("telecom/pb.vcf");

	if (session_get(session, "phonebook", syncdata->phonebook_path, NULL,
				NULL, 0, sync_getphonebook_callback) < 0)
		return g_dbus_create_error(message,
			ERROR_INF ".Failed", "Failed");

	session->msg = dbus_message_ref(message);

	return NULL;
}