[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / OnionMessageHandler.cs
index ac96df6ff70aa00bff3d27d61cd240e48193c592..30dccb5b3ef953e580758389cfe34561374c69c3 100644 (file)
@@ -10,6 +10,15 @@ namespace org { namespace ldk { namespace structs {
 
 /** An implementation of OnionMessageHandler */
 public interface OnionMessageHandlerInterface {
+       /**Because much of the lightning network does not yet support forwarding onion messages, we
+        * may need to directly connect to a node which will forward a message for us. In such a case,
+        * this method will return the set of nodes which need connection by node_id and the
+        * corresponding socket addresses where they may accept incoming connections.
+        * 
+        * Thus, this method should be polled regularly to detect messages await such a direct
+        * connection.
+        */
+       TwoTuple_PublicKeyCVec_SocketAddressZZ[] get_and_clear_connections_needed();
        /**Handle an incoming `onion_message` message from the given peer.
         */
        void handle_onion_message(byte[] peer_node_id, OnionMessage msg);
@@ -30,6 +39,10 @@ public interface OnionMessageHandlerInterface {
         * drop and refuse to forward onion messages to this peer.
         */
        void peer_disconnected(byte[] their_node_id);
+       /**Performs actions that should happen roughly every ten seconds after startup. Allows handlers
+        * to drop any buffered onion messages intended for prospective peers.
+        */
+       void timer_tick_occurred();
        /**Gets the node feature flags which this handler itself supports. All available handlers are
         * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]
         * which are broadcasted in our [`NodeAnnouncement`] message.
@@ -61,6 +74,12 @@ public class OnionMessageHandler : CommonBase {
                internal LDKOnionMessageHandlerImpl(OnionMessageHandlerInterface arg, LDKOnionMessageHandlerHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
                private OnionMessageHandlerInterface arg;
                private LDKOnionMessageHandlerHolder impl_holder;
+               public long get_and_clear_connections_needed() {
+                       TwoTuple_PublicKeyCVec_SocketAddressZZ[] ret = arg.get_and_clear_connections_needed();
+                               GC.KeepAlive(arg);
+                       long result = InternalUtils.encodeUint64Array(InternalUtils.mapArray(ret, ret_conv_40 => ret_conv_40 == null ? 0 : ret_conv_40.clone_ptr()));
+                       return result;
+               }
                public void handle_onion_message(long _peer_node_id, long _msg) {
                        byte[] _peer_node_id_conv = InternalUtils.decodeUint8Array(_peer_node_id);
                        org.ldk.structs.OnionMessage _msg_hu_conv = null; if (_msg < 0 || _msg > 4096) { _msg_hu_conv = new org.ldk.structs.OnionMessage(null, _msg); }
@@ -87,6 +106,10 @@ public class OnionMessageHandler : CommonBase {
                        arg.peer_disconnected(_their_node_id_conv);
                                GC.KeepAlive(arg);
                }
+               public void timer_tick_occurred() {
+                       arg.timer_tick_occurred();
+                               GC.KeepAlive(arg);
+               }
                public long provided_node_features() {
                        NodeFeatures ret = arg.provided_node_features();
                                GC.KeepAlive(arg);
@@ -114,6 +137,31 @@ public class OnionMessageHandler : CommonBase {
                return impl_holder.held;
        }
 
+       /**
+        * Because much of the lightning network does not yet support forwarding onion messages, we
+        * may need to directly connect to a node which will forward a message for us. In such a case,
+        * this method will return the set of nodes which need connection by node_id and the
+        * corresponding socket addresses where they may accept incoming connections.
+        * 
+        * Thus, this method should be polled regularly to detect messages await such a direct
+        * connection.
+        */
+       public TwoTuple_PublicKeyCVec_SocketAddressZZ[] get_and_clear_connections_needed() {
+               long ret = bindings.OnionMessageHandler_get_and_clear_connections_needed(this.ptr);
+               GC.KeepAlive(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               int ret_conv_40_len = InternalUtils.getArrayLength(ret);
+               TwoTuple_PublicKeyCVec_SocketAddressZZ[] ret_conv_40_arr = new TwoTuple_PublicKeyCVec_SocketAddressZZ[ret_conv_40_len];
+               for (int o = 0; o < ret_conv_40_len; o++) {
+                       long ret_conv_40 = InternalUtils.getU64ArrayElem(ret, o);
+                       TwoTuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_hu_conv = new TwoTuple_PublicKeyCVec_SocketAddressZZ(null, ret_conv_40);
+                       if (ret_conv_40_hu_conv != null) { ret_conv_40_hu_conv.ptrs_to.AddLast(this); };
+                       ret_conv_40_arr[o] = ret_conv_40_hu_conv;
+               }
+               bindings.free_buffer(ret);
+               return ret_conv_40_arr;
+       }
+
        /**
         * Handle an incoming `onion_message` message from the given peer.
         */
@@ -170,6 +218,15 @@ public class OnionMessageHandler : CommonBase {
                GC.KeepAlive(their_node_id);
        }
 
+       /**
+        * Performs actions that should happen roughly every ten seconds after startup. Allows handlers
+        * to drop any buffered onion messages intended for prospective peers.
+        */
+       public void timer_tick_occurred() {
+               bindings.OnionMessageHandler_timer_tick_occurred(this.ptr);
+               GC.KeepAlive(this);
+       }
+
        /**
         * Gets the node feature flags which this handler itself supports. All available handlers are
         * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`]