00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef REMOTE__H
00029 #define REMOTE__H
00030
00031
00032 #define REMO_PIPEBROKEN 0
00033 #define REMO_CMD 1
00034 #define REMO_INVALID_CMD 2
00035 #define REMO_QUIT 3
00036
00037 #define CMDFKTARGS gchar **arglist, gpointer data
00038
00039 enum REMOTE_TYP { REMO_ACTION, REMO_MENUACTION, REMO_SETENTRY, REMO_CBACTION, REMO_ENDLIST };
00040
00041 typedef struct remote_action_cb {
00042 gchar *cmd;
00043 void (*RemoteCb)(GtkWidget *widget , gpointer data);
00044 GtkWidget *widget;
00045 gpointer data;
00046 };
00047
00048 typedef struct remote_cmd {
00049 char *cmd;
00050 int (*CmdFkt)(CMDFKTARGS);
00051 gpointer data;
00052 };
00053
00054 typedef struct remote_verb {
00055 REMOTE_TYP typ;
00056 char *verb;
00057 remote_cmd *cmd_list;
00058 };
00059
00060 class remote{
00061 public:
00062 remote();
00063 virtual ~remote();
00064
00065 void rcopen(gchar *crtlfifo, gchar *statfifo=NULL);
00066 void rcclose();
00067
00068 int writestatus(gchar *mld);
00069 gboolean readfifo(GIOChannel *src);
00070 virtual int eval(char *cmdstr);
00071
00072 void wait(gint w){ waitflg=w; };
00073 gint waiting(){ return waitflg; };
00074 virtual void waitfkt(){};
00075 protected:
00076 gint remotefifo;
00077 gint statusfifo;
00078 private:
00079 gint waitflg;
00080 };
00081
00082 class remote_crtl : public remote{
00083 public:
00084 remote_crtl(remote_verb *rvlist);
00085 virtual ~remote_crtl();
00086
00087 virtual int eval(char *cmdstr);
00088 virtual int addcmd(gchar **cmdargvlist)=0;
00089 virtual int checkentry(gchar **cmdargvlist)=0;
00090 virtual int checkactions(gchar **cmdargvlist)=0;
00091 virtual void waitfkt(){};
00092
00093 void senderror(char *errstr);
00094 void sendcmd(char *cmd, char *arg, gchar **arglist);
00095 void quit();
00096
00097 int ExecAction(gchar **arglist);
00098
00099 protected:
00100 private:
00101 int FindFktExec(char *cmd, char *arg, gchar **arglist);
00102
00103 remote_verb *rlist;
00104 remote_cmd *rfkt;
00105 char *rarg;
00106 };
00107
00108 #endif
00109