The `OP_...` enum is meant to only represent commands list.
Then make the list from the NG commands macro
the actual source of truth for the enum count.
This eliminates human mistakes, when introducing a new command,
because no more need to update enum manually.
Additionally:
- move the command list macro to the header
- existing extern declarations remain untouched
- `OP_OTHER` remains sentinel
- eventually replace the manual enum with macro based one
Change-Id: I33d928367fe0a254571cb0b7d4aafe4445b30b77
Instead of keeping separate arrays (essentially it's
a duplication) for command strings, escaped strings
or short version of commands, just create one single
macro pattern, which keeps these as an array.
And then using designated array initializers,
use the marco pattern to generate accordingly
an array of the required type (usual strings,
those escaped or the short version of them).
This prevents the human mistakes, or at least
makes them less possible in case of new command
introduction.
Change-Id: I27271ed4852f95760424552ce66fc8bc340c76a3
The dict pretty printer advances from key to value
by `chld = chld->sibling` and then prints the `chld`.
If a malformed dict ever reaches this func
with an odd number of child nodes, this can dereference NULL.
Just add guard against NULL.
Change-Id: Ia24671a5eba06dda8c48515fd9dc45fe7a9ec371
In order to understand whether is must be initialized.
And use a given parser pointer to do so. This can be native or
json parser.
Remove previously introduced bool param, which was used
for differentiation.
Change-Id: I6d0bb083fe4dea5625d40175c8978fffaca6d34f
There is a dedicated JSON parser, so use this.
Also leave some TODO'ers to think about adding own
`parser_arg` for JSON-like formatted data.
Change-Id: I5399ffb6ec74e88887b52fd63b96a8e44428c495
If already having the local ptr, then why not to use it,
instead of using directly the globally visible object.
In the `control_ng_process_payload()` add a pointer
to the `ng_parser_json` parser.
Change-Id: I9d656733991e2d99c18aa1cc6d705ed053f57f0a
When preparing a response, especially for the case of error,
we already make sure to init the resp ctx. So just add
a helper for this, because same routine used.
Also optionally init parser as native (dict) if required.
Some of the cases like data is <= 0 length, or
there has been not dict or JSON format spotted,
then init as native.
Change-Id: I7d13669075525b754e1950e3212b79800b20f85a
In case the data length is <= 0, or there has been
no dictionary-like or json-like format spotted in the
NG incoming control message, then treat parser
as native (so dict) by default.
Otherwise not possible to initilize the command context,
and hence the error treatment wouldn't be
able to prepare the response properly.
Change-Id: I99b9c571a9112a25e474dfc39e21cce15fc5f634
If any caller passes NULL for item callback and
then receives a JSON with a nested object/list/int, this can crash.
Change-Id: I69fbb9fec76305f6e1ed9ea5b25a50a7ee85c454
Allocate dict enough in-time for the `command_ctx.resp`,
because a plenty of the `err_send` gotos, having this alias
appending something to the dict, will use it uninitialized.
Change-Id: I9114e7b02437e47de256b8fc88faf993329f083f
Resolve file name conflicts between different components
Ensure shared log levels are identical across components
Encapsulates lib/*
Change-Id: If848d6fa0e4cd8eac88ce9e63ee77fc5a7a481fd
New NG protocol commands that mix audio from a source participant
into a destination participant's stream without a full offer/answer
exchange.
- inject start: creates one-way subscription with audio_player mixing
- inject stop: removes injection and restores original codec routing
- Supports cross-call injection via source-call-id (merges calls internally)
- inject attribute persisted through Redis for HA failover
- Audio-only; matches media by media-id, index, then type fallback
Closes#2082
Change-Id: Ib88113b021a4b76bf98892eb1af60c0b36c0d6d3
Simply take the xmlrpc-callback address as string and don't try to parse
it out. Store it in the call object as string as well.
Obsolete `created_from_addr`. The string form `created_from` is all we
need.
Change `created_from` to `str` as well.
Change-Id: Ib67b57b1d2d474d7b033f56ef8be59f71e44641b
The GLib slice allocator has been obsoleted. Having a mixture of two
allocators can lead to hidden issues on systems that use different
implementations. Take the leap and replace everything with g_new/g_free.
Change-Id: I025c8383ef47b2c2472573360407fd6a6ca339b3
Change old code to directly return `str` objects instead of pointers to
allocated ones. Largely a no-op change but makes some code easier and
eliminates some old kludges.
Change-Id: I2be19dd24bb7ff046d86cc32a3af235283e65dd0
Make the macro return the appropriate pointer type, and make sure the
free function takes an argument of the same type. This also eliminates
some boilerplate type-casting code.
Change-Id: I3094271fa2c53ec93b9ff9f837d461cf422e0f12
The opmode is already determined uniquely when processing the NG
command. There is no need to explicitly set it again elsewhere. Simply
carry along the originally determined opmode.
Change-Id: I16924264b0337423aff6763c70a4b2c6dd3687db
There is enough overlap between the two enums that it doesn't make sense
to carry along both. Unify.
Change-Id: I9de8fbdb8d78a2002d8c1b62cea57188c937d61d
Convenience wrapper for &STR()
This is useful so that STR() and STR_DUP() can be extended to avoid
duplicate expansion of its macro arguments.
Change-Id: Ieae170807c11b0cdd8b52fac9bab98dccdc2b951