PUD: add downlink port to clusterleader message
[olsrd.git] / lib / pud / wireformat-java / src / main / c / org_olsr_plugin_pud_ClusterLeader.c
index c3ebe73..ed449bf 100644 (file)
@@ -41,6 +41,26 @@ JNIEXPORT jlong JNICALL Java_org_olsr_plugin_pud_ClusterLeader_getClusterLeaderV
        return (jlong) validityTime;
 }
 
+/*
+ * Class:     org_olsr_plugin_pud_ClusterLeader
+ * Method:    getClusterLeaderDownlinkPort
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_olsr_plugin_pud_ClusterLeader_getClusterLeaderDownlinkPort
+  (JNIEnv * env, jobject this) {
+       jobject dataObject;
+       jboolean isCopy;
+       UplinkMessage * uplinkMessage = getUplinkMessage(env, this, &dataObject,
+                       &isCopy);
+
+       unsigned short downlinkPort = getClusterLeaderDownlinkPort(
+                       getClusterLeaderMessage(uplinkMessage));
+
+       releaseUplinkMessage(env, uplinkMessage, dataObject, isCopy, JNI_ABORT);
+
+       return (jint) downlinkPort;
+}
+
 /*
  * Class:     org_olsr_plugin_pud_ClusterLeader
  * Method:    getClusterLeaderOriginator