+struct CustomOnionMsgQueue {
+ std::mutex mtx;
+ std::vector<LDK::OnionMessageContents> msgs;
+};
+
+uint64_t custom_onion_msg_type_id(const void *this_arg) {
+ return 8888;
+}
+LDKCVec_u8Z custom_onion_msg_bytes(const void *this_arg) {
+ uint8_t *bytes = (uint8_t *) malloc(1024);
+ memset(bytes, 43, 1024);
+ return LDKCVec_u8Z {
+ .data = bytes, .datalen = 1024
+ };
+}
+
+LDKCOption_OnionMessageContentsZ handle_custom_onion_message(const void* this_arg, struct LDKOnionMessageContents msg) {
+ CustomOnionMsgQueue* arg = (CustomOnionMsgQueue*) this_arg;
+ std::unique_lock<std::mutex> lck(arg->mtx);
+ arg->msgs.push_back(std::move(msg));
+ return COption_OnionMessageContentsZ_none();
+}
+
+LDKOnionMessageContents build_custom_onion_message() {
+ return LDKOnionMessageContents {
+ .this_arg = NULL,
+ .tlv_type = custom_onion_msg_type_id,
+ .write = custom_onion_msg_bytes,
+ .free = NULL,
+ };
+}
+
+LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_onion_message(const void* this_arg, uint64_t type, LDKu8slice buf) {
+ assert(type == 8888);
+ assert(buf.datalen == 1024);
+ uint8_t cmp[1024];
+ memset(cmp, 43, 1024);
+ assert(!memcmp(cmp, buf.data, 1024));
+ return CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(COption_OnionMessageContentsZ_some(build_custom_onion_message()));
+}
+
+LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_no_messages(const void* this_arg) {
+ return LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ {
+ .data = NULL, .datalen = 0 };
+}
+