Use an atomic enum to track state: idle, running, stopping, or stopped.
Use atomic compare and exchange to ensure consistency without requiring
a mutex.
Never detach threads. Always require a join. This makes for an easy and
reliable way to wait for a thread to finish.
Provide a default on_stop so that it can be omitted in child classes.
Change-Id: Id59942638b7f769090ac91c2049b7d934e876ffc
Use a manual lock to make read/write operations
to the `std::map<DSMModule*, void*> mods_hdls` safer.
Change-Id: I45fb46bab603e2817bd98cd99267ed813122e548
Just add the following flags,
which are affecting the usage in our newer functionality:
- ssl
- crypto
Change-Id: Ia3edf1b77316fd64f7f55a5d2600fee730a285b4
Take into account that par2, used to pass N-th
amount of parameters, is properly exploded into
separate string objects having no spaces and
escaped double-quotes. Otherwise resolution fails.
Fixes:
[runactions, DSMStateEngine.cpp:334] DEBUG: executing 'utils.playRingTone(0, $config.rbt_on, $config.rbt_off, $config.rbt_f, $config.rbt_f2)'
[str2int, AmUtils.cpp:353] DEBUG: str2i: unexpected char 0x24 in $config.rbt_off
[execute, ModUtils.cpp:554] WARNING: could not decipher ringtone parameter 1: ' $config.rbt_off', using default
[str2int, AmUtils.cpp:353] DEBUG: str2i: unexpected char 0x24 in $config.rbt_f
[execute, ModUtils.cpp:554] WARNING: could not decipher ringtone parameter 2: ' $config.rbt_f', using default
[str2int, AmUtils.cpp:353] DEBUG: str2i: unexpected char 0x24 in $config.rbt_f2
[execute, ModUtils.cpp:554] WARNING: could not decipher ringtone parameter 3: ' $config.rbt_f2', using default
[execute, ModUtils.cpp:560] DEBUG: Playing ringtone length 0, on 1000, off 4000, f 440, f2 480
Change-Id: Ifed353478464d8071b5ca64959a7d4de6c877c8f
New functions introduced for DSM API (mod_utils):
- encryptCodeAes128CBC()
- decryptCodeAes128CBC()
Will be used by the voucher DSM application to encrypt/decrypt
the code given by a subscriber when filling up the balance.
OpenSSL AES128 CBC is used as an algorithm.
(with default AES key size 16 bytes)
Required things to let it be working:
- base64 encoding/decoding (of binary raw data)
- padding based on default AES key size (16)
Change-Id: I4b47f49ebf4b61157c3a4631cd8302565c660bc3
read() and write() return ssize_t. Update variables and other affected
class members. Pointer arithmetic also returns ssize_t.
Fixes a potential overflow.
Change-Id: I411ad648777fdba5c0fd59f9f7721a2971b60e1d
Warned-by: Coverity
Use overloading for the various flavours of str2int functions. This has
the benefit of automatically choosing the appropriate function for
aliased types that may be one or the other underlying type, such as
size_t.
Do a mass renaming of all relevant instances.
Change-Id: I7abb6b9031ee53332d2b04a6cba4a6cc667a4807
Initialize `from_addr` just setting it all to zero.
Fixes:
*** CID 545189: Uninitialized members (UNINIT_CTOR)
/core/sip/udp_trsp.cpp: 265 in udp_trsp::udp_trsp(udp_trsp_socket *)()
259 msg.msg_name = &from_addr;
260 msg.msg_namelen = sizeof(sockaddr_storage);
261 msg.msg_iov = iov;
262 msg.msg_iovlen = 1;
263 msg.msg_control = dst_addr_buf;
264 msg.msg_controllen = DSTADDR_DATASIZE;
>>> CID 545189: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "from_addr.__ss_align" is not initialized in this constructor nor in any functions that it calls.
265 }
266
267 udp_trsp::~udp_trsp()
268 {
269 }
270
Change-Id: I7f960e6b41c6d7dfec4f70a91d0e7b37f7675127
Properly handle in the second `setRegistrationTimer`'s
overloading, wheread peerings used to not get
an insertion of timer into own dedicated map.
Change-Id: Ib793ed6a6eb13447d27321eab59957d1bec2aabf
Don't re-use a stupid code to check the type each
time it needs to printed somewhere in logs.
Just use the macro function to handle this job.
Change-Id: I942f4f3b0730fa3c66ce6df10e0e1ff109e09bd5
Don't use std::string, because all multiple
conditions based on that in the code, make code
comparisons quite heavy in comparison to enum usage.
So just use enum type with default `TYPE_UNDEFINED`.
Refactor code accordingly and remove superfluous
code that now isn't required.
Change-Id: Icf29579cd3b93a1624854bd0a47610fc061c64e6
Before to actually do any work based on that
we have to check if it actually dereferences anything
reasonable.
Change-Id: I736b7f44c9702ac49fbab967f6baea2be5279d74
Just refactoring, no func changes.
Fixes things like:
*** CID 545192: Uninitialized members (UNINIT_CTOR)
/apps/db_reg_agent/DBRegAgent.cpp: 73 in RegTimer::RegTimer()()
67 }
68
69 long object_id = 0;
70 RegistrationActionEvent::RegAction action;
71 string type;
72
>>> CID 545192: Uninitialized members (UNINIT_CTOR)
>>> Non-static class member "action" is not initialized in this constructor nor in any functions that it calls.
73 RegTimer() {}
74 };
75
76 DBRegAgent::DBRegAgent(const string& _app_name)
77 : AmDynInvokeFactory(_app_name),
78 AmEventQueue(this),
Change-Id: If7fdf53918e711a6b3d262f496ab0e0a349da4b8
No need to always check for:
`type == TYPE_SUBSCRIBER || type == TYPE_UNDEFINED`
The type is either `TYPE_PEERING` or the rest
(subscriber, or if CSTA didn't point out the type
explicitly it's undefined, but then again it's
related to subscriber's type).
Refactor the code accordingly. No func changes.
Change-Id: I5f045b645c971ef309436a5d1c3a4dbc7f180045
Just in case some user still needs the object
to be used through the code later.
E.g.: DBRegAgent module.
Change-Id: Iacd9104edfe757cf475ab25192411103124ed98b
AmThread::stop() detaches the thread, which makes it impossible to
::join() it. Only call one or the other.
Change-Id: Icc9301dc9b31856ec7f963835cffd315bbc925bb
Fixes:
Uninitialized pointer field (UNINIT_CTOR)
Non-static class member current_diag is not initialized
in this constructor nor in any functions that it calls.
Change-Id: I80fd5175edb68079e7b7da7a336bcc7f0e882016
dynamic_cast is used for safe downcasting, so it makes
sense to always ensure whether this cast fails and returns
a null pointer.
Fixes an amount of cases reported by Coverity Scan, alike:
Dynamic cast to pointer dynamic_cast <sip_cseq *>(t->msg->cseq->p) can return NULL.
Assigning: t_cseq = dynamic_cast <sip_cseq *>(t->msg->cseq->p).
Unchecked dynamic_cast (FORWARD_NULL)
Dereferencing null pointer t_cseq.
Change-Id: I5f9bd1a316603ad88b3fdcb2425b4fe8bf99e6a8
Use smart pointers instead of handling with new/delete.
Fixes:
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable rev going out of scope leaks the storage it points to.
Change-Id: I33dfe6c4a74a01774093dc500248c3ed613b5710
Do the dummy read in pieces of 4096. This eliminates the need for a
heap-allocated buffer, which in turn eliminates a possible mem leak.
Change-Id: Ibbbd6f2ef1fa315fad94715c65a74426b3448862
Warned-by: Coverity
Turn objects used by recvmsg() into class members. Eliminates having to
re-initialise them each time.
Change-Id: I9acb6f5f6460c5a9f4c7fb41f8a9e517c7cbbf8b
Warned-by: Coverity
Add cast to make it clear that this is an intentional truncation of a
time_t to an int.
Change-Id: I676f7eb30d4016a531e94975fb230c2d7c9aa9f7
Warned-by: Coverity
When handling `XMLRPC2DIServer` allocation,
first make sure to have the `XmlRpcServer`
and then do rest of processing (e.g.: `di_export`,
`di_method`, `registerMethods()` etc.)
Otherwise can lead to seg.faults when appealing
to objects via still non-allocated `XmlRpcServer`
object.
Change-Id: Id3395ce3e0d6f2de76ed8caa1a786a6e139a851b