mgcp_verify_ci(): return meaningful error codes
Instead of just -1, return RFC3435 error codes that can be used to compose a
FAIL message response. Note that the return value stays compatible in that it
returns 0 on a valid Connection Identifier, nonzero otherwise.
The idea is to be able to distinguish between "Conn ID not found" and "Conn ID
invalid" in mgcp_test.c's expected output, in upcoming change
I8d6cc96be252bb486e94f343a8c7cae641ff9429.
Change-Id: Ifc17f2893cc4b9a865f3ffcb9888bbf1039337a6
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 7f4a7b8..bc191b5 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -999,10 +999,8 @@
break;
case 'I':
conn_id = (const char *)line + 3;
- if (mgcp_verify_ci(endp, conn_id) != 0) {
- error_code = 515;
+ if ((error_code = mgcp_verify_ci(endp, conn_id)))
goto error3;
- }
break;
case 'L':
local_options = (const char *)line + 3;
@@ -1185,10 +1183,8 @@
break;
case 'I':
conn_id = (const char *)line + 3;
- if (mgcp_verify_ci(endp, conn_id) != 0) {
- error_code = 515;
+ if ((error_code = mgcp_verify_ci(endp, conn_id)))
goto error3;
- }
break;
case 'Z':
silent = strcmp("noanswer", line + 3) == 0;