diff options
author | harsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-09-09 14:20:50 +0000 |
---|---|---|
committer | harsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-09-09 14:20:50 +0000 |
commit | ef74f56a131dbc88f95556ce76b67a1e71ff7133 (patch) | |
tree | 229314c99af16e5dd7686beaa53e11ef5593d1bc /src/testbed/testbed_api.c | |
parent | c6c6da39448bf2267db963005d31cf6d78158f14 (diff) |
error reporting in service_connect
git-svn-id: https://gnunet.org/svn/gnunet@23725 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/testbed/testbed_api.c')
-rw-r--r-- | src/testbed/testbed_api.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index 9171ce9476..fcbff70048 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c @@ -1758,4 +1758,33 @@ GNUNET_TESTBED_get_config_from_peerinfo_msg_ (const struct return cfg; } + +/** + * Checks the integrity of the OpeationFailureEventMessage and if good returns + * the error message it contains. + * + * @param msg the OperationFailureEventMessage + * @return the error message + */ +const char * +GNUNET_TESTBED_parse_error_string_ (const struct + GNUNET_TESTBED_OperationFailureEventMessage + *msg) +{ + uint16_t msize; + const char *emsg; + + msize = ntohs (msg->header.size); + if (sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage) == msize) + return NULL; + msize -= sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage); + emsg = (const char *) &msg[1]; + if ('\0' != emsg[msize]) + { + GNUNET_break (0); + return NULL; + } + return emsg; +} + /* end of testbed_api.c */ |