| 1 |
/* |
| 2 |
################################################################################ |
| 3 |
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # |
| 4 |
# Read the zproject/README.md for information about making permanent changes. # |
| 5 |
################################################################################ |
| 6 |
*/ |
| 7 |
#include <stdio.h> |
| 8 |
#include <stdlib.h> |
| 9 |
#include <jni.h> |
| 10 |
#include "czmq.h" |
| 11 |
#include "org_zeromq_czmq_Zcert.h" |
| 12 |
|
| 13 |
JNIEXPORT jlong JNICALL |
| 14 |
Java_org_zeromq_czmq_Zcert__1_1new (JNIEnv *env, jclass c) |
| 15 |
{ |
| 16 |
// Disable CZMQ signal handling; allow Java to deal with it |
| 17 |
zsys_handler_set (NULL); |
| 18 |
jlong new_ = (jlong) (intptr_t) zcert_new (); |
| 19 |
return new_; |
| 20 |
} |
| 21 |
|
| 22 |
JNIEXPORT jlong JNICALL |
| 23 |
Java_org_zeromq_czmq_Zcert__1_1newFrom (JNIEnv *env, jclass c, jbyteArray public_key, jbyteArray secret_key) |
| 24 |
{ |
| 25 |
jbyte *public_key_ = (byte *) (*env)->GetByteArrayElements (env, public_key, 0); |
| 26 |
jbyte *secret_key_ = (byte *) (*env)->GetByteArrayElements (env, secret_key, 0); |
| 27 |
jlong new_from_ = (jlong) (intptr_t) zcert_new_from (public_key_, secret_key_); |
| 28 |
(*env)->ReleaseByteArrayElements (env, public_key, (jbyte *) public_key_, 0); |
| 29 |
(*env)->ReleaseByteArrayElements (env, secret_key, (jbyte *) secret_key_, 0); |
| 30 |
return new_from_; |
| 31 |
} |
| 32 |
|
| 33 |
JNIEXPORT jlong JNICALL |
| 34 |
Java_org_zeromq_czmq_Zcert__1_1newFromTxt (JNIEnv *env, jclass c, jstring public_txt, jstring secret_txt) |
| 35 |
{ |
| 36 |
char *public_txt_ = (char *) (*env)->GetStringUTFChars (env, public_txt, NULL); |
| 37 |
char *secret_txt_ = (char *) (*env)->GetStringUTFChars (env, secret_txt, NULL); |
| 38 |
jlong new_from_txt_ = (jlong) (intptr_t) zcert_new_from_txt (public_txt_, secret_txt_); |
| 39 |
(*env)->ReleaseStringUTFChars (env, public_txt, public_txt_); |
| 40 |
(*env)->ReleaseStringUTFChars (env, secret_txt, secret_txt_); |
| 41 |
return new_from_txt_; |
| 42 |
} |
| 43 |
|
| 44 |
JNIEXPORT jlong JNICALL |
| 45 |
Java_org_zeromq_czmq_Zcert__1_1load (JNIEnv *env, jclass c, jstring filename) |
| 46 |
{ |
| 47 |
char *filename_ = (char *) (*env)->GetStringUTFChars (env, filename, NULL); |
| 48 |
jlong load_ = (jlong) (intptr_t) zcert_load (filename_); |
| 49 |
(*env)->ReleaseStringUTFChars (env, filename, filename_); |
| 50 |
return load_; |
| 51 |
} |
| 52 |
|
| 53 |
JNIEXPORT void JNICALL |
| 54 |
Java_org_zeromq_czmq_Zcert__1_1destroy (JNIEnv *env, jclass c, jlong self) |
| 55 |
{ |
| 56 |
zcert_destroy ((zcert_t **) &self); |
| 57 |
} |
| 58 |
|
| 59 |
JNIEXPORT jbyteArray JNICALL |
| 60 |
Java_org_zeromq_czmq_Zcert__1_1publicKey (JNIEnv *env, jclass c, jlong self) |
| 61 |
{ |
| 62 |
jbyte *public_key_ = (jbyte *) zcert_public_key ((zcert_t *) (intptr_t) self); |
| 63 |
jint return_size_ = (jint) 32; |
| 64 |
jbyteArray return_data_ = (*env)->NewByteArray (env, return_size_); |
| 65 |
(*env)->SetByteArrayRegion (env, return_data_, 0, return_size_, (jbyte *) public_key_); |
| 66 |
return return_data_; |
| 67 |
} |
| 68 |
|
| 69 |
JNIEXPORT jbyteArray JNICALL |
| 70 |
Java_org_zeromq_czmq_Zcert__1_1secretKey (JNIEnv *env, jclass c, jlong self) |
| 71 |
{ |
| 72 |
jbyte *secret_key_ = (jbyte *) zcert_secret_key ((zcert_t *) (intptr_t) self); |
| 73 |
jint return_size_ = (jint) 32; |
| 74 |
jbyteArray return_data_ = (*env)->NewByteArray (env, return_size_); |
| 75 |
(*env)->SetByteArrayRegion (env, return_data_, 0, return_size_, (jbyte *) secret_key_); |
| 76 |
return return_data_; |
| 77 |
} |
| 78 |
|
| 79 |
JNIEXPORT jstring JNICALL |
| 80 |
Java_org_zeromq_czmq_Zcert__1_1publicTxt (JNIEnv *env, jclass c, jlong self) |
| 81 |
{ |
| 82 |
char *public_txt_ = (char *) zcert_public_txt ((zcert_t *) (intptr_t) self); |
| 83 |
jstring return_string_ = (*env)->NewStringUTF (env, public_txt_); |
| 84 |
return return_string_; |
| 85 |
} |
| 86 |
|
| 87 |
JNIEXPORT jstring JNICALL |
| 88 |
Java_org_zeromq_czmq_Zcert__1_1secretTxt (JNIEnv *env, jclass c, jlong self) |
| 89 |
{ |
| 90 |
char *secret_txt_ = (char *) zcert_secret_txt ((zcert_t *) (intptr_t) self); |
| 91 |
jstring return_string_ = (*env)->NewStringUTF (env, secret_txt_); |
| 92 |
return return_string_; |
| 93 |
} |
| 94 |
|
| 95 |
JNIEXPORT void JNICALL |
| 96 |
Java_org_zeromq_czmq_Zcert__1_1setMeta (JNIEnv *env, jclass c, jlong self, jstring name, jstring format) |
| 97 |
{ |
| 98 |
char *name_ = (char *) (*env)->GetStringUTFChars (env, name, NULL); |
| 99 |
char *format_ = (char *) (*env)->GetStringUTFChars (env, format, NULL); |
| 100 |
zcert_set_meta ((zcert_t *) (intptr_t) self, name_, "%s", format_); |
| 101 |
(*env)->ReleaseStringUTFChars (env, name, name_); |
| 102 |
(*env)->ReleaseStringUTFChars (env, format, format_); |
| 103 |
} |
| 104 |
|
| 105 |
JNIEXPORT void JNICALL |
| 106 |
Java_org_zeromq_czmq_Zcert__1_1unsetMeta (JNIEnv *env, jclass c, jlong self, jstring name) |
| 107 |
{ |
| 108 |
char *name_ = (char *) (*env)->GetStringUTFChars (env, name, NULL); |
| 109 |
zcert_unset_meta ((zcert_t *) (intptr_t) self, name_); |
| 110 |
(*env)->ReleaseStringUTFChars (env, name, name_); |
| 111 |
} |
| 112 |
|
| 113 |
JNIEXPORT jstring JNICALL |
| 114 |
Java_org_zeromq_czmq_Zcert__1_1meta (JNIEnv *env, jclass c, jlong self, jstring name) |
| 115 |
{ |
| 116 |
char *name_ = (char *) (*env)->GetStringUTFChars (env, name, NULL); |
| 117 |
char *meta_ = (char *) zcert_meta ((zcert_t *) (intptr_t) self, name_); |
| 118 |
jstring return_string_ = (*env)->NewStringUTF (env, meta_); |
| 119 |
(*env)->ReleaseStringUTFChars (env, name, name_); |
| 120 |
return return_string_; |
| 121 |
} |
| 122 |
|
| 123 |
JNIEXPORT jlong JNICALL |
| 124 |
Java_org_zeromq_czmq_Zcert__1_1metaKeys (JNIEnv *env, jclass c, jlong self) |
| 125 |
{ |
| 126 |
jlong meta_keys_ = (jlong) (intptr_t) zcert_meta_keys ((zcert_t *) (intptr_t) self); |
| 127 |
return meta_keys_; |
| 128 |
} |
| 129 |
|
| 130 |
JNIEXPORT jint JNICALL |
| 131 |
Java_org_zeromq_czmq_Zcert__1_1save (JNIEnv *env, jclass c, jlong self, jstring filename) |
| 132 |
{ |
| 133 |
char *filename_ = (char *) (*env)->GetStringUTFChars (env, filename, NULL); |
| 134 |
jint save_ = (jint) zcert_save ((zcert_t *) (intptr_t) self, filename_); |
| 135 |
(*env)->ReleaseStringUTFChars (env, filename, filename_); |
| 136 |
return save_; |
| 137 |
} |
| 138 |
|
| 139 |
JNIEXPORT jint JNICALL |
| 140 |
Java_org_zeromq_czmq_Zcert__1_1savePublic (JNIEnv *env, jclass c, jlong self, jstring filename) |
| 141 |
{ |
| 142 |
char *filename_ = (char *) (*env)->GetStringUTFChars (env, filename, NULL); |
| 143 |
jint save_public_ = (jint) zcert_save_public ((zcert_t *) (intptr_t) self, filename_); |
| 144 |
(*env)->ReleaseStringUTFChars (env, filename, filename_); |
| 145 |
return save_public_; |
| 146 |
} |
| 147 |
|
| 148 |
JNIEXPORT jint JNICALL |
| 149 |
Java_org_zeromq_czmq_Zcert__1_1saveSecret (JNIEnv *env, jclass c, jlong self, jstring filename) |
| 150 |
{ |
| 151 |
char *filename_ = (char *) (*env)->GetStringUTFChars (env, filename, NULL); |
| 152 |
jint save_secret_ = (jint) zcert_save_secret ((zcert_t *) (intptr_t) self, filename_); |
| 153 |
(*env)->ReleaseStringUTFChars (env, filename, filename_); |
| 154 |
return save_secret_; |
| 155 |
} |
| 156 |
|
| 157 |
JNIEXPORT void JNICALL |
| 158 |
Java_org_zeromq_czmq_Zcert__1_1apply (JNIEnv *env, jclass c, jlong self, jlong socket) |
| 159 |
{ |
| 160 |
zcert_apply ((zcert_t *) (intptr_t) self, (void *) (intptr_t) socket); |
| 161 |
} |
| 162 |
|
| 163 |
JNIEXPORT jlong JNICALL |
| 164 |
Java_org_zeromq_czmq_Zcert__1_1dup (JNIEnv *env, jclass c, jlong self) |
| 165 |
{ |
| 166 |
jlong dup_ = (jlong) (intptr_t) zcert_dup ((zcert_t *) (intptr_t) self); |
| 167 |
return dup_; |
| 168 |
} |
| 169 |
|
| 170 |
JNIEXPORT jboolean JNICALL |
| 171 |
Java_org_zeromq_czmq_Zcert__1_1eq (JNIEnv *env, jclass c, jlong self, jlong compare) |
| 172 |
{ |
| 173 |
jboolean eq_ = (jboolean) zcert_eq ((zcert_t *) (intptr_t) self, (zcert_t *) (intptr_t) compare); |
| 174 |
return eq_; |
| 175 |
} |
| 176 |
|
| 177 |
JNIEXPORT void JNICALL |
| 178 |
Java_org_zeromq_czmq_Zcert__1_1print (JNIEnv *env, jclass c, jlong self) |
| 179 |
{ |
| 180 |
zcert_print ((zcert_t *) (intptr_t) self); |
| 181 |
} |
| 182 |
|
| 183 |
JNIEXPORT void JNICALL |
| 184 |
Java_org_zeromq_czmq_Zcert__1_1test (JNIEnv *env, jclass c, jboolean verbose) |
| 185 |
{ |
| 186 |
zcert_test ((bool) verbose); |
| 187 |
} |
| 188 |
|