static void md_kbd_sched_immediate_shoot(int no_release) { action_pop();// REMOVE MD ITEM // stack operations are reversed! if (!no_release) // only release shutter if allowed { action_push_release(KEY_SHOOT_FULL); action_push_delay(20); } action_push(AS_MOTION_DETECTOR); // it will removed right after exit from this function kbd_key_press(KEY_SHOOT_FULL); // not a stack operation... pressing right now }
void * action_thread_main_loop (void *c) { ldap_context_t *context = c; action_t *action = NULL; int rc; int loop = 1; while( loop ){ action = action_pop(context->action_list); /* handle action */ if (action){ switch (action->type){ case LDAP_AUTH_ACTION_AUTH: if( DOINFO(context->verb ) ){ LOGINFO ( "Authentication requested for user %s", ((auth_context_t *)action->context)->username); } rc = la_ldap_handle_authentication( context, action ); /* we need to write the result to auth_control_file */ if( DODEBUG(context->verb ) ){ LOGDEBUG( "User %s: Writing %c to auth_control_file %s", ((auth_context_t *)action->context)->username, rc == OPENVPN_PLUGIN_FUNC_SUCCESS ? '1' : '0', ((auth_context_t *)action->context)->auth_control_file); } write_to_auth_control_file ( ((auth_context_t *)action->context)->auth_control_file, rc == OPENVPN_PLUGIN_FUNC_SUCCESS ? '1' : '0'); break; case LDAP_AUTH_ACTION_QUIT: if( DOINFO(context->verb ) ){ LOGINFO( "Authentication thread received ACTION_QUIT\n"); } loop = 0; break; default: LOGWARNING( "%s:%d %s() Unknown action %d", __FILE__, __LINE__, __FUNCTION__, action->type); } action_free( action ); } } pthread_exit (NULL); }
// Pop top func entry off the stack // Can only be called from an action stack long action_pop_func(int nParam) { for (; nParam >= 0; nParam--) action_pop(); return action_pop(); // Return function pointer / last parameter }