Ejemplo n.º 1
0
/* Radiobutton */
static gint cgraphics_radio_clicked_handler( GtkWidget *widget, widget_t *w )
{
    radiobutton_widget_t *rb = (radiobutton_widget_t *)w;
    radiogroup_t *grp = rb->group;

    grp->selected = rb;

    event_send( OBJECT(rb), "selected", "" );
    event_send( OBJECT(grp), "changed", "p", "value", rb );

    return 1;
}
Ejemplo n.º 2
0
MODULE send_time_slot_specifiers (THREAD *thread)
{
    msg_size = exdr_writed (&msg, SMT_SLOT_SPEC, "Tue 22:10-23");
    event_send (&slotq, &thread-> queue-> qid, "SPECIFY", msg_body, msg_size,
                NULL, NULL, NULL, 0);

    msg_size = exdr_writed (&msg, SMT_SLOT_SPEC, "Mon 6:50-9 12:00-15");
    event_send (&slotq, &thread-> queue-> qid, "SPECIFY", msg_body, msg_size,
                NULL, NULL, NULL, 0);

    msg_size = exdr_writed (&msg, SMT_SLOT_SPEC, "Thu 12:30-20:00");
    event_send (&slotq, &thread-> queue-> qid, "SPECIFY", msg_body, msg_size,
                NULL, NULL, NULL, 0);
}
Ejemplo n.º 3
0
MODULE connect_to_server (THREAD *thread)
{
    tcb = thread-> tcb;                 /*  Point to thread's context        */

    if (dns_debug_mode)
      {
        inaddr.s_addr = tcb-> cur_request-> ns_ip;
        coprintf ("Connect to : %s (%s) port %d",
                  inet_ntoa (inaddr),
                  tcb-> cur_request-> ns_name?
                      tcb-> cur_request-> ns_name: "",
                  ntohs (tcb-> cur_request-> ns_port));
      }
    tcb-> current_ns_ip = tcb-> cur_request-> ns_ip;
    msg_size = exdr_writed (&msg, SMT_SOCK_CONNECT,
        30,                             /*  Time out of connect              */
        "udp",
        NULL,
        NULL,
        ntohs (tcb-> cur_request-> ns_port),
        ntohl (tcb-> cur_request-> ns_ip),
        0);

    event_send (
        &sockq,                        /*  Send to specified queue           */
        &thread-> queue-> qid,         /*  Queue for reply                   */
        "CONNECT",                     /*  Name of event to send             */
        msg_body, msg_size,            /*  Event body and size               */
        NULL, NULL, NULL,              /*  No response events                */
        0);                            /*  No timeout                        */
}
Ejemplo n.º 4
0
MODULE send_host_name_value (THREAD *thread)
{
    USER_DATA
        *next_data,
        *user_data;

    tcb = thread-> tcb;                 /*  Point to thread's context        */

    if (tcb-> ip_address == 0
    &&  tcb-> ip_value)
        tcb-> ip_address = inet_addr (tcb-> ip_value);

    tcb-> send_responce = TRUE;
    user_data = tcb-> reply.next;
    while (user_data && (void *)user_data != (void *)&tcb-> reply)
      {
        next_data = user_data-> next;
        msg_size = exdr_writed (&msg, SMT_HOST_NAME, tcb-> ip_address,
                            tcb-> host_name, user_data-> tag);

        event_send (
            &user_data-> reply_to,      /*  Send to specified queue          */
            &thread-> queue-> qid,      /*  Queue for reply                  */
            "HOST_NAME",                /*  Name of event to send            */
            msg_body, msg_size,         /*  Event body and size              */
            NULL, NULL, NULL,           /*  No response events               */
            0);                         /*  No timeout                       */
        user_data = next_data;
      }
}
Ejemplo n.º 5
0
void event_poll::handle_poll()
{
    int event_cnt;
    while (looping()) {
        event_cnt = _poll.poll(_event, 1000);
        while (event_cnt > 0) {
            io_epoll::event ev =  _event.at(static_cast<size_t>(--event_cnt));
            tunnel * tun = (tunnel *)ev.data.ptr;
            if (io_epoll::ev_error(ev)) {
                event_remove(tun);

            } else {

                if (io_epoll::ev_recv(ev)) {
                    event_recv(tun);
                }

                if (io_epoll::ev_send(ev)) {
                    event_send(tun);
                }
            }
        }

        handle_event();

    }
}
Ejemplo n.º 6
0
int event_send_simple(EventType t, const void *data, unsigned int data_len, int fd)
{
	evt_t* evt=event_new(t, data, data_len);
	int ret=event_send((pipeevt_t*)evt, fd);
	free(evt);
	return ret;
}
Ejemplo n.º 7
0
int 
lsend_smtssl_error (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const qbyte code)               /*  Error code                       */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_error
                (&_body,
                 code);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_ERROR,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 8
0
int
lsend_ssl_write_request (QID *_to, QID *_from,
    char *_accept,
    char *_reject,
    char *_expire,
    word _timeout,
    dbyte timeout,                      /*  Timeout in seconds, zero = none  */
    qbyte socket,                       /*  Socket to write to               */
    word  size,                         /*  Amount of data to write          */
    byte *data,                         /*  Block of data to write           */
    qbyte tag)                          /*  User-defined request tag         */
{
    byte *_body;
    int   _size,
          _rc;

    _size = put_ssl_write_request (&_body, timeout, socket, size, data, tag);
    if (_size)
      {
        _rc = event_send (_to, _from, "SSL_WRITE_REQUEST",
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 9
0
int send_event_to_pipes(pipeevt_t* e)
{
	struct timeval to;
	to.tv_sec=1; to.tv_usec=0;
	fd_set set;
	memcpy(&set, &pipeset, sizeof(fd_set));
	int nfds=select(fd_max+1, NULL, &set, NULL, &to);
	if(nfds>0)
	{
		for(int i=0; i<=pipe_slot; ++i)
		{
			if(pipe_fds[i] != -1)
			{
				if(FD_ISSET(pipe_fds[i], &set))
				{
					int s=event_send(e, pipe_fds[i]);
					if(s<0)
					{
						//perror("Send");
						pipe_remove(pipe_fds[i]);
						continue;
					}
#ifndef NDEBUG
					else
					{
						printf("Sent %d bytes to pipe listener #%d\n", s, pipe_fds[i]);
					}
#endif
				}
			}
		}
	}
	return 0;
}
Ejemplo n.º 10
0
static void cgraphics_combo_changed_handler( GtkComboBox *widget, widget_t *cw )
{
	combo_widget_t *cbw = (combo_widget_t *)cw;
	int active = gtk_combo_box_get_active( widget );	
	list_item_t *item = 0, *curr;
//	node_t *n;
    int i, len;
	
	if ( active != -1 )
	{
		/*
        ST_FOREACH( n, cbw->widget.items.head )
		{
			curr = (list_item_t *)n->data;
			
			if ( curr->row == active )
				item = curr;
		}
        */

        len = claro_list_count(cbw->widget.items);

        for(i = 0; i < len; i++)
        {
            curr = (list_item_t *)claro_list_get_item(cbw->widget.items, i);
            
            if(curr->row == active)
                item = curr;
        }
	}
	
	cbw->selected = item;
	event_send( OBJECT(cw), "selected", "p", "row", item );
}
Ejemplo n.º 11
0
static window_event_result send_singleclick(const bool pressed, const unsigned button)
{
	const d_event_mousebutton event{pressed ? EVENT_MOUSE_BUTTON_DOWN : EVENT_MOUSE_BUTTON_UP, button};
	con_printf(CON_DEBUG, "Sending event EVENT_MOUSE_BUTTON_%s, button %d, coords %d,%d,%d",
			   pressed ? "DOWN" : "UP", event.button, Mouse.x, Mouse.y, Mouse.z);
	return event_send(event);
}
Ejemplo n.º 12
0
Archivo: stock.c Proyecto: Airr/Claro
static void val_free(void * v)
{
	object_t * object = (object_t*)v;
	if(!object->destroy_pending)
		event_send( object, "destroy", "" );
	printf("%s: %p\n", __FUNCTION__, v);
}
Ejemplo n.º 13
0
int 
lsend_smtssl_read_request (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const qbyte size)               /*  Maximum size to read             */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_read_request
                (&_body,
                 size);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_READ_REQUEST,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 14
0
int 
lsend_smtssl_put_slice (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const qbyte socket,             /*  Socket for output                */
    const char *filename,           /*  Name of file to send             */
    const qbyte start,              /*  Starting offset; 0 = start       */
    const qbyte end)                /*  Ending offset; 0 = end           */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_put_slice
                (&_body,
                 socket,
                 filename,
                 start,
                 end);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_PUT_SLICE,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 15
0
int 
lsend_smtssl_accepted (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const qbyte socket,             /*  Socket handle for SSL connection  */
    const char *user,               /*  User name                        */
    const char *cipher,             /*  Cipher used                      */
    const dbyte verify)             /*  Level of user verification       */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_accepted
                (&_body,
                 socket,
                 user,
                 cipher,
                 verify);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_ACCEPTED,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 16
0
int 
lsend_smtssl_write_ok (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const qbyte socket,             /*  Socket used for i/o, or new socket  */
    const qbyte tag)                /*  User-defined request tag         */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_write_ok
                (&_body,
                 socket,
                 tag);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_WRITE_OK,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 17
0
int 
lsend_smtssl_put_slice_ok (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const qbyte size)               /*  Amount of transmitted data       */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_put_slice_ok
                (&_body,
                 size);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_PUT_SLICE_OK,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 18
0
int 
lsend_smtssl_open_ok (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const dbyte port)               /*  SSL port opened                  */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_open_ok
                (&_body,
                 port);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_OPEN_OK,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 19
0
int 
lsend_smtssl_open (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const char *config)             /*  Configuration file to use        */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_open
                (&_body,
                 config);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_OPEN,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 20
0
int 
lsend_smtssl_read_ok (
    const QID  *_to,
    const QID  *_from,
          char *_accept,
          char *_reject,
          char *_expire,
          word _timeout,
    const word  size,               /*  Size of result                   */
    const void *data)               /*  Read data                        */
{
    byte *_body;
    int   _size,
          _rc;
    _size = put_smtssl_read_ok
                (&_body,
                 size,
                 data);
    if (_size)
      {
        _rc = event_send (_to, _from, SMTSSL_READ_OK,
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 21
0
int
lsend_set_rdns (QID *_to, QID *_from,
    char *_accept,
    char *_reject,
    char *_expire,
    word _timeout,
    char *primary,                      /*  Primary DNS server               */
    char *secondary,                    /*  Secondary DNS server             */
    Bool  recursive,                    /*  Do recursive lookups?            */
    Bool  debug)                        /*  Debug DNS queries?               */
{
    byte *_body;
    int   _size,
          _rc;

    _size = put_xixlog_set_rdns (&_body, primary, secondary, recursive, debug);
    if (_size)
      {
        _rc = event_send (_to, _from, "SET_RDNS",
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 22
0
int
lsend_open (QID *_to, QID *_from,
    char *_accept,
    char *_reject,
    char *_expire,
    word _timeout,
    char *log_path,                     /*  Path for logfiles, or empty      */
    char *log_file,                     /*  Name of logfile                  */
    char *log_format,                   /*  Desired logging format           */
    char *cycle_when,                   /*  When to cycle logfile            */
    char *cycle_how,                    /*  How to cycle logfile             */
    char *cycle_time,                   /*  For time-based cycling           */
    char *cycle_date,                   /*  For date-based cycling           */
    char *cycle_size,                   /*  For size-based cycling           */
    char *cycle_lines,                  /*  For size-based cycling           */
    char *cycle_argument,               /*  For other cycle methods          */
    Bool  translate)                    /*  Do reverse-DNS translation?      */
{
    byte *_body;
    int   _size,
          _rc;

    _size = put_xixlog_open (&_body, log_path, log_file, log_format, cycle_when, cycle_how, cycle_time, cycle_date, cycle_size, cycle_lines, cycle_argument, translate);
    if (_size)
      {
        _rc = event_send (_to, _from, "OPEN",
                          _body, _size,
                          _accept, _reject, _expire, _timeout);
        mem_free (_body);
        return _rc;
      }
    else
        return -1;
}
Ejemplo n.º 23
0
static gint cgraphics_textbox_keypress_handler( GtkWidget *widget, GdkEventKey *e, widget_t *w )
{
	int ucs4 = gdk_keyval_to_unicode(e->keyval);
	gchar * utf8 = g_ucs4_to_utf8(&ucs4, 1, NULL, NULL, NULL);
	int r = event_send( w, "key_down", "i", "key", (int)utf8[0] );
	g_free(utf8);
	return r;
}
Ejemplo n.º 24
0
void object_realize( object_t *object )
{
	object_run_class_realize( object, object->class_type->info );
	
	object->realized = 1;
	
	event_send( object, "realized", "" );
}
Ejemplo n.º 25
0
int event_send_simple_to_addr(EventType t, const void *data, unsigned int data_len, const char* addr, unsigned short port, int fd)
{
	evt_t* evt=event_new(t, data, data_len);
	memcpy(evt->addr, addr, IPV4_MAX);
	evt->port=port;
	int ret=event_send((pipeevt_t*)evt, fd);
	free(evt);
	return ret;
}
Ejemplo n.º 26
0
int
lsend_clear (QID *_to, QID *_from,
    char *_accept,
    char *_reject,
    char *_expire,
    word _timeout)
{
    return (event_send (_to, _from, "CLEAR", NULL, 0, _accept,
            _reject, _expire, _timeout));
}
Ejemplo n.º 27
0
int
lsend_ssl_close (QID *_to, QID *_from,
    char *_accept,
    char *_reject,
    char *_expire,
    word _timeout)
{
    return (event_send (_to, _from, "SSL_CLOSE", NULL, 0, _accept,
            _reject, _expire, _timeout));
}
Ejemplo n.º 28
0
int
lsend_ssl_restart (QID *_to, QID *_from,
    char *_accept,
    char *_reject,
    char *_expire,
    word _timeout)
{
    return (event_send (_to, _from, "SSL_RESTART", NULL, 0, _accept,
            _reject, _expire, _timeout));
}
Ejemplo n.º 29
0
MODULE flush_timeout_alarm (THREAD *thread)
{
    event_send (
        &timeq,                         /*  Send to specified queue          */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "FLUSH",                        /*  Name of event to send            */
        NULL, 0,                        /*  No event body                    */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */
}
Ejemplo n.º 30
0
static window_event_result maybe_send_doubleclick(const fix64 now, const unsigned button)
{
	auto &when = Mouse.time_lastpressed[button];
	const auto then = when;
	when = now;
	if (now > then + F1_0/5)
		return window_event_result::ignored;
	const d_event_mousebutton event{EVENT_MOUSE_DOUBLE_CLICKED, button};
	con_printf(CON_DEBUG, "Sending event EVENT_MOUSE_DOUBLE_CLICKED, button %d, coords %d,%d", button, Mouse.x, Mouse.y);
	return event_send(event);
}