diff include/freeDiameter/libfdproto.h @ 903:4382d7420e65

Add new AVP_BY_STRUCT method for searching vendor-specific AVPs. This allows more flexibility and superseeds AVP_BY_NAME_AND_VENDOR and AVP_BY_CODE_AND_VENDOR.
author Sebastien Decugis <sdecugis@freediameter.net>
date Fri, 14 Dec 2012 21:24:34 +0100
parents 40d5e8002b12
children b839a1b1c1da
line wrap: on
line diff
--- a/include/freeDiameter/libfdproto.h	Fri Dec 14 20:42:28 2012 +0100
+++ b/include/freeDiameter/libfdproto.h	Fri Dec 14 21:24:34 2012 +0100
@@ -1330,12 +1330,30 @@
 enum {
 	AVP_BY_CODE = 50,	/* "what" points to an avp_code_t, vendor is always 0 */
 	AVP_BY_NAME,		/* "what" points to a char *, vendor is always 0 */
+	AVP_BY_NAME_ALL_VENDORS,/* "what" points to a string. Might be quite slow... */
+	AVP_BY_STRUCT,		/* "what" points to a struct dict_avp_request_ex (see bellow) */
+			
+	/* kept for backward compatibility, better use AVP_BY_STRUCT above instead */
 	AVP_BY_CODE_AND_VENDOR,	/* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_code are set */
-	AVP_BY_NAME_AND_VENDOR,	/* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_name are set */
-	AVP_BY_NAME_ALL_VENDORS /* "what" points to a string. Might be quite slow... */
+	AVP_BY_NAME_AND_VENDOR	/* "what" points to a struct dict_avp_request (see bellow), where avp_vendor and avp_name are set */
 };
 
 /* Struct used for some researchs */
+struct dict_avp_request_ex {
+	struct {
+		/* Only one of the following fields must be set. */
+		struct dict_object * 	vendor;		/* most efficient if already known, set to NULL to ignore */
+		vendor_id_t	 	vendor_id; 	/* set to 0 to ignore -- prefer AVP_BY_CODE or AVP_BY_NAME for vendor 0 */
+		char *			vendor_name;	/* set to NULL to ignore */
+	} avp_vendor;
+	
+	struct {
+		/* Only one of the following fields must be set */
+		avp_code_t	 avp_code; /* set to 0 to ignore */
+		char *		 avp_name; /* set to NULL to ignore */
+	} avp_data;
+};
+
 struct dict_avp_request {
 	vendor_id_t	 avp_vendor;
 	avp_code_t	 avp_code;
@@ -1343,6 +1361,7 @@
 };
 
 
+
 /***
  *  API usage :
 
"Welcome to our mercurial repository"