1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_IPC_JNI_MESSAGE_PARCEL_H 17 #define OHOS_IPC_JNI_MESSAGE_PARCEL_H 18 19 #include <jni.h> 20 #include "message_parcel.h" 21 22 namespace OHOS { 23 /* 24 * register native methods for ohos.rpc.MessageParcel. 25 */ 26 int JavaOhosRpcMessageParcelRegisterNativeMethods(JNIEnv *env); 27 /* 28 * Get Native Message Parcel instance of ohos/rpc/MessageParcel 29 */ 30 MessageParcel *JavaOhosRpcMessageParcelGetNative(JNIEnv *env, jobject object); 31 } // namespace OHOS 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 /* 37 * Class: ohos.rpc.MessageParcel 38 * Method: nativeNewObject 39 * Signature: (J)J; 40 */ 41 jlong JNICALL Java_ohos_rpc_MessageParcel_nativeNewObject(JNIEnv *env, jobject object, jlong nativeObject); 42 43 /* 44 * Class: ohos.rpc.MessageParcel 45 * Method: nativeFreeObject 46 * Signature: (J)V; 47 */ 48 void JNICALL Java_ohos_rpc_MessageParcel_nativeFreeObject(JNIEnv *env, jobject object, jlong nativeObject); 49 /* 50 * Class: ohos.rpc.MessageParcel 51 * Method: nativeWriteRemoteObject 52 * Signature: (Lohos/rpc/IRemoteObject)Z 53 */ 54 jboolean JNICALL Java_ohos_rpc_MessageParcel_nativeWriteRemoteObject(JNIEnv *env, jobject parcel, jobject object); 55 56 /* 57 * Class: ohos.rpc.MessageParcel 58 * Method: nativeReadRemoteObject 59 * Signature: ()Lohos/rpc/IRemoteObject; 60 */ 61 jobject JNICALL Java_ohos_rpc_MessageParcel_nativeReadRemoteObject(JNIEnv *env, jobject object); 62 63 /* 64 * Class: ohos.rpc.MessageParcel 65 * Method: nativeWriteFileDescriptor 66 * Signature: (LJava/io/FileDescriptor;)Z 67 */ 68 jboolean JNICALL Java_ohos_rpc_MessageParcel_nativeWriteFileDescriptor(JNIEnv *env, jobject object, jobject descriptor); 69 70 /* 71 * Class: ohos.rpc.MessageParcel 72 * Method: nativeReadFileDescriptor 73 * Signature: ()LJava/io/FileDescriptor; 74 */ 75 jobject JNICALL Java_ohos_rpc_MessageParcel_nativeReadFileDescriptor(JNIEnv *env, jobject object); 76 77 /* 78 * Class: ohos.rpc.MessageParcel 79 * Method: nativeWriteInterfaceToken 80 * Signature: (LJava/io/String;)Z 81 */ 82 jboolean JNICALL Java_ohos_rpc_MessageParcel_nativeWriteInterfaceToken(JNIEnv *env, jobject object, jstring name, 83 jint len); 84 85 /* 86 * Class: ohos.rpc.MessageParcel 87 * Method: nativeReadInterfaceToken 88 * Signature: ()LJava/io/String; 89 */ 90 jobject JNICALL Java_ohos_rpc_MessageParcel_nativeReadInterfaceToken(JNIEnv *env, jobject object); 91 92 /* 93 * Class: ohos.rpc.MessageParcel 94 * Method: nativeWriteRawData 95 * Signature: ()LJava/io/String; 96 */ 97 jboolean JNICALL Java_ohos_rpc_MessageParcel_nativeWriteRawData(JNIEnv *env, jobject object, jobject rawData, 98 jint size); 99 100 /* 101 * Class: ohos.rpc.MessageParcel 102 * Method: nativeReadRawData 103 * Signature: ()LJava/io/String; 104 */ 105 jbyteArray JNICALL Java_ohos_rpc_MessageParcel_nativeReadRawData(JNIEnv *env, jobject object, jint size); 106 107 /* 108 * Class: ohos.rpc.MessageParcel 109 * Method: nativeGetRawDataCapacity 110 * Signature: (V)I; 111 */ 112 jint JNICALL Java_ohos_rpc_MessageParcel_nativeGetRawDataCapacity(JNIEnv *env, jobject object); 113 114 /* 115 * Class: ohos.rpc.MessageParcel 116 * Method: nativeCloseFileDescriptor 117 * Signature: (LJava/io/FileDescriptor;)V 118 */ 119 void JNICALL Java_ohos_rpc_MessageParcel_nativeCloseFileDescriptor(JNIEnv *env, jobject object, jobject descriptor); 120 121 /* 122 * Class: ohos.rpc.MessageParcel 123 * Method: nativeDupFileDescriptor 124 * Signature: (LJava/io/FileDescriptor;)LJava/io/FileDescriptor; 125 */ 126 jobject JNICALL Java_ohos_rpc_MessageParcel_nativeDupFileDescriptor(JNIEnv *env, jobject object, jobject descriptor); 127 128 /* 129 * Class: ohos.rpc.MessageParcel 130 * Method: nativeContainFileDescriptors 131 * Signature: ()Z; 132 */ 133 jboolean JNICALL Java_ohos_rpc_MessageParcel_nativeContainFileDescriptors(JNIEnv *env, jobject object); 134 135 /* 136 * Class: ohos.rpc.MessageParcel 137 * Method: nativeWriteAshmem 138 * Signature: (J)Z 139 */ 140 jboolean JNICALL Java_ohos_rpc_MessageParcel_nativeWriteAshmem(JNIEnv *env, jobject object, jlong id); 141 142 /* 143 * Class: ohos.rpc.MessageParcel 144 * Method: nativeReadAshmem 145 * Signature: (V)J 146 */ 147 jlong JNICALL Java_ohos_rpc_MessageParcel_nativeReadAshmem(JNIEnv *env, jobject object); 148 149 /* 150 * Class: ohos.rpc.MessageParcel 151 * Method: nativeReleaseAshmem 152 * Signature: (J)V 153 */ 154 void JNICALL Java_ohos_rpc_MessageParcel_nativeReleaseAshmem(JNIEnv *env, jobject object, jlong id); 155 #ifdef __cplusplus 156 } 157 #endif 158 #endif // OHOS_IPC_JNI_MESSAGE_PARCEL_H 159