Browse code

secsipid: added modparams to set url file cache options

Daniel-Constantin Mierla authored on 12/11/2020 12:18:06
Showing 2 changed files
... ...
@@ -70,20 +70,19 @@ extern "C" {
70 70
 
71 71
 
72 72
 // SecSIPIDSignJSONHP --
73
-
74
-extern int SecSIPIDSignJSONHP(char* p0, char* p1, char* p2, char** p3);
73
+extern int SecSIPIDSignJSONHP(char* headerJSON, char* payloadJSON, char* prvkeyPath, char** outPtr);
75 74
 
76 75
 // SecSIPIDGetIdentity --
77
-
78
-extern int SecSIPIDGetIdentity(char* p0, char* p1, char* p2, char* p3, char* p4, char* p5, char** p6);
76
+extern int SecSIPIDGetIdentity(char* origTN, char* destTN, char* attestVal, char* origID, char* x5uVal, char* prvkeyPath, char** outPtr);
79 77
 
80 78
 // SecSIPIDCheck --
81
-
82
-extern int SecSIPIDCheck(char* p0, int p1, int p2, char* p3, int p4);
79
+extern int SecSIPIDCheck(char* identityVal, int identityLen, int expireVal, char* pubkeyPath, int timeoutVal);
83 80
 
84 81
 // SecSIPIDCheckFull --
82
+extern int SecSIPIDCheckFull(char* identityVal, int identityLen, int expireVal, char* pubkeyPath, int timeoutVal);
85 83
 
86
-extern int SecSIPIDCheckFull(char* p0, int p1, int p2, char* p3, int p4);
84
+// SecSIPIDSetFileCacheOptions --
85
+extern int SecSIPIDSetFileCacheOptions(char* dirPath, int expireVal);
87 86
 
88 87
 #ifdef __cplusplus
89 88
 }
... ...
@@ -38,6 +38,9 @@ MODULE_VERSION
38 38
 static int secsipid_expire = 300;
39 39
 static int secsipid_timeout = 5;
40 40
 
41
+static int secsipid_cache_expire = 3600;
42
+static str secsipid_cache_dir = str_init("");
43
+
41 44
 static int mod_init(void);
42 45
 static int child_init(int);
43 46
 static void mod_destroy(void);
... ...
@@ -57,8 +60,10 @@ static cmd_export_t cmds[]={
57 60
 };
58 61
 
59 62
 static param_export_t params[]={
60
-	{"expire",     PARAM_INT,   &secsipid_expire},
61
-	{"timeout",    PARAM_INT,   &secsipid_timeout},
63
+	{"expire",        PARAM_INT,   &secsipid_expire},
64
+	{"timeout",       PARAM_INT,   &secsipid_timeout},
65
+	{"cache_expire",  PARAM_INT,   &secsipid_cache_expire},
66
+	{"cache_dir",     PARAM_STR,   &secsipid_cache_dir},
62 67
 	{0, 0, 0}
63 68
 };
64 69
 
... ...
@@ -127,6 +132,9 @@ static int ki_secsipid_check_identity(sip_msg_t *msg, str *keypath)
127 132
 
128 133
 	ibody = hf->body;
129 134
 
135
+	if(secsipid_cache_dir.len > 0) {
136
+		SecSIPIDSetFileCacheOptions(secsipid_cache_dir.s, secsipid_cache_expire);
137
+	}
130 138
 	ret = SecSIPIDCheckFull(ibody.s, ibody.len, secsipid_expire, keypath->s,
131 139
 			secsipid_timeout);
132 140
 
... ...
@@ -281,4 +289,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
281 289
 {
282 290
 	sr_kemi_modules_add(sr_kemi_secsipid_exports);
283 291
 	return 0;
284
-}
285 292
\ No newline at end of file
293
+}