Index: trunk/Ohana/src/opihi/include/pcontrol.h
===================================================================
--- trunk/Ohana/src/opihi/include/pcontrol.h	(revision 7917)
+++ trunk/Ohana/src/opihi/include/pcontrol.h	(revision 8297)
@@ -9,8 +9,9 @@
   PCONTROL_JOB_PENDING,
   PCONTROL_JOB_BUSY,  
+  PCONTROL_JOB_HUNG,  
+  PCONTROL_JOB_DONE,  
+  PCONTROL_JOB_KILL,  
   PCONTROL_JOB_EXIT,
   PCONTROL_JOB_CRASH,
-  PCONTROL_JOB_HUNG,  
-  PCONTROL_JOB_DONE,  
 } JobStat;
 
@@ -93,6 +94,9 @@
 typedef struct {
   void **object;
+  char **name;
+  int   *id;
   int    Nobject;
   int    NOBJECT;
+  // pthread_mutex_t mutex;
 } Stack;
 
@@ -107,23 +111,19 @@
 void InitPcontrol ();
 
-void *GetStack (Stack *stack, int where);
-int PutStack (Stack *stack, int where, void *object);
+/*** StackOps.c ***/
 Stack *InitStack ();
-Stack *GetHostStack (int StackID);
-int PutHost (Host *host, int StackID, int where);
-Host *GetHost (int StackID, int where);
-int FindHost (IDtype HostID, int StackID);
-Host *FindHostPtr (IDtype HostID, int StackID);
-Host *FindHostStack (IDtype HostID);
-int FindNamedHostStack (char *name);
-Host *PullHost (IDtype HostID, int StackID);
-int FindNamedHost (char *name, int StackID);
-IDtype AddHost (char *hostname);
-void DownHost (Host *host);
-void OffHost (Host *host);
-void DelHost (Host *host);
+int    PushStack (Stack *stack, int where, void *object, int id, char *name);
+void  *PullStackByLocation (Stack *stack, int where);
+void  *PullStackByName (Stack *stack, char *name);
+void  *PullStackByID (Stack *stack, int id);
+void  *FindStackByID (Stack *stack, int id);
+void  *FindStackByName (Stack *stack, char *name);
+void   LockStack (Stack *stack);
+void   UnlockStack (Stack *stack);
+
 int CheckSystem ();
 int CheckBusyJobs (float delay);
 int CheckDoneJobs (float delay);
+int CheckKillJobs (float delay);
 int CheckDoneHosts (float delay);
 int CheckLiveHosts (float delay);
@@ -144,28 +144,49 @@
 int rconnect (char *command, char *hostname, char *shell, int *stdio);
 int CheckHost (Host *host);
-Stack *GetJobStack (int StackID);
-Stack *GetJobStackByName (char *name);
-int PutJob (Job *job, int StackID, int where);
-Job *GetJob (int StackID, int where);
-int FindJob (IDtype JobID, int StackID);
-Job *FindJobPtr (IDtype JobID, int StackID);
-Job *FindJobStack (IDtype JobID);
-Job *PullJob (IDtype JobID, int StackID);
-IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv);
-int KillJob (Job *job);
-void DelJob (Job *job);
-Host *UnlinkJobAndHost (Job *job);
-void LinkJobAndHost (Job *job, Host *host);
-int StopHost (Host *host);
 
 int PrintJobStack (int Nstack);
 int PrintHostStack (int Nstack);
-void InitJobStacks ();
-void InitHostStacks ();
-void DownHost (Host *host);
-void OffHost (Host *host);
-int DownHosts ();
-int VerboseMode ();
-int StartJob (Job *job);
-void gotsignal (int signum);
-int HarvestHost (int pid);
+
+int    VerboseMode ();
+
+void   gotsignal (int signum);
+
+/*** HostOps.c ***/
+void   InitHostStacks ();
+Stack *GetHostStack (int StackID);
+Stack *GetHostStackByName (char *name);
+int    PutHost (Host *host, int StackID, int where);
+Host  *PullHostByID (IDtype HostID, int *StackID);
+Host  *PullHostByName (char *name, int *StackID);
+Host  *PullHostFromStackByID (int StackID, IDtype ID);
+Host  *PullHostFromStackByName (int StackID, char *name);
+Host  *FindHostByID (IDtype HostID, int *StackID);
+Host  *FindHostByName (char *name, int *StackID);
+Host  *FindHostInStackByID (int StackID, IDtype ID);
+Host  *FindHostInStackByName (int StackID, char *name);
+IDtype AddHost (char *hostname);
+void   DelHost (Host *host);
+
+void   DownHost (Host *host);
+void   OffHost (Host *host);
+int    DownHosts ();
+int    HarvestHost (int pid);
+int    StopHost (Host *host);
+
+/*** JobOps.c ***/
+void   InitJobStacks ();
+Stack *GetJobStack (int StackID);
+Stack *GetJobStackByName (char *name);
+int    PutJob (Job *job, int StackID, int where);
+int    PutJobSetState (Job *job, int StackID, int where, int state);
+Job   *PullJobByID (IDtype JobID, int *StackID);
+Job   *PullJobFromStackByID (int StackID, int ID);
+Job   *FindJobByID (IDtype JobID, int *StackID);
+Job   *FindJobInStackByID (int StackID, int ID);
+IDtype AddJob (char *hostname, JobMode mode, int timeout, int argc, char **argv);
+void   DelJob (Job *job);
+Host  *UnlinkJobAndHost (Job *job);
+void   LinkJobAndHost (Job *job, Host *host);
+
+int    KillJob (Job *job);
+int    StartJob (Job *job);
