gwenhywfar  4.3.1
process.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     begin       : Sat Dec 27 2003
00003     copyright   : (C) 2003-2010 by Martin Preuss
00004     email       : martin@libchipcard.de
00005 
00006 
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This library is free software; you can redistribute it and/or         *
00010  *   modify it under the terms of the GNU Lesser General Public            *
00011  *   License as published by the Free Software Foundation; either          *
00012  *   version 2.1 of the License, or (at your option) any later version.    *
00013  *                                                                         *
00014  *   This library is distributed in the hope that it will be useful,       *
00015  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00016  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00017  *   Lesser General Public License for more details.                       *
00018  *                                                                         *
00019  *   You should have received a copy of the GNU Lesser General Public      *
00020  *   License along with this library; if not, write to the Free Software   *
00021  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00022  *   MA  02111-1307  USA                                                   *
00023  *                                                                         *
00024  ***************************************************************************/
00025 
00026 
00027 #ifndef GWENHYWFAR_PROCESS_H
00028 #define GWENHYWFAR_PROCESS_H
00029 
00030 #include <gwenhywfar/gwenhywfarapi.h>
00031 #include <gwenhywfar/types.h>
00032 #include <gwenhywfar/syncio.h>
00033 #include <gwenhywfar/error.h>
00034 
00036 #define GWEN_PROCESS_FLAGS_REDIR_STDIN  0x00000001
00037 
00038 #define GWEN_PROCESS_FLAGS_REDIR_STDOUT 0x00000002
00039 
00040 #define GWEN_PROCESS_FLAGS_REDIR_STDERR 0x00000004
00041 
00042 #define GWEN_PROCESS_FLAGS_DEFAULT 0
00043 
00044 
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048 
00049   typedef struct GWEN_PROCESS GWEN_PROCESS;
00050 
00054   typedef enum {
00056     GWEN_ProcessStateNotStarted=0,
00058     GWEN_ProcessStateRunning,
00060     GWEN_ProcessStateExited,
00063     GWEN_ProcessStateAborted,
00065     GWEN_ProcessStateStopped,
00067     GWEN_ProcessStateUnknown
00068   } GWEN_PROCESS_STATE;
00069 
00070 
00075   GWENHYWFAR_API GWEN_PROCESS *GWEN_Process_new(void);
00076 
00083   GWENHYWFAR_API void GWEN_Process_free(GWEN_PROCESS *pr);
00084 
00089   GWENHYWFAR_API
00090     uint32_t GWEN_Process_GetFlags(const GWEN_PROCESS *pr);
00091 
00096   GWENHYWFAR_API
00097     void GWEN_Process_SetFlags(GWEN_PROCESS *pr, uint32_t f);
00098 
00103   GWENHYWFAR_API
00104     void GWEN_Process_AddFlags(GWEN_PROCESS *pr, uint32_t f);
00105 
00110   GWENHYWFAR_API
00111     void GWEN_Process_SubFlags(GWEN_PROCESS *pr, uint32_t f);
00112 
00120   GWENHYWFAR_API GWEN_PROCESS_STATE GWEN_Process_Start(GWEN_PROCESS *pr,
00121                                                        const char *prg,
00122                                                        const char *args);
00123 
00127   GWENHYWFAR_API GWEN_PROCESS_STATE GWEN_Process_CheckState(GWEN_PROCESS *pr);
00128 
00133   GWENHYWFAR_API int GWEN_Process_GetResult(GWEN_PROCESS *pr);
00134 
00138   GWENHYWFAR_API int GWEN_Process_Wait(GWEN_PROCESS *pr);
00139 
00145   GWENHYWFAR_API int GWEN_Process_Terminate(GWEN_PROCESS *pr);
00146 
00152   GWENHYWFAR_API
00153     GWEN_SYNCIO *GWEN_Process_GetStdin(const GWEN_PROCESS *pr);
00154 
00160   GWENHYWFAR_API
00161     GWEN_SYNCIO *GWEN_Process_GetStdout(const GWEN_PROCESS *pr);
00162 
00168   GWENHYWFAR_API
00169     GWEN_SYNCIO *GWEN_Process_GetStderr(const GWEN_PROCESS *pr);
00170 
00171 
00172 #ifdef __cplusplus
00173 }
00174 #endif
00175 
00176 
00177 #endif /* GWENHYWFAR_PROCESS_H */
00178 
00179