![]() |
![]() |
![]() |
libgebr Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum GebrCommServerType; enum GebrCommServerLocation; gchar * gebr_comm_server_get_user (const char *address
); GebrCommServerType gebr_comm_server_get_id (const gchar *name
); enum GebrCommServerState; struct GebrCommServer; void (*log_message) (GebrCommServer *server
,GebrLogMessageType type
,const gchar *message
,gpointer user_data
); void (*state_changed) (GebrCommServer *server
,gpointer user_data
); GString * (*ssh_login) (GebrCommServer *server
,const gchar *title
,const gchar *message
,gpointer user_data
); gboolean (*ssh_question) (GebrCommServer *server
,const gchar *title
,const gchar *message
,gpointer user_data
); void (*process_request) (GebrCommServer *server
,GebrCommHttpMsg *request
,gpointer user_data
); void (*process_response) (GebrCommServer *server
,GebrCommHttpMsg *request
,GebrCommHttpMsg *response
,gpointer user_data
); void (*parse_messages) (GebrCommServer *server
,gpointer user_data
); struct GebrCommServerClass; GebrCommServer * gebr_comm_server_new (const gchar *_address
,const gchar *gebr_id
,const struct gebr_comm_server_ops *ops
); const gchar * gebr_comm_server_get_last_error (GebrCommServer *server
); void gebr_comm_server_free (GebrCommServer *gebr_comm_server
); void gebr_comm_server_connect (GebrCommServer *server
,gboolean maestro
); void gebr_comm_server_disconnect (GebrCommServer *gebr_comm_server
); gboolean gebr_comm_server_is_logged (GebrCommServer *gebr_comm_server
); void gebr_comm_server_set_logged (GebrCommServer *server
); gboolean gebr_comm_server_is_local (GebrCommServer *gebr_comm_server
); void gebr_comm_server_kill (GebrCommServer *gebr_comm_server
); gboolean gebr_comm_server_forward_x11 (GebrCommServer *gebr_comm_server
,guint16 port
); const gchar * gebr_comm_server_state_to_string (GebrCommServerState state
); GebrCommServerState gebr_comm_server_state_from_string (const gchar *string
); GebrCommServerState gebr_comm_server_get_state (GebrCommServer *server
); void gebr_comm_server_set_password (GebrCommServer *server
,const gchar *pass
); void gebr_comm_server_answer_question (GebrCommServer *server
,gboolean response
); void gebr_comm_server_set_interactive (GebrCommServer *server
,gboolean setting
); void gebr_comm_server_emit_interactive_state_signals (GebrCommServer *server
); GebrCommTerminalProcess * gebr_comm_server_forward_remote_port (GebrCommServer *server
,guint16 remote_port
,guint16 local_port
); GebrCommTerminalProcess * gebr_comm_server_forward_local_port (GebrCommServer *server
,guint16 remote_port
,guint16 local_port
,const gchar *addr
); gboolean gebr_comm_server_append_key (GebrCommServer *server
,void *finished_callback
,gpointer user_data
); void gebr_comm_server_set_use_public_key (GebrCommServer *server
,gboolean use_key
); gboolean gebr_comm_server_get_use_public_key (GebrCommServer *server
); gboolean gebr_comm_server_is_maestro (GebrCommServer *server
); void gebr_comm_server_close_x11_forward (GebrCommServer *server
); void gebr_comm_server_maestro_connect_on_daemons (GebrCommServer *server
); GebrCommServerPriv;
typedef enum { GEBR_COMM_SERVER_TYPE_MOAB, GEBR_COMM_SERVER_TYPE_REGULAR, GEBR_COMM_SERVER_TYPE_UNKNOWN } GebrCommServerType;
typedef enum { GEBR_COMM_SERVER_LOCATION_UNKNOWN, GEBR_COMM_SERVER_LOCATION_LOCAL, GEBR_COMM_SERVER_LOCATION_REMOTE } GebrCommServerLocation;
typedef enum { SERVER_STATE_UNKNOWN, SERVER_STATE_DISCONNECTED, SERVER_STATE_RUN, SERVER_STATE_OPEN_TUNNEL, SERVER_STATE_CONNECT, SERVER_STATE_LOGGED, } GebrCommServerState;
struct GebrCommServer { GObject *parent; GebrCommProtocolSocket *socket; GebrCommServerPriv *priv; /* server address/port */ GString *address; guint16 port; gboolean ac; /* ssh stuff */ gboolean use_public_key; gchar *password; gboolean tried_existant_pass; gint16 tunnel_port; GebrCommTerminalProcess *x11_forward_process; GebrCommProcess *x11_forward_unix; gint ncores; gdouble clock_cpu; gchar *memory; gchar *model_name; GebrCommServerState state; enum gebr_comm_server_error { SERVER_ERROR_UNKNOWN, SERVER_ERROR_NONE, SERVER_ERROR_CONNECT, SERVER_ERROR_SERVER, SERVER_ERROR_SSH, };
void (*log_message) (GebrCommServer *server
,GebrLogMessageType type
,const gchar *message
,gpointer user_data
);
GString * (*ssh_login) (GebrCommServer *server
,const gchar *title
,const gchar *message
,gpointer user_data
);
gboolean (*ssh_question) (GebrCommServer *server
,const gchar *title
,const gchar *message
,gpointer user_data
);
void (*process_request) (GebrCommServer *server
,GebrCommHttpMsg *request
,gpointer user_data
);
void (*process_response) (GebrCommServer *server
,GebrCommHttpMsg *request
,GebrCommHttpMsg *response
,gpointer user_data
);
struct GebrCommServerClass { GObjectClass parent_class; void (*password_request) (GebrCommServer *server, const gchar *title, const gchar *message); void (*question_request) (GebrCommServer *server, const gchar *title, const gchar *message); };
GebrCommServer * gebr_comm_server_new (const gchar *_address
,const gchar *gebr_id
,const struct gebr_comm_server_ops *ops
);
const gchar * gebr_comm_server_get_last_error (GebrCommServer *server
);
void gebr_comm_server_connect (GebrCommServer *server
,gboolean maestro
);
gboolean gebr_comm_server_is_logged (GebrCommServer *gebr_comm_server
);
gboolean gebr_comm_server_forward_x11 (GebrCommServer *gebr_comm_server
,guint16 port
);
For the logged _gebr_comm_server_ forward x11 server _port_ to user display Fail if user's display is not set, returning FALSE. If any other x11 redirect was previously made it is unmade
const gchar * gebr_comm_server_state_to_string (GebrCommServerState state
);
GebrCommServerState gebr_comm_server_state_from_string (const gchar *string
);
GebrCommServerState gebr_comm_server_get_state (GebrCommServer *server
);
void gebr_comm_server_set_password (GebrCommServer *server
,const gchar *pass
);
Writes pass
into server
.
If server
is in interactive mode (see
gebr_comm_server_set_interactive()
) then pass
is written into server
only
if the signal "password-request" has been emitted.
Otherwise, if server
is in noninteractive mode, the password is cached for
the next connection, see gebr_comm_server_connect()
.
void gebr_comm_server_answer_question (GebrCommServer *server
,gboolean response
);
Writes a response into server
.
This method is similar to gebr_comm_server_set_password()
, but it can only
be called if a "question_request" signal was emitted. The
response
is the answer for a Yes or No question.
void gebr_comm_server_set_interactive (GebrCommServer *server
,gboolean setting
);
Whenever server
requires user interaction for typing password or answering
SSH question, server
will call the corresponding function in the operations
structure, but only if setting
is FALSE
, which is the default.
If setting
is TRUE
, then the corresponding signal will be called, but no
answer will be expected; server
will wait until one of these functions is
called: gebr_comm_server_set_password()
, gebr_comm_server_answer_question()
.
void gebr_comm_server_emit_interactive_state_signals
(GebrCommServer *server
);
If this server
is in interactive mode and it is requesting for user
interaction, this method will reemit the user interaction signals, mainly
"password-request" or "question-request".
Note that it is an error to call this method if server
is not in
interactive state.
See gebrm_comm_server_set_interactive()
.
GebrCommTerminalProcess * gebr_comm_server_forward_remote_port (GebrCommServer *server
,guint16 remote_port
,guint16 local_port
);
GebrCommTerminalProcess * gebr_comm_server_forward_local_port (GebrCommServer *server
,guint16 remote_port
,guint16 local_port
,const gchar *addr
);
gboolean gebr_comm_server_append_key (GebrCommServer *server
,void *finished_callback
,gpointer user_data
);
void gebr_comm_server_set_use_public_key (GebrCommServer *server
,gboolean use_key
);
gboolean gebr_comm_server_get_use_public_key (GebrCommServer *server
);
void gebr_comm_server_close_x11_forward (GebrCommServer *server
);
void gebr_comm_server_maestro_connect_on_daemons
(GebrCommServer *server
);