<!-- 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
- [] Small bug fix (non-breaking change which fixes an issue)
- [x] 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 -->
- [ ] 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 -->
This PR aims to add support for PRT queries in ipops module.
Some functions were modified to accommodate and reuse the structures already defined for DNS.
Any feedback is appreciated!
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3802
-- Commit Summary --
* ipops: Move structures to header
* ipops: Add PTR query support
-- File Changes --
M src/modules/ipops/ipops_mod.c (30)
M src/modules/ipops/ipops_pv.c (162)
M src/modules/ipops/ipops_pv.h (33)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3802.patchhttps://github.com/kamailio/kamailio/pull/3802.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3802
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3802(a)github.com>
Module: kamailio
Branch: master
Commit: 812ad6eb4e49426197e2860b89b255fffb018b5a
URL: https://github.com/kamailio/kamailio/commit/812ad6eb4e49426197e2860b89b255f…
Author: Xenofon Karamanos <22965395+xkaraman(a)users.noreply.github.com>
Committer: Xenofon Karamanos <22965395+xkaraman(a)users.noreply.github.com>
Date: 2024-04-09T13:32:46+03:00
ipops: Add brief comment for ptr_query
---
Modified: src/modules/ipops/ipops_mod.c
Modified: src/modules/ipops/ipops_pv.c
---
Diff: https://github.com/kamailio/kamailio/commit/812ad6eb4e49426197e2860b89b255f…
Patch: https://github.com/kamailio/kamailio/commit/812ad6eb4e49426197e2860b89b255f…
---
diff --git a/src/modules/ipops/ipops_mod.c b/src/modules/ipops/ipops_mod.c
index ea2669d2a19..60fd514d4fb 100644
--- a/src/modules/ipops/ipops_mod.c
+++ b/src/modules/ipops/ipops_mod.c
@@ -1298,7 +1298,18 @@ static int ki_dns_query(sip_msg_t *msg, str *naptrname, str *pvid)
}
/**
+ *! \brief Return 1 (true) if the given `ip` IP address (string or pv)
+ * could successfully be resolved to a domain and saved into `pv_name` pv.
+ * Otherwise, return negative values depending on the error.
*
+ * \param[in] msg SIP message structure.
+ * \param[in] ip IP address (string or pv) to resolve.
+ * \param[in] pv_name PV name to save the resolved domain.
+ * \returns 1 on success.
+ * \returns negative values depending on the error:
+ * \retval 1 success.
+ * \retval res -1 to -5 for bad input.
+ * \retval -6 for error in resolving the domain.
*/
static int w_ptr_query(sip_msg_t *msg, char *ip, char *pv_name)
{
diff --git a/src/modules/ipops/ipops_pv.c b/src/modules/ipops/ipops_pv.c
index 10447e84bcd..034ec696594 100644
--- a/src/modules/ipops/ipops_pv.c
+++ b/src/modules/ipops/ipops_pv.c
@@ -413,8 +413,16 @@ int dns_update_pv(str *hostname, str *name)
return 1;
}
-/*
-*
+/**
+ * \brief Updates the pointer (PTR) record for a given IP address and saves it into pv.
+ *
+ * \details This function updates the PTR record for a specified IP address, and saves it
+ * into `name` AVP encapsulated in $ptrquery pv.
+ * It performs a reverse DNS lookup to obtain the hostname corresponding to the IP address.
+ *
+ * @param ip_address The IP address to update the PTR record for.
+ * @param name The name of AVP to hold the information in $ptrquery pv.
+ * @return 1 on success, or a negative value on failure.
*/
int ptr_update_pv(str *ip_address, str *name)
{