Skip to content
Snippets Groups Projects
Select Git revision
  • struct-layout
  • master default protected
  • streebog
  • gost28147
  • master-updates
  • ed448
  • shake256
  • curve448
  • ecc-sqrt
  • gosthash94cp
  • cmac64
  • block16-refactor
  • siv-mode
  • cmac-layout
  • delete-des-compat
  • delete-rsa_blind
  • aes-struct-layout
  • release-3.4-fixes
  • attribute-deprecated
  • rename-data-symbols
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
  • nettle_3.5rc1
  • nettle_3.4.1_release_20181204
  • nettle_3.4.1rc1
  • nettle_3.4_release_20171119
  • nettle_3.4rc2
  • nettle_3.4rc1
  • nettle_3.3_release_20161001
  • nettle_3.2_release_20160128
  • nettle_3.1.1_release_20150424
  • nettle_3.1_release_20150407
  • nettle_3.1rc3
  • nettle_3.1rc2
  • nettle_3.1rc1
  • nettle_3.0_release_20140607
  • nettle_2.7.1_release_20130528
  • nettle_2.7_release_20130424
  • nettle_2.6_release_20130116
  • nettle_2.5_release_20120707
40 results

base64url-decode.c

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    select.c 4.60 KiB
    /* select.c, liboop, copyright 1999 Dan Egnor
    
       This is free software; you can redistribute it and/or modify it under the
       terms of the GNU Lesser General Public License, version 2.1 or later.
       See the file COPYING for details. */
    
    #include "oop.h"
    
    #include <assert.h>
    
    #ifdef HAVE_STRING_H
    #  include <string.h>	/* Needed on NetBSD1.1/SPARC due to bzero/FD_ZERO. */
    #endif
    
    #ifdef HAVE_STRINGS_H
    #  include <strings.h>  /* Needed on AIX 4.2 due to bzero/FD_ZERO. */
    #endif
    
    struct select_set {
    	fd_set rfd,wfd,xfd;
    };
    
    struct oop_adapter_select {
    	oop_source *source;
    	struct select_set watch,active;
    	struct timeval timeout;
    	int num_fd,do_timeout,is_active,num_fd_active;
    	oop_call_select *call;
    	void *data;
    };
    
    static oop_call_fd on_fd;
    static oop_call_time on_timeout,on_collect;
    
    oop_adapter_select *oop_select_new(
    	oop_source *source, 
    	oop_call_select *call,void *data)
    {
    	oop_adapter_select *s = oop_malloc(sizeof(*s));
    	if (NULL == s) return s;
    	s->source = source;
    	FD_ZERO(&s->watch.rfd);
    	FD_ZERO(&s->watch.wfd);
    	FD_ZERO(&s->watch.xfd);
    	FD_ZERO(&s->active.rfd);
    	FD_ZERO(&s->active.wfd);
    	FD_ZERO(&s->active.xfd);
    	s->num_fd = 0;
    	s->num_fd_active = 0;
    	s->do_timeout = 0;
    	s->is_active = 0;
    	s->call = call;
    	s->data = data;
    	return s;
    }
    
    static void *activate(oop_adapter_select *s) {
    	if (!s->is_active) {
    		s->is_active = 1;
    		s->source->on_time(s->source,OOP_TIME_NOW,on_collect,s);
    	}
    	return OOP_CONTINUE;
    }
    
    static void deactivate(oop_adapter_select *s) {
    	if (s->is_active) {
    		s->source->cancel_time(s->source,OOP_TIME_NOW,on_collect,s);
    		s->is_active = 0;
    		s->num_fd_active = 0;
    		FD_ZERO(&s->active.rfd);