<!-- Kamailio Pull Request Template -->
<!-- IMPORTANT: - for detailed contributing guidelines, read: https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md - pull requests must be done to master branch, unless they are backports of fixes from master branch to a stable branch - backports to stable branches must be done with 'git cherry-pick -x ...' - code is contributed under BSD for core and main components (tm, sl, auth, tls) - code is contributed GPLv2 or a compatible license for the other components - GPL code is contributed with OpenSSL licensing exception -->
#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [x ] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ x] PR should be backported to stable branches - [x ] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description <!-- Describe your changes in detail --> Exported API functions changed to use the KEMI functions. You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3956
-- Commit Summary --
* use ki functions as exported api functions
-- File Changes --
M src/modules/rtpengine/api.h (21) M src/modules/rtpengine/rtpengine.c (11)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3956.patch https://github.com/kamailio/kamailio/pull/3956.diff
@rfuchs commented on this pull request.
+typedef int (*rtpengine_answer_f)(struct sip_msg *msg, str *str);
+typedef int (*rtpengine_answer0_f)(struct sip_msg *msg); +typedef int (*rtpengine_offer_f)(struct sip_msg *msg, str *str); +typedef int (*rtpengine_offer0_f)(struct sip_msg *msg); +typedef int (*rtpengine_delete_f)(struct sip_msg *msg, str *str); +typedef int (*rtpengine_delete0_f)(struct sip_msg *msg);
You should only need one version of each function as the functions are able to handle NULL pointers passed to them.
@Fr-Soltanzadeh pushed 1 commit.
1d8336ee26e4117f067c6389b0b8e551d05e18ef use ki functions as exported api functions
@Fr-Soltanzadeh commented on this pull request.
+typedef int (*rtpengine_answer_f)(struct sip_msg *msg, str *str);
+typedef int (*rtpengine_answer0_f)(struct sip_msg *msg); +typedef int (*rtpengine_offer_f)(struct sip_msg *msg, str *str); +typedef int (*rtpengine_offer0_f)(struct sip_msg *msg); +typedef int (*rtpengine_delete_f)(struct sip_msg *msg, str *str); +typedef int (*rtpengine_delete0_f)(struct sip_msg *msg);
Done. Thank you.
@rfuchs commented on this pull request.
typedef struct rtpengine_api { rtpengine_start_recording_f start_recording; rtpengine_answer_f answer; rtpengine_offer_f offer; - rtpengine_delete_f delete; + rtpengine_delete_f _delete;
Any reason for the underscore? :smile:
J/W, otherwise LGTM
@Fr-Soltanzadeh commented on this pull request.
typedef struct rtpengine_api { rtpengine_start_recording_f start_recording; rtpengine_answer_f answer; rtpengine_offer_f offer; - rtpengine_delete_f delete; + rtpengine_delete_f _delete;
Thanks for the review. I added the underscore to delete to avoid potential conflicts with the delete keyword in C++. While this code is written in C, there's a possibility that it might be included in a C++ project in the future. Using _delete ensures compatibility and prevents any issues if that happens. If you think it's unnecessary, I'm happy to revert it, but I thought it was a safer choice to avoid potential problems.
@rfuchs commented on this pull request.
typedef struct rtpengine_api { rtpengine_start_recording_f start_recording; rtpengine_answer_f answer; rtpengine_offer_f offer; - rtpengine_delete_f delete; + rtpengine_delete_f _delete;
Thanks for the review. I added the underscore to delete to avoid potential conflicts with the delete keyword in C++. While this code is written in C, there's a possibility that it might be included in a C++ project in the future. Using _delete ensures compatibility and prevents any issues if that happens. If you think it's unnecessary, I'm happy to revert it, but I thought it was a safer choice to avoid potential problems.
Ok, fair point, but I do think having the member name with an underscore looks a bit odd. Perhaps use some alternative like `del` or `delet` then, or even just `teardown` or something else.
I see that `delete` field was renamed to `_delete`. Any particular reason it was done now?
I see that `delete` field was renamed to `_delete`. Any particular reason it was done now?
Refer to the discussion in the PR, Richard also raised it. We probably should stay with the "delete". We can rename it when necessary due to C++.
@Fr-Soltanzadeh pushed 1 commit.
4bca9684b258dbb4fe679c197a56f61a5f09ca2c use ki functions as exported api functions
I changed all function names to rtpengine_xxx . This way is better for readability and fixes the problem.
I changed all function names to rtpengine_xxx . This way is better for readability and fixes the problem.
As long as there are no other modules that will ever use this binding ... 😆 (Welcome to one of the only two hard things in computer science)
Anyway, fine with me
As this PR is not accepted yet, should I change the functions name? Or is there any other issue with this PR?
Merged #3956 into master.