浏览代码

ipops: Add brief comment for ptr_query

Xenofon Karamanos 1 年之前
父节点
当前提交
812ad6eb4e
共有 2 个文件被更改,包括 21 次插入2 次删除
  1. 11 0
      src/modules/ipops/ipops_mod.c
  2. 10 2
      src/modules/ipops/ipops_pv.c

+ 11 - 0
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)
 {

+ 10 - 2
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)
 {