Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2320 - in trunk/perfsonar: contrib/mapi-jni/native/src src/org/perfsonar/service/measurementPoint/tracefileCaptureType src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security

Subject: perfsonar development work

List archive

perfsonar: r2320 - in trunk/perfsonar: contrib/mapi-jni/native/src src/org/perfsonar/service/measurementPoint/tracefileCaptureType src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2320 - in trunk/perfsonar: contrib/mapi-jni/native/src src/org/perfsonar/service/measurementPoint/tracefileCaptureType src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security
  • Date: Thu, 5 Apr 2007 09:03:07 -0400

Author: uros
Date: 2007-04-05 09:03:07 -0400 (Thu, 05 Apr 2007)
New Revision: 2320

Modified:
trunk/perfsonar/contrib/mapi-jni/native/src/mapijni.c

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security/Authorization.java
Log:
Capturing code fixes. Mapping library fixes.

Modified: trunk/perfsonar/contrib/mapi-jni/native/src/mapijni.c
===================================================================
--- trunk/perfsonar/contrib/mapi-jni/native/src/mapijni.c 2007-04-04
10:42:43 UTC (rev 2319)
+++ trunk/perfsonar/contrib/mapi-jni/native/src/mapijni.c 2007-04-05
13:03:07 UTC (rev 2320)
@@ -46,7 +46,7 @@
throwMAPIException(env, errbuf, *errnum)

/* Capture format type mapping between MAPI-JNI and MAPI */
-static int capFormatTypes[] = {
+static const int capFormatTypes[] = {
MFF_PCAP,
MFF_RAW,
MFF_DAG_ERF,
@@ -56,7 +56,7 @@
capFormatTypes[0] : capFormatTypes[x])

/* Sample mode type mapping between MAPI-JNI and MAPI */
-static int sampleModes[] = {
+static const int sampleModes[] = {
PERIODIC,
PROBABILISTIC
};
@@ -64,7 +64,7 @@
sampleModes[0] : sampleModes[x])

/* Anonymization function protocol type mapping between MAPI-JNI and MAPI */
-static int anonfuncProtoTypes[] = {
+static const int anonfuncProtoTypes[] = {
IP,
TCP,
UDP,
@@ -76,7 +76,7 @@
anonfuncProtoTypes[0] : anonfuncProtoTypes[x])

/* Anonymization function protocol type string representation */
-static char* anonfuncProtoTypeStrs[] = {
+static const char* anonfuncProtoTypeStrs[] = {
"IP",
"TCP",
"UDP",
@@ -89,7 +89,7 @@


/* Anonymization function type mapping between MAPI-JNI and MAPI */
-static int anonfuncTypes[] = {
+static const int anonfuncTypes[] = {
UNCHANGED,
MAP,
MAP_DISTRIBUTION,
@@ -109,7 +109,7 @@
anonfuncTypes[0] : anonfuncTypes[x])

/* Anonymization function type string representation */
-static char* anonfuncTypeStrs[] = {
+static const char* anonfuncTypeStrs[] = {
"UNCHANGED",
"MAP",
"MAP_DISTRIBUTION",
@@ -129,7 +129,7 @@
"?" : anonfuncTypeStrs[x])

/* Anonymization hash function type mapping between MAPI-JNI and MAPI */
-static int anonfuncHashTypes[] = {
+static const int anonfuncHashTypes[] = {
ANON_SHA,
ANON_MD5,
ANON_CRC32,
@@ -142,20 +142,20 @@
anonfuncHashTypes[0] : anonfuncHashTypes[x])

/* Anonymization hash function type string representation */
-static char* anonfuncHashTypeStrs[] = {
- "ANON_SHA",
- "ANON_MD5",
- "ANON_CRC32",
- "ANON_SHA_2",
- "ANON_TRIPLEDES",
- "ANON_AES",
- "ANON_DES"
+static const char* anonfuncHashTypeStrs[] = {
+ "SHA",
+ "MD5",
+ "CRC32",
+ "SHA_2",
+ "TRIPLEDES",
+ "AES",
+ "DES"
};
#define getAnonfuncHashTypeStrs(x) ((x < 0 || x >
sizeof(anonfuncHashTypeStrs) / sizeof(char*)) ? \
"?" : anonfuncHashTypeStrs[x])

/* Anonymization function padding type mapping between MAPI-JNI and MAPI */
-static int anonfuncPaddingTypes[] = {
+static const int anonfuncPaddingTypes[] = {
PAD_WITH_ZERO,
STRIP_REST
};
@@ -163,7 +163,7 @@
anonfuncPaddingTypes[0] : anonfuncPaddingTypes[x])

/* Anonymization function padding type string representation */
-static char* anonfuncPaddingTypeStrs[] = {
+static const char* anonfuncPaddingTypeStrs[] = {
"PAD_WITH_ZERO",
"STRIP_REST"
};
@@ -171,7 +171,7 @@
"?" : anonfuncPaddingTypeStrs[x])

/* Anonymization function base field type mapping between MAPI-JNI and MAPI
*/
-static int anonfuncBaseFieldTypes[] = {
+static const int anonfuncBaseFieldTypes[] = {
PAYLOAD,
CHECKSUM,
SRC_IP,
@@ -296,7 +296,7 @@
anonfuncBaseFieldTypes[0] : anonfuncBaseFieldTypes[x])

/* Anonymization function base field type string representation */
-static char* anonfuncBaseFieldTypeStrs[] = {
+static const char* anonfuncBaseFieldTypeStrs[] = {
"PAYLOAD",
"CHECKSUM",
"SRC_IP",
@@ -421,22 +421,38 @@
"?" : anonfuncBaseFieldTypeStrs[x])

/* Anonymization function pattern type mapping between MAPI-JNI and MAPI */
-static int anonfuncPatternTypes[] = {
+static const int anonfuncPatternTypes[] = {
INTEGER,
STR
};
#define getAnonfuncPatternType(x) ((x < 0 || x >
sizeof(anonfuncPatternTypes) / sizeof(int)) ? \
anonfuncPatternTypes[0] : anonfuncPatternTypes[x])
+
+/* Anonymization function pattern type string representation */
+static const char* anonfuncPatternTypeStrs[] = {
+ "INTEGER",
+ "STR"
+};
+#define getAnonfuncPatternTypeStrs(x) ((x < 0 || x >
sizeof(anonfuncPatternTypeStrs) / sizeof(char*)) ? \
+ "?" : anonfuncPatternTypeStrs[x])

/* Anonymization function map distribution type mapping between MAPI-JNI and
MAPI */
-static int anonfuncMapDistrTypes[] = {
+static const int anonfuncMapDistrTypes[] = {
GAUSSIAN,
UNIFORM
};
#define getAnonfuncMapDistrType(x) ((x < 0 || x >
sizeof(anonfuncMapDistrTypes) / sizeof(int)) ? \
anonfuncMapDistrTypes[0] : anonfuncMapDistrTypes[x])

+/* Anonymization function map distribution type string representation */
+static const char* anonfuncMapDistrTypeStrs[] = {
+ "GAUSSIAN",
+ "UNIFORM"
+};
+#define getAnonfuncMapDistrTypeStrs(x) ((x < 0 || x >
sizeof(anonfuncMapDistrTypeStrs) / sizeof(char*)) ? \
+ "?" : anonfuncMapDistrTypeStrs[x])

+
/**
* Throws MAPIException according to the message and errorCode params.
* If Exception could not be constructed function just returns.
@@ -750,6 +766,7 @@
const char** chrPtrStrVec = 0;
char* anonParams = 0;
int len;
+ int curLen;
char c;
int i;

@@ -1566,8 +1583,7 @@
(unsigned long long)getCurrentJVMThreadID(env),
getAnonfuncProtoTypeStrs(intPar1), (int)intPar1,
getAnonfuncProtoType(intPar1),
getAnonfuncBaseFieldTypeStrs(intPar2), (int)intPar2,
getAnonfuncBaseFieldType(intPar2),
- getAnonfuncTypeStrs(intPar3), (int)intPar3,
getAnonfuncType((int)intPar3),
- getAnonfuncTypeStrs((int)intPar3));
+ getAnonfuncTypeStrs(intPar3), (int)intPar3,
getAnonfuncType((int)intPar3));
printf("%s\n", getAnonfuncProtoTypeStrs(0));
switch (getAnonfuncType((int)intPar3)) {
/* UNCHANGED anonymization function */
@@ -1621,6 +1637,7 @@
getAnonfuncProtoTypeStrs(intPar1),
getAnonfuncBaseFieldTypeStrs(intPar2),
getAnonfuncTypeStrs(intPar3));
+
/* Call the MAPI function */
fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
anonParams);
@@ -1668,12 +1685,15 @@
intPar4 = (*env)->CallIntMethod(env, parObj, intClsIntValue);

/* Verify that distribution type is either UNIFORM or
GAUSSIAN */
- if ((int)intPar4 != UNIFORM && (int)intPar4 != GAUSSIAN) {
+ if (getAnonfuncMapDistrType(intPar4) != UNIFORM &&
+ getAnonfuncMapDistrType(intPar4) != GAUSSIAN) {
DEBUG_PRINT(") -> called with invalid distribution type
(%d)\n", (int)intPar4);
snprintf(errbuf, sizeof(errbuf),
- "%016llx MAPI function '%s' (anonfunc=%s)
called with invalid distribution type (%d) [" __FILE__ ":%lu]",
+ "%016llx MAPI function '%s' (anonfunc=%s)
called with invalid distribution type (%d->%d) [" __FILE__ ":%lu]",
(unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
- getAnonfuncTypeStrs((int)intPar3),
(int)intPar4, (unsigned long)__LINE__);
+ getAnonfuncTypeStrs((int)intPar3),
+ (int)intPar4, getAnonfuncMapDistrType(intPar4),
+ (unsigned long)__LINE__);
throwMAPIException(env, errbuf, -1);
goto cleanup;
}
@@ -1681,7 +1701,9 @@
/* Retrieve range or median */
parObj = (*env)->GetObjectArrayElement(env, params, 4);
if (! parObj) {
- DEBUG_PRINT(") -> null %s argument\n", ((int)intPar4 ==
UNIFORM ? "left edge of the range" : "median"));
+ DEBUG_PRINT(") -> null %s argument\n",
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM
?
+ "left edge of the range" : "median"));
snprintf(errbuf, sizeof(errbuf),
"%016llx MAPI function '%s' (anonfunc=%s)
called with null %s argument [" __FILE__ ":%lu]",
(unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
@@ -1692,11 +1714,15 @@
}

if (! (*env)->IsInstanceOf(env, parObj, intCls)) {
- DEBUG_PRINT(") -> non Integer %s argument\n",
((int)intPar4 == UNIFORM ? "left edge of the range" : "median"));
+ DEBUG_PRINT(") -> non Integer %s argument\n",
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM
?
+ "left edge of the range" : "median"));
snprintf(errbuf, sizeof(errbuf),
"%016llx MAPI function '%s' (anonfunc=%s)
called with non Integer %s argument [" __FILE__ ":%lu]",
(unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
- getAnonfuncTypeStrs((int)intPar3),
((int)intPar4 == UNIFORM ? "left edge of the range" : "median"),
+ getAnonfuncTypeStrs((int)intPar3),
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM ?
+ "left edge of the range" : "median"),
(unsigned long)__LINE__);
throwMAPIException(env, errbuf, -1);
goto cleanup;
@@ -1706,37 +1732,72 @@
/* Retrieve range or standard deviation */
parObj = (*env)->GetObjectArrayElement(env, params, 5);
if (! parObj) {
- DEBUG_PRINT(") -> null %s argument\n", ((int)intPar4 ==
UNIFORM ? "right edge of the range" : "standard deviation"));
+ DEBUG_PRINT(") -> null %s argument\n",
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM
?
+ "right edge of the range" : "standard
deviation"));
snprintf(errbuf, sizeof(errbuf),
"%016llx MAPI function '%s' (anonfunc=%s)
called with null %s argument [" __FILE__ ":%lu]",
(unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
- getAnonfuncTypeStrs((int)intPar3),
((int)intPar4 == UNIFORM ? "right edge of the range" : "standard deviation"),
+ getAnonfuncTypeStrs((int)intPar3),
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM ?
+ "right edge of the range" : "standard
deviation"),
(unsigned long)__LINE__);
throwMAPIException(env, errbuf, -1);
goto cleanup;
}

if (! (*env)->IsInstanceOf(env, parObj, intCls)) {
- DEBUG_PRINT(") -> non Integer %s argument\n",
((int)intPar4 == UNIFORM ? "right edge of the range" : "standard deviation"));
+ DEBUG_PRINT(") -> non Integer %s argument\n",
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM
?
+ "right edge of the range" : "standard
deviation"));
snprintf(errbuf, sizeof(errbuf),
"%016llx MAPI function '%s' (anonfunc=%s)
called with non Integer %s argument [" __FILE__ ":%lu]",
(unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
- getAnonfuncTypeStrs((int)intPar3),
((int)intPar4 == UNIFORM ? "right edge of the range" : "standard deviation"),
+ getAnonfuncTypeStrs((int)intPar3),
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM ?
+ "right edge of the range" : "standard
deviation"),
(unsigned long)__LINE__);
throwMAPIException(env, errbuf, -1);
goto cleanup;
}
intPar6 = (*env)->CallIntMethod(env, parObj, intClsIntValue);

- DEBUG_PRINT(",distribType=%d->%d,%s=%d,%s=%d",
+ DEBUG_PRINT(",distribType=%s(%d->%d),%s=%d,%s=%d",
+ getAnonfuncMapDistrTypeStrs(intPar4),
(int)intPar4, getAnonfuncMapDistrType(intPar4),
- ((int)intPar4 == UNIFORM ? "left edge of the range" :
"median"), (int)intPar5,
- ((int)intPar4 == UNIFORM ? "right edge of the range"
: "standard deviation"), (int)intPar6);
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM ?
+ "left edge of the range" : "median"), (int)intPar5,
+ (getAnonfuncMapDistrType(intPar4) == UNIFORM ?
+ "right edge of the range" : "standard deviation"),
+ (int)intPar6);

+ /* Create buffer holding additional params to the function */
+ len = snprintf(&c, 1, "%s,%s,%s,%s,%d,%d",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ getAnonfuncMapDistrTypeStrs(intPar4),
+ (int)intPar5, (int)intPar6);
+ anonParams = malloc(len + 1);
+ if (! anonParams) {
+ DEBUG_PRINT("%s", ") -> Out of memory!\n");
+ snprintf(errbuf, sizeof(errbuf),
+ "%016llx MAPI function '%s' (anonfunc=%s)
generated out of memory condition [" __FILE__ ":%lu]",
+ (unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
+ getAnonfuncTypeStrs((int)intPar3), (unsigned
long)__LINE__);
+ throwMAPIException(env, errbuf, -1);
+ goto cleanup;
+ }
+ snprintf(anonParams, len + 1, "%s,%s,%s,%s,%d,%d",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ getAnonfuncMapDistrTypeStrs(intPar4),
+ (int)intPar5, (int)intPar6);
+
/* Call the MAPI function */
- fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
getAnonfuncProtoType(intPar1),
- getAnonfuncBaseFieldType(intPar2),
getAnonfuncType(intPar3),
- getAnonfuncMapDistrType(intPar4), (int)intPar5,
(int)intPar6);
+ fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
+ anonParams);
break;

/* STRIP anonymization function */
@@ -1778,10 +1839,32 @@
intPar4 = (*env)->CallIntMethod(env, parObj, intClsIntValue);

DEBUG_PRINT(",numberOfBytesToBeKept=%d", (int)intPar4);
+
+ /* Create buffer holding additional params to the function */
+ len = snprintf(&c, 1, "%s,%s,%s,%d",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ (int)intPar4);
+ anonParams = malloc(len + 1);
+ if (! anonParams) {
+ DEBUG_PRINT("%s", ") -> Out of memory!\n");
+ snprintf(errbuf, sizeof(errbuf),
+ "%016llx MAPI function '%s' (anonfunc=%s)
generated out of memory condition [" __FILE__ ":%lu]",
+ (unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
+ getAnonfuncTypeStrs((int)intPar3), (unsigned
long)__LINE__);
+ throwMAPIException(env, errbuf, -1);
+ goto cleanup;
+ }
+ snprintf(anonParams, len + 1, "%s,%s,%s,%d",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ (int)intPar4);

/* Call the MAPI function */
- fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
getAnonfuncProtoType(intPar1),
- getAnonfuncBaseFieldType(intPar2),
getAnonfuncType(intPar3), (int)intPar4);
+ fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
+ anonParams);

break;

@@ -1823,7 +1906,10 @@
}
intPar4 = (*env)->CallIntMethod(env, parObj, intClsIntValue);

- DEBUG_PRINT(",hashFunc=%d->%d", (int)intPar4,
getAnonfuncHashType(intPar4));
+ DEBUG_PRINT(",hashFunc=%s(%d->%d)",
+ getAnonfuncHashTypeStrs(intPar4),
+ (int)intPar4,
+ getAnonfuncHashType(intPar4));

/* Retrieve padding type */
parObj = (*env)->GetObjectArrayElement(env, params, 4);
@@ -1848,12 +1934,38 @@
}
intPar5 = (*env)->CallIntMethod(env, parObj, intClsIntValue);

- DEBUG_PRINT(",paddingType=%d->%d", (int)intPar5,
getAnonfuncPaddingType(intPar5));
+ DEBUG_PRINT(",paddingType=%s(%d->%d)",
+ getAnonfuncPaddingTypeStrs(intPar5),
+ (int)intPar5,
+ getAnonfuncPaddingType(intPar5));
+
+ /* Create buffer holding additional params to the function */
+ len = snprintf(&c, 1, "%s,%s,%s,%s,%s",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ getAnonfuncHashTypeStrs(intPar4),
+ getAnonfuncPaddingTypeStrs(intPar5));
+ anonParams = malloc(len + 1);
+ if (! anonParams) {
+ DEBUG_PRINT("%s", ") -> Out of memory!\n");
+ snprintf(errbuf, sizeof(errbuf),
+ "%016llx MAPI function '%s' (anonfunc=%s)
generated out of memory condition [" __FILE__ ":%lu]",
+ (unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
+ getAnonfuncTypeStrs((int)intPar3), (unsigned
long)__LINE__);
+ throwMAPIException(env, errbuf, -1);
+ goto cleanup;
+ }
+ snprintf(anonParams, len + 1, "%s,%s,%s,%s,%s",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ getAnonfuncHashTypeStrs(intPar4),
+ getAnonfuncPaddingTypeStrs(intPar5));

/* Call the MAPI function */
- fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
getAnonfuncProtoType(intPar1),
- getAnonfuncBaseFieldType(intPar2),
getAnonfuncType(intPar3),
- getAnonfuncHashType(intPar4),
getAnonfuncPaddingType(intPar5));
+ fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
+ anonParams);
break;

/* PATTERN_FILL anonymization function */
@@ -1894,7 +2006,10 @@
}
intPar4 = (*env)->CallIntMethod(env, parObj, intClsIntValue);

- DEBUG_PRINT(",patternType=%d->%d", (int)intPar4,
getAnonfuncPatternType(intPar4));
+ DEBUG_PRINT(",patternType=(%s)%d->%d",
+ getAnonfuncPatternTypeStrs(intPar4),
+ (int)intPar4,
+ getAnonfuncPatternType(intPar4));

/* Retrieve pattern */
parObj = (*env)->GetObjectArrayElement(env, params, 4);
@@ -1926,10 +2041,33 @@

DEBUG_PRINT(",pattern=%s", chrPtrStrPar1);

+ /* Create buffer holding additional params to the
function */
+ len = snprintf(&c, 1, "%s,%s,%s,%s,%s",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ getAnonfuncPatternTypeStrs(intPar4),
+ chrPtrStrPar1);
+ anonParams = malloc(len + 1);
+ if (! anonParams) {
+ DEBUG_PRINT("%s", ") -> Out of memory!\n");
+ snprintf(errbuf, sizeof(errbuf),
+ "%016llx MAPI function '%s' (anonfunc=%s)
generated out of memory condition [" __FILE__ ":%lu]",
+ (unsigned long
long)getCurrentJVMThreadID(env), chrPtrFunc,
+ getAnonfuncTypeStrs((int)intPar3),
(unsigned long)__LINE__);
+ throwMAPIException(env, errbuf, -1);
+ goto cleanup;
+ }
+ snprintf(anonParams, len + 1, "%s,%s,%s,%s,%s",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ getAnonfuncPatternTypeStrs(intPar4),
+ chrPtrStrPar1);
+
/* Call the MAPI function */
- fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
getAnonfuncProtoType(intPar1),
- getAnonfuncBaseFieldType(intPar2),
getAnonfuncType(intPar3),
- getAnonfuncPatternType(intPar4), chrPtrStrPar1);
+ fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
+ anonParams);
/* or is it integer pattern ? */
} else if (getAnonfuncPatternType(intPar4) == INTEGER) {
if (! (*env)->IsInstanceOf(env, parObj, intCls)) {
@@ -1945,10 +2083,33 @@

DEBUG_PRINT(",pattern=%d", (int)intPar5);

+ /* Create buffer holding additional params to the
function */
+ len = snprintf(&c, 1, "%s,%s,%s,%s,%d",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ getAnonfuncPatternTypeStrs(intPar4),
+ (int)intPar5);
+ anonParams = malloc(len + 1);
+ if (! anonParams) {
+ DEBUG_PRINT("%s", ") -> Out of memory!\n");
+ snprintf(errbuf, sizeof(errbuf),
+ "%016llx MAPI function '%s' (anonfunc=%s)
generated out of memory condition [" __FILE__ ":%lu]",
+ (unsigned long
long)getCurrentJVMThreadID(env), chrPtrFunc,
+ getAnonfuncTypeStrs((int)intPar3),
(unsigned long)__LINE__);
+ throwMAPIException(env, errbuf, -1);
+ goto cleanup;
+ }
+ snprintf(anonParams, len + 1, "%s,%s,%s,%s,%d",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ getAnonfuncPatternTypeStrs(intPar4),
+ (int)intPar5);
+
/* Call the MAPI function */
- fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
getAnonfuncProtoType(intPar1),
- getAnonfuncBaseFieldType(intPar2),
getAnonfuncType(intPar3),
- getAnonfuncPatternType(intPar4), (int)intPar5);
+ fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
+ anonParams);
}
break;

@@ -1995,9 +2156,31 @@

DEBUG_PRINT(",pattern=%s", chrPtrStrPar1);

+ /* Create buffer holding additional params to the function */
+ len = snprintf(&c, 1, "%s,%s,%s,%s",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ chrPtrStrPar1);
+ anonParams = malloc(len + 1);
+ if (! anonParams) {
+ DEBUG_PRINT("%s", ") -> Out of memory!\n");
+ snprintf(errbuf, sizeof(errbuf),
+ "%016llx MAPI function '%s' (anonfunc=%s)
generated out of memory condition [" __FILE__ ":%lu]",
+ (unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
+ getAnonfuncTypeStrs((int)intPar3), (unsigned
long)__LINE__);
+ throwMAPIException(env, errbuf, -1);
+ goto cleanup;
+ }
+ snprintf(anonParams, len + 1, "%s,%s,%s,%s",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ chrPtrStrPar1);
+
/* Call the MAPI function */
- fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
getAnonfuncProtoType(intPar1),
- getAnonfuncBaseFieldType(intPar2),
getAnonfuncType(intPar3), chrPtrStrPar1);
+ fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
+ anonParams);
break;

/* REGEXP anonymization function */
@@ -2093,9 +2276,46 @@
DEBUG_PRINT(",regexRepl#%d=%s", (i - 4), chrPtrStrVec[i
- 4]);
}

+ /* Create buffer holding additional params to the function */
+ len = snprintf(&c, 1, "%s,%s,%s,%s",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ chrPtrStrPar1);
+ for (i = 0; i < paramsSize - 4; i++) {
+ if (! i) len += snprintf(&c, 1, ",%d", paramsSize - 4);
+ len += snprintf(&c, 1, ",%s", chrPtrStrVec[i] ?
chrPtrStrVec[i] : "NULL");
+ }
+ anonParams = malloc(len + 1);
+ if (! anonParams) {
+ DEBUG_PRINT("%s", ") -> Out of memory!\n");
+ snprintf(errbuf, sizeof(errbuf),
+ "%016llx MAPI function '%s' (anonfunc=%s)
generated out of memory condition [" __FILE__ ":%lu]",
+ (unsigned long long)getCurrentJVMThreadID(env),
chrPtrFunc,
+ getAnonfuncTypeStrs((int)intPar3), (unsigned
long)__LINE__);
+ throwMAPIException(env, errbuf, -1);
+ goto cleanup;
+ }
+ curLen = snprintf(anonParams, len + 1, "%s,%s,%s,%s",
+ getAnonfuncProtoTypeStrs(intPar1),
+ getAnonfuncBaseFieldTypeStrs(intPar2),
+ getAnonfuncTypeStrs(intPar3),
+ chrPtrStrPar1);
+ for (i = 0; i < paramsSize - 4; i++) {
+ if (! i)
+ curLen += snprintf(anonParams + curLen,
+ len - curLen + 1,
+ ",%d",
+ paramsSize - 4);
+ curLen += snprintf(anonParams + curLen,
+ len - curLen + 1,
+ ",%s",
+ chrPtrStrVec[i] ? chrPtrStrVec[i] :
"NULL");
+ }
+
/* Call the MAPI function */
- fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
getAnonfuncProtoType(intPar1),
- getAnonfuncBaseFieldType(intPar2),
getAnonfuncType(intPar3), chrPtrStrPar1, (char**)chrPtrStrVec, strVecSize);
+ fid = mapi_apply_function((int)fd, (char*)chrPtrFunc,
+ anonParams);
break;

/* Default is non implemented error message */

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
2007-04-04 10:42:43 UTC (rev 2319)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
2007-04-05 13:03:07 UTC (rev 2320)
@@ -570,7 +570,7 @@
for (Authorization.Anonymization anon :
authorization.getAnonymizations()) {

- Object[] anonParams = anon.toObjectArray();
+ Object[] anonParams = anon.toIntStrObjectArray();

monReq.mapiApplyFunction("ANONYMIZE", anonParams);
this.logger.info(type
@@ -638,7 +638,7 @@
for (Authorization.Anonymization anon :
this.request.getReqAuthorization().getAnonymizations()) {

- Object[] anonParams = anon.toObjectArray();
+ Object[] anonParams = anon.toIntStrObjectArray();

monReq.mapiApplyFunction("ANONYMIZE", anonParams);
this.logger.info(type

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security/Authorization.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security/Authorization.java
2007-04-04 10:42:43 UTC (rev 2319)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security/Authorization.java
2007-04-05 13:03:07 UTC (rev 2320)
@@ -999,6 +999,15 @@
public Object getValueAsObject();


+ /**
+ * Get parameter value either as Integer or String
+ * Object. Depends on the closest match.
+ *
+ * @return value casted to Object of type Integer or String
+ */
+ public Object getValueAsIntStrObject();
+
+
}

/**
@@ -1047,6 +1056,18 @@
}

/**
+ * Get parameter value either as Integer or String
+ * Object. Depends on the closest match.
+ *
+ * @return value casted to Object of type Integer or String
+ */
+ public Object getValueAsIntStrObject() {
+
+ return value;
+
+ }
+
+ /**
* Value getter.
*
* @return value
@@ -1116,6 +1137,18 @@
}

/**
+ * Get parameter value either as Integer or String
+ * Object. Depends on the closest match.
+ *
+ * @return value casted to Object of type Integer or String
+ */
+ public Object getValueAsIntStrObject() {
+
+ return value;
+
+ }
+
+ /**
* Value getter.
*
* @return value
@@ -1188,6 +1221,18 @@
}

/**
+ * Get parameter value either as Integer or String
+ * Object. Depends on the closest match.
+ *
+ * @return value casted to Object of type Integer or String
+ */
+ public Object getValueAsIntStrObject() {
+
+ return value.getMrNum();
+
+ }
+
+ /**
* Value getter.
*
* @return value
@@ -1259,6 +1304,18 @@
}

/**
+ * Get parameter value either as Integer or String
+ * Object. Depends on the closest match.
+ *
+ * @return value casted to Object of type Integer or String
+ */
+ public Object getValueAsIntStrObject() {
+
+ return value.getMrNum();
+
+ }
+
+ /**
* Value getter.
*
* @return value
@@ -1331,6 +1388,18 @@
}

/**
+ * Get parameter value either as Integer or String
+ * Object. Depends on the closest match.
+ *
+ * @return value casted to Object of type Integer or String
+ */
+ public Object getValueAsIntStrObject() {
+
+ return value.getMrNum();
+
+ }
+
+ /**
* Value getter.
*
* @return value
@@ -1401,6 +1470,18 @@
}

/**
+ * Get parameter value either as Integer or String
+ * Object. Depends on the closest match.
+ *
+ * @return value casted to Object of type Integer or String
+ */
+ public Object getValueAsIntStrObject() {
+
+ return value.getMrNum();
+
+ }
+
+ /**
* Value getter.
*
* @return value
@@ -1744,6 +1825,37 @@
}

/**
+ * Similar to the toObjectArray, except Objects can only be
+ * Integers and Strings
+ *
+ * @return Object array representing this anonymization
+ * (objects can only be Integers and Strings
+ * @throws Exception on any error encountered during conversion
+ */
+ public Object[] toIntStrObjectArray() throws Exception {
+
+ List<Object> ret = new ArrayList<Object>();
+
+ if (protocolType == null)
+ throw new Exception("Protocol type not defined");
+ ret.add(protocolType.getMrNum());
+
+ if (fieldType == null)
+ throw new Exception("Field type not defined");
+ ret.add(fieldType.getMrNum());
+
+ if (functionType == null)
+ throw new Exception("Function type not defined");
+ ret.add(functionType.getMrNum());
+
+ for (AnonymizationParameter param : functionParams)
+ ret.add(param.getValueAsIntStrObject());
+
+ return ret.toArray(new Object[ret.size()]);
+
+ }
+
+ /**
* Return comma separated String list of all parameters:
* - protocol type (Integer MonitorRequest.ANON_PROTO_*)
* - field type (Integer MonitorRequest.ANON_*_FIELD_*)



  • perfsonar: r2320 - in trunk/perfsonar: contrib/mapi-jni/native/src src/org/perfsonar/service/measurementPoint/tracefileCaptureType src/org/perfsonar/service/measurementPoint/tracefileCaptureType/security, svnlog, 04/05/2007

Archive powered by MHonArc 2.6.16.

Top of Page