Exemplo n.º 1
0
void dncp_ext_readable(dncp o)
{
  char buf[1024];
  size_t len = sizeof(buf);
  int r;
  struct sockaddr_in6 *src, *dst;
  dncp_ep ep;
  int flags;

  r = o->ext->cb.recv(o->ext, &ep, &src, &dst, &flags, buf, len);
  smock_pull_int_is("dncp_poll_io_recvfrom", r);
  if (r >= 0)
    {
      void *b = smock_pull("dncp_poll_io_recvfrom_buf");
      char *ifn = smock_pull("dncp_poll_io_recvfrom_ifname");
      struct sockaddr_in6 *esrc = smock_pull("dncp_poll_io_recvfrom_src");
      struct sockaddr_in6 *edst = smock_pull("dncp_poll_io_recvfrom_dst");

      sput_fail_unless(memcmp(b, buf, r)==0, "buf mismatch");
      sput_fail_unless(strcmp(ifn, ep->ifname) == 0, "ifname mismatch");
      sput_fail_unless(memcmp(src, esrc, sizeof(*src))==0, "src mismatch");
      sput_fail_unless(memcmp(&dst->sin6_addr,
                              &edst->sin6_addr, sizeof(dst->sin6_addr))==0,
                       "dst mismatch");
      if (!--pending_packets)
        uloop_end();
    }
}
Exemplo n.º 2
0
static void logread_fd_data_cb(struct ustream *s, int bytes)
{
	while (true) {
		int len;
		struct blob_attr *a;

		a = (void*) ustream_get_read_buf(s, &len);
		if (len < sizeof(*a) || len < blob_len(a) + sizeof(*a))
			break;
		log_notify(a);
		ustream_consume(s, blob_len(a) + sizeof(*a));
	}
	if (!log_follow)
		uloop_end();
}
Exemplo n.º 3
0
void dummy_callback(DNSServiceRef service,
                    DNSServiceFlags flags,
                    uint32_t ifindex,
                    DNSServiceErrorType error,
                    const char *name,
                    uint16_t rrtype,
                    uint16_t rrclass,
                    uint16_t rdlen,
                    const void *rdata,
                    uint32_t ttl,
                    void *context)
{
  printf("Callback - flags:%x ifindex:%u error:%d name:%s rrtype/class:%d/%d rrlen:%d ttl:%d\n",
         flags, ifindex, error, name, rrtype, rrclass, rdlen, ttl);
  if (!(flags & kDNSServiceFlagsMoreComing))
    uloop_end();
}
Exemplo n.º 4
0
Arquivo: trace.c Projeto: asac/procd
static void tracer_cb(struct uloop_process *c, int ret)
{
	if (WIFSTOPPED(ret) && WSTOPSIG(ret) & 0x80) {
		if (!in_syscall) {
			int syscall = ptrace(PTRACE_PEEKUSER, c->pid, reg_syscall_nr);

			if (syscall < syscall_max) {
				syscall_count[syscall]++;
				if (debug)
					fprintf(stderr, "%s()\n", syscall_names[syscall]);
			} else if (debug) {
				fprintf(stderr, "syscal(%d)\n", syscall);
			}
		}
		in_syscall = !in_syscall;
	} else if (WIFEXITED(ret)) {
		uloop_end();
		return;
	}
	ptrace(PTRACE_SYSCALL, c->pid, 0, 0);
	uloop_process_add(&tracer);
}
Exemplo n.º 5
0
static void handle_exit_signal(int signal)
{
	cancel_all_requests = true;
	uloop_end();
}
Exemplo n.º 6
0
static void ubus_easycwmpd_stop_callback(struct uloop_timeout *timeout)
{
	ubus_remove_object(ctx, &main_object);
	uloop_end();
}
Exemplo n.º 7
0
void intiface_mock(__unused struct iface_user *u, __unused const char *ifname, bool enabled)
{
	smock_push_bool(ifname, enabled);
	uloop_end();
}
Exemplo n.º 8
0
Arquivo: main.c Projeto: lynxis/netifd
static void
netifd_handle_signal(int signo)
{
	uloop_end();
}
Exemplo n.º 9
0
static void dump_timeout_callback(struct uloop_timeout *t)
{
	DEBUG("timeout reached, stopping capture\n");
	uloop_end();
}
Exemplo n.º 10
0
static void
handle_signal(int signo)
{
	uloop_end();
}
Exemplo n.º 11
0
static void ubus_sync_req_cb(struct ubus_request *req, int ret)
{
	req->status_msg = true;
	req->status_code = ret;
	uloop_end();
}