Skip to content
Snippets Groups Projects
Commit bbec2a66 authored by edgrif's avatar edgrif
Browse files

add request tag to xml.

parent 07c8d1e8
No related branches found
No related tags found
No related merge requests found
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
* *
* Exported functions: None * Exported functions: None
* HISTORY: * HISTORY:
* Last edited: Dec 19 09:58 2008 (edgrif) * Last edited: Aug 13 18:01 2009 (edgrif)
* Created: Thu May 5 18:19:30 2005 (rds) * Created: Thu May 5 18:19:30 2005 (rds)
* CVS info: $Id: zmapAppremote.c,v 1.37 2008-12-19 10:00:56 edgrif Exp $ * CVS info: $Id: zmapAppremote.c,v 1.38 2009-08-14 09:52:36 edgrif Exp $
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
...@@ -78,6 +78,8 @@ typedef struct ...@@ -78,6 +78,8 @@ typedef struct
static char *application_execute_command(char *command_text, gpointer app_context, int *statusCode); static char *application_execute_command(char *command_text, gpointer app_context, int *statusCode);
static gboolean start(void *userData, ZMapXMLElement element, ZMapXMLParser parser); static gboolean start(void *userData, ZMapXMLElement element, ZMapXMLParser parser);
static gboolean end(void *userData, ZMapXMLElement element, ZMapXMLParser parser); static gboolean end(void *userData, ZMapXMLElement element, ZMapXMLParser parser);
static gboolean req_start(void *userData, ZMapXMLElement element, ZMapXMLParser parser);
static gboolean req_end(void *userData, ZMapXMLElement element, ZMapXMLParser parser);
static void createZMap(ZMapAppContext app, RequestData request_data, ResponseContext response); static void createZMap(ZMapAppContext app, RequestData request_data, ResponseContext response);
static void send_finalised(ZMapXRemoteObj client); static void send_finalised(ZMapXRemoteObj client);
...@@ -85,10 +87,12 @@ static gboolean finalExit(gpointer data) ; ...@@ -85,10 +87,12 @@ static gboolean finalExit(gpointer data) ;
static ZMapXMLObjTagFunctionsStruct start_handlers_G[] = { static ZMapXMLObjTagFunctionsStruct start_handlers_G[] = {
{ "zmap", start }, { "zmap", start },
{ "request", req_start },
{ NULL, NULL } { NULL, NULL }
}; };
static ZMapXMLObjTagFunctionsStruct end_handlers_G[] = { static ZMapXMLObjTagFunctionsStruct end_handlers_G[] = {
{ "zmap", end }, { "zmap", end },
{ "request", req_end },
{ NULL, NULL } { NULL, NULL }
}; };
...@@ -131,11 +135,13 @@ void zmapAppRemoteInstaller(GtkWidget *widget, gpointer app_context_data) ...@@ -131,11 +135,13 @@ void zmapAppRemoteInstaller(GtkWidget *widget, gpointer app_context_data)
zMapXRemoteSetResponseAtomName(client, ZMAP_CLIENT_RESPONSE_ATOM_NAME); zMapXRemoteSetResponseAtomName(client, ZMAP_CLIENT_RESPONSE_ATOM_NAME);
req = g_strdup_printf("<zmap action=\"register_client\">\n" req = g_strdup_printf("<zmap>\n"
" <client xwid=\"0x%lx\" request_atom=\"%s\" response_atom=\"%s\" >\n" " <request action=\"register_client\">\n"
" <action>%s</action>\n" " <client xwid=\"0x%lx\" request_atom=\"%s\" response_atom=\"%s\" >\n"
" <action>%s</action>\n" " <action>%s</action>\n"
" </client>\n" " <action>%s</action>\n"
" </client>\n"
" </request>\n"
"</zmap>", "</zmap>",
id, id,
ZMAP_DEFAULT_REQUEST_ATOM_NAME, ZMAP_DEFAULT_REQUEST_ATOM_NAME,
...@@ -287,7 +293,9 @@ static void createZMap(ZMapAppContext app, RequestData request_data, ResponseCon ...@@ -287,7 +293,9 @@ static void createZMap(ZMapAppContext app, RequestData request_data, ResponseCon
static void send_finalised(ZMapXRemoteObj client) static void send_finalised(ZMapXRemoteObj client)
{ {
char *request = "<zmap action=\"finalised\" />"; char *request = "<zmap>\n"
" <request action=\"finalised\" />\n"
"</zmap>" ;
char *response = NULL; char *response = NULL;
g_return_if_fail(client != NULL); g_return_if_fail(client != NULL);
...@@ -314,7 +322,33 @@ static gboolean finalExit(gpointer data) ...@@ -314,7 +322,33 @@ static gboolean finalExit(gpointer data)
} }
/* all the action has been moved from <zmap> to <request> */
static gboolean start(void *user_data, ZMapXMLElement element, ZMapXMLParser parser) static gboolean start(void *user_data, ZMapXMLElement element, ZMapXMLParser parser)
{
gboolean handled = FALSE;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
RequestData request_data = (RequestData)user_data;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
return handled ;
}
static gboolean end(void *user_data, ZMapXMLElement element, ZMapXMLParser parser)
{
gboolean handled = TRUE ;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
RequestData request_data = (RequestData)user_data;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
return handled;
}
static gboolean req_start(void *user_data, ZMapXMLElement element, ZMapXMLParser parser)
{ {
gboolean handled = FALSE; gboolean handled = FALSE;
RequestData request_data = (RequestData)user_data; RequestData request_data = (RequestData)user_data;
...@@ -336,12 +370,12 @@ static gboolean start(void *user_data, ZMapXMLElement element, ZMapXMLParser par ...@@ -336,12 +370,12 @@ static gboolean start(void *user_data, ZMapXMLElement element, ZMapXMLParser par
} }
} }
else else
zMapXMLParserRaiseParsingError(parser, "Attribute 'action' is required for element 'zmap'."); zMapXMLParserRaiseParsingError(parser, "Attribute 'action' is required for element 'request'.");
return handled ; return handled ;
} }
static gboolean end(void *user_data, ZMapXMLElement element, ZMapXMLParser parser) static gboolean req_end(void *user_data, ZMapXMLElement element, ZMapXMLParser parser)
{ {
gboolean handled = TRUE ; gboolean handled = TRUE ;
RequestData request_data = (RequestData)user_data; RequestData request_data = (RequestData)user_data;
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
* the window code and the threaded server code. * the window code and the threaded server code.
* Exported functions: See ZMap.h * Exported functions: See ZMap.h
* HISTORY: * HISTORY:
* Last edited: Jun 12 14:41 2009 (edgrif) * Last edited: Aug 14 09:11 2009 (edgrif)
* Created: Thu Jul 24 16:06:44 2003 (edgrif) * Created: Thu Jul 24 16:06:44 2003 (edgrif)
* CVS info: $Id: zmapControl.c,v 1.94 2009-06-12 13:58:49 edgrif Exp $ * CVS info: $Id: zmapControl.c,v 1.95 2009-08-14 09:54:18 edgrif Exp $
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
...@@ -1046,7 +1046,7 @@ static void remoteSendViewClosed(ZMapXRemoteObj client, unsigned long xwid) ...@@ -1046,7 +1046,7 @@ static void remoteSendViewClosed(ZMapXRemoteObj client, unsigned long xwid)
char *request ; char *request ;
char *response = NULL; char *response = NULL;
request = g_strdup_printf("<zmap action=\"view_closed\" > <client xwid=\"0x%lx\" /> </zmap>", xwid) ; request = g_strdup_printf("<zmap> <request action=\"view_closed\"> <client xwid=\"0x%lx\" /> </request> </zmap>", xwid) ;
if (zMapXRemoteSendRemoteCommand(client, request, &response) != ZMAPXREMOTE_SENDCOMMAND_SUCCEED) if (zMapXRemoteSendRemoteCommand(client, request, &response) != ZMAPXREMOTE_SENDCOMMAND_SUCCEED)
{ {
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
* Exported functions: See zmapControl_P.h * Exported functions: See zmapControl_P.h
* *
* HISTORY: * HISTORY:
* Last edited: Dec 18 11:02 2008 (edgrif) * Last edited: Aug 13 17:26 2009 (edgrif)
* Created: Thu Jul 12 14:54:30 2007 (rds) * Created: Thu Jul 12 14:54:30 2007 (rds)
* CVS info: $Id: zmapControlRemoteReceive.c,v 1.4 2008-12-18 13:29:44 edgrif Exp $ * CVS info: $Id: zmapControlRemoteReceive.c,v 1.5 2009-08-14 09:55:20 edgrif Exp $
*------------------------------------------------------------------- *-------------------------------------------------------------------
*/ */
...@@ -104,6 +104,9 @@ static void findView(gpointer data, gpointer user_data) ; ...@@ -104,6 +104,9 @@ static void findView(gpointer data, gpointer user_data) ;
static gboolean xml_zmap_start_cb(gpointer user_data, static gboolean xml_zmap_start_cb(gpointer user_data,
ZMapXMLElement zmap_element, ZMapXMLElement zmap_element,
ZMapXMLParser parser); ZMapXMLParser parser);
static gboolean xml_request_start_cb(gpointer user_data,
ZMapXMLElement zmap_element,
ZMapXMLParser parser);
static gboolean xml_segment_end_cb(gpointer user_data, static gboolean xml_segment_end_cb(gpointer user_data,
ZMapXMLElement segment, ZMapXMLElement segment,
ZMapXMLParser parser); ZMapXMLParser parser);
...@@ -121,20 +124,26 @@ static gboolean control_execute_debug_G = FALSE; ...@@ -121,20 +124,26 @@ static gboolean control_execute_debug_G = FALSE;
static ZMapXMLObjTagFunctionsStruct control_starts_G[] = { static ZMapXMLObjTagFunctionsStruct control_starts_G[] = {
{ "zmap", xml_zmap_start_cb }, { "zmap", xml_zmap_start_cb },
{ "request", xml_request_start_cb },
#ifdef NOT_YET #ifdef NOT_YET
{ "featureset", xml_featureset_start_cb }, { "featureset", xml_featureset_start_cb },
{ "feature", xml_feature_start_cb }, { "feature", xml_feature_start_cb },
#endif #endif
{ "client", zMapXRemoteXMLGenericClientStartCB }, { "client", zMapXRemoteXMLGenericClientStartCB },
{NULL, NULL} {NULL, NULL}
}; };
static ZMapXMLObjTagFunctionsStruct control_ends_G[] = { static ZMapXMLObjTagFunctionsStruct control_ends_G[] = {
{ "zmap", xml_return_true_cb }, { "zmap", xml_return_true_cb },
{ "request", xml_return_true_cb },
{ "feature", xml_return_true_cb }, { "feature", xml_return_true_cb },
{ "segment", xml_segment_end_cb }, { "segment", xml_segment_end_cb },
#ifdef NOT_YET #ifdef NOT_YET
{ "subfeature", xml_subfeature_end_cb }, { "subfeature", xml_subfeature_end_cb },
#endif #endif
{ "location", xml_location_end_cb }, { "location", xml_location_end_cb },
{ "style", xml_style_end_cb }, { "style", xml_style_end_cb },
{NULL, NULL} {NULL, NULL}
...@@ -380,9 +389,23 @@ static void createClient(ZMap zmap, ZMapXRemoteParseCommandData input_data, Resp ...@@ -380,9 +389,23 @@ static void createClient(ZMap zmap, ZMapXRemoteParseCommandData input_data, Resp
/* Handlers */ /* Handlers */
/* all the action happens in <request> now. */
static gboolean xml_zmap_start_cb(gpointer user_data, ZMapXMLElement zmap_element, static gboolean xml_zmap_start_cb(gpointer user_data, ZMapXMLElement zmap_element,
ZMapXMLParser parser) ZMapXMLParser parser)
{ {
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
ZMapXRemoteParseCommandData parsing_data = (ZMapXRemoteParseCommandData)user_data;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
return FALSE;
}
static gboolean xml_request_start_cb(gpointer user_data, ZMapXMLElement zmap_element,
ZMapXMLParser parser)
{
ZMapXMLAttribute attr = NULL; ZMapXMLAttribute attr = NULL;
ZMapXRemoteParseCommandData parsing_data = (ZMapXRemoteParseCommandData)user_data; ZMapXRemoteParseCommandData parsing_data = (ZMapXRemoteParseCommandData)user_data;
GQuark action = 0; GQuark action = 0;
...@@ -410,7 +433,7 @@ static gboolean xml_zmap_start_cb(gpointer user_data, ZMapXMLElement zmap_elemen ...@@ -410,7 +433,7 @@ static gboolean xml_zmap_start_cb(gpointer user_data, ZMapXMLElement zmap_elemen
} }
else else
{ {
zMapXMLParserRaiseParsingError(parser, "action is a required attribute for zmap."); zMapXMLParserRaiseParsingError(parser, "action is a required attribute for request.");
parsing_data->common.action = ZMAPCONTROL_REMOTE_INVALID; parsing_data->common.action = ZMAPCONTROL_REMOTE_INVALID;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment