00001 /* 00002 * $Id: util.h 47 2010-11-24 01:59:04Z julianthome $ 00003 * 00004 * pam_netns - Linux-PAM module for instantiating session network namespaces 00005 * 00006 * Copyright (C) 2010 Wilhelm Meier (wilhelm.meier@fh-kl.de) 00007 * 00008 * This program is free software; you can redistribute it and/or modify it under the terms of 00009 * the GNU General Public License as published by the Free Software Foundation; 00010 * either version 3 of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00013 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00014 * See the GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along with this program; 00017 * if not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00027 #ifndef UTIL_H 00028 #define UTIL_H 00029 00035 typedef enum { 00036 INITIAL, 00038 BEFORE_COMPLETE, 00040 UNSHARE_COMPLETE, 00042 AFTER_COMPLETE, 00044 SETUP_COMPLETE, 00046 SESSION_CLOSED 00048 } pam_netns_state_t; 00049 00056 typedef struct { 00057 char shm_name[UNIX_PATH_MAX]; 00059 pthread_mutex_t mutex; 00061 pthread_cond_t cv; 00063 pam_netns_state_t state; 00065 } pam_netns_shm_t; 00066 00075 int wait_for_state(pam_netns_shm_t * mod_shm, pam_netns_state_t state); 00076 00085 int wait_for_state_inf(pam_netns_shm_t * mod_shm, pam_netns_state_t state); 00086 00095 int set_state(pam_netns_shm_t * mod_shm, pam_netns_state_t state); 00096 00097 #endif