Esempio n. 1
0
/* Eingehende Nachricht vom Client verarbeiten */
void server_handle_message(netcp_message *m) {
	switch (m->type) {
	case SET_BUFFER:
		if (debuglevel > 1)
			printf("> Buffersize: %lu\n", m->data.buffersize);
		buffersize = m->data.buffersize;
		server_send_ok();
		break;
	case TERMINATE:
		if (debuglevel > 1)
			printf("> Terminate\n");
		server_send_ok();
		server_terminate();
		break;
	case CLOSE:
		if (debuglevel > 1)
			printf("> Close\n");
		server_close();
		break;
	case FILENAME:
		if (debuglevel > 1)
			printf("> Filename: %s\n", m->data.filename);
		if (server_open_target(m->data.filename)) {
			server_send_ok();
		} else {
			server_send_error();
		}
		break;
	case BEGIN_DATA:
		if (debuglevel > 1)
			printf("> Begin data\n");
		server_send_ok();
		break;
	case END_DATA:
		if (debuglevel > 1)
			printf("> End data\n");
		server_close_target();
		server_send_ok();
		break;
	case DATA:
		if (debuglevel > 2)
			printf("> data\n");
		server_read_data();
		server_send_ok();
		break;
	case GET:
		if (debuglevel > 1)
			printf("> copy to client\n");
		server_copy_to_client();
		break;
	case GET_BUFFER:
		if (debuglevel > 1)
			printf("> send_buffer\n");
		server_send_buffer();
		break;
	default:
		server_send_ok();
		break;
	}
}
Esempio n. 2
0
static int server_value_add (lcc_server_t *srv, /* {{{ */
    const lcc_value_list_t *vl)
{
  int status;

  status = lcc_network_buffer_add_value (srv->buffer, vl);
  if (status == 0)
    return (0);

  server_send_buffer (srv);
  return (lcc_network_buffer_add_value (srv->buffer, vl));
} /* }}} int server_value_add */