Skip to content

Commit

Permalink
ios13_postfix#6: network framework rework (#439)
Browse files Browse the repository at this point in the history
* * jetbrains intellij plugin for gradle version updated

* * intellij maven pom reworked into stand-alone. as mvn:version is not able to update parent version number

* * added sonatype repo for snapshot dependencies

* * eclipse plugin's maven.pom switched into standalone (without) as tyho plugin is not able update parent's version during release

* * release script reworked to properly pick up new idea artifact and update it gradle version

* * Idea: release script updated to use property to specify the dependencies. otherview version:commit failed to pick up non existing dependencies (for future version)

* * fixes for Network.framework:
- All object annotations reverted from @NativeProtocolProxy to @nativeclass. As most of protocols declared in framework doesn't exist runtime. That fixes exceptions like `ObjCClassNotFoundException: OS_nw_path_monitor`
- creator static methods converted into object constructors
- added ansi string marshallers were applicable. Sadly lot of places like @blocks is not possible to properly marshal (without extra class wrapper) due compilator limitations

* * network framework regenerated using bro-gen with recent fixes
  • Loading branch information
dkimitsa authored and Tom-Ski committed Jan 10, 2020
1 parent f6b1a27 commit 3bd2d49
Show file tree
Hide file tree
Showing 26 changed files with 408 additions and 171 deletions.
250 changes: 167 additions & 83 deletions compiler/cocoatouch/src/main/bro-gen/network.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_advertise_descriptor")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWAdvertiseDescriptor/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand All @@ -44,6 +44,11 @@
/*<bind>*/static { ObjCRuntime.bind(NWAdvertiseDescriptor.class); }/*</bind>*/
/*<constants>*//*</constants>*/
/*<constructors>*/
/**
* @since Available in iOS 12.0 and later.
*/
public NWAdvertiseDescriptor(String name, String type, String domain) { super((Handle) null, createBonjourService(name, type, domain)); }


/*</constructors>*/
/*<properties>*/
Expand All @@ -55,7 +60,7 @@
* @since Available in iOS 12.0 and later.
*/
@Bridge(symbol="nw_advertise_descriptor_create_bonjour_service", optional=true)
public static native NWAdvertiseDescriptor createBonjourService(BytePtr name, BytePtr type, BytePtr domain);
private static native @Pointer long createBonjourService(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String name, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String type, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String domain);
/**
* @since Available in iOS 12.0 and later.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_browse_descriptor")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWBrowseDescriptor/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand All @@ -44,6 +44,11 @@
/*<bind>*/static { ObjCRuntime.bind(NWBrowseDescriptor.class); }/*</bind>*/
/*<constants>*//*</constants>*/
/*<constructors>*/
/**
* @since Available in iOS 13.0 and later.
*/
public NWBrowseDescriptor(String type, String domain) { super((Handle) null, createBonjourService(type, domain)); }


/*</constructors>*/
/*<properties>*/
Expand All @@ -55,7 +60,7 @@
* @since Available in iOS 13.0 and later.
*/
@Bridge(symbol="nw_browse_descriptor_create_bonjour_service", optional=true)
public static native NWBrowseDescriptor createBonjourService(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String type, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String domain);
private static native @Pointer long createBonjourService(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String type, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String domain);
/**
* @since Available in iOS 13.0 and later.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_browse_result")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWBrowseResult/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_browser")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWBrowser/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand All @@ -44,6 +44,11 @@
/*<bind>*/static { ObjCRuntime.bind(NWBrowser.class); }/*</bind>*/
/*<constants>*//*</constants>*/
/*<constructors>*/
/**
* @since Available in iOS 13.0 and later.
*/
public NWBrowser(NWBrowseDescriptor descriptor, NWParameters parameters) { super((Handle) null, create(descriptor, parameters)); }


/*</constructors>*/
/*<properties>*/
Expand All @@ -55,7 +60,7 @@
* @since Available in iOS 13.0 and later.
*/
@Bridge(symbol="nw_browser_create", optional=true)
public static native NWBrowser create(NWBrowseDescriptor descriptor, NWParameters parameters);
private static native @Pointer long create(NWBrowseDescriptor descriptor, NWParameters parameters);
/**
* @since Available in iOS 13.0 and later.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_connection")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWConnection/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand All @@ -44,12 +44,31 @@
/*<bind>*/static { ObjCRuntime.bind(NWConnection.class); }/*</bind>*/
/*<constants>*//*</constants>*/
/*<constructors>*/
/**
* @since Available in iOS 12.0 and later.
*/
public NWConnection(NWEndpoint endpoint, NWParameters parameters) { super((Handle) null, create(endpoint, parameters)); }


/*</constructors>*/
/*<properties>*/

/*</properties>*/
/*<members>*//*</members>*/

// manually added wrappers
public String copyDescription() {
long ptr = copyDescription0();
if (ptr != 0) {
String res = StringMarshalers.AsAsciiZMarshaler.toObject(String.class, ptr, 0);
// nw_connection_copy_description returns pointer that The caller must call free() on the string.
VM.free(ptr);
return res;
} else {
return null;
}
}

/*<methods>*/
/**
* @since Available in iOS 12.0 and later.
Expand All @@ -61,7 +80,7 @@
* @since Available in iOS 12.0 and later.
*/
@Bridge(symbol="nw_connection_create", optional=true)
public static native NWConnection create(NWEndpoint endpoint, NWParameters parameters);
private static native @Pointer long create(NWEndpoint endpoint, NWParameters parameters);
/**
* @since Available in iOS 12.0 and later.
*/
Expand Down Expand Up @@ -146,7 +165,7 @@
* @since Available in iOS 12.0 and later.
*/
@Bridge(symbol="nw_connection_copy_description", optional=true)
public native BytePtr copyDescription();
protected native @Pointer long copyDescription0();
/**
* @since Available in iOS 12.0 and later.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_content_context")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWContentContext/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand All @@ -44,6 +44,11 @@
/*<bind>*/static { ObjCRuntime.bind(NWContentContext.class); }/*</bind>*/
/*<constants>*//*</constants>*/
/*<constructors>*/
/**
* @since Available in iOS 12.0 and later.
*/
public NWContentContext(String context_identifier) { super((Handle) null, create(context_identifier)); }


/*</constructors>*/
/*<properties>*/
Expand Down Expand Up @@ -71,12 +76,12 @@
* @since Available in iOS 12.0 and later.
*/
@Bridge(symbol="nw_content_context_create", optional=true)
public static native NWContentContext create(BytePtr context_identifier);
private static native @Pointer long create(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String context_identifier);
/**
* @since Available in iOS 12.0 and later.
*/
@Bridge(symbol="nw_content_context_get_identifier", optional=true)
public native BytePtr getIdentifier();
public native @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String getIdentifier();
/**
* @since Available in iOS 12.0 and later.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_data_transfer_report")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWDataTransferReport/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand All @@ -52,7 +52,7 @@
/*<members>*//*</members>*/
/*<methods>*/
@GlobalValue(symbol="_nw_data_transfer_report_all_paths", optional=true)
public static native int AllPaths();
public static native int allPaths();

/**
* @since Available in iOS 13.0 and later.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_endpoint")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWEndpoint/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand All @@ -44,6 +44,19 @@
/*<bind>*/static { ObjCRuntime.bind(NWEndpoint.class); }/*</bind>*/
/*<constants>*//*</constants>*/
/*<constructors>*/
/**
* @since Available in iOS 12.0 and later.
*/
public NWEndpoint(String hostname, String port) { super((Handle) null, createHost(hostname, port)); }
/**
* @since Available in iOS 12.0 and later.
*/
public NWEndpoint(String name, String type, String domain) { super((Handle) null, createBonjourService(name, type, domain)); }
/**
* @since Available in iOS 13.0 and later.
*/
public NWEndpoint(String url) { super((Handle) null, createUrl(url)); }


/*</constructors>*/
/*<properties>*/
Expand All @@ -60,7 +73,7 @@
* @since Available in iOS 12.0 and later.
*/
@Bridge(symbol="nw_endpoint_create_host", optional=true)
public static native NWEndpoint createHost(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String hostname, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String port);
private static native @Pointer long createHost(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String hostname, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String port);
/**
* @since Available in iOS 12.0 and later.
*/
Expand All @@ -85,7 +98,7 @@
* @since Available in iOS 12.0 and later.
*/
@Bridge(symbol="nw_endpoint_create_bonjour_service", optional=true)
public static native NWEndpoint createBonjourService(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String name, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String type, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String domain);
private static native @Pointer long createBonjourService(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String name, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String type, @org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String domain);
/**
* @since Available in iOS 12.0 and later.
*/
Expand All @@ -105,7 +118,7 @@
* @since Available in iOS 13.0 and later.
*/
@Bridge(symbol="nw_endpoint_create_url", optional=true)
public static native NWEndpoint createUrl(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String url);
private static native @Pointer long createUrl(@org.robovm.rt.bro.annotation.Marshaler(StringMarshalers.AsAsciiZMarshaler.class) String url);
/**
* @since Available in iOS 13.0 and later.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_error")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWError/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_establishment_report")/*</annotations>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWEstablishmentReport/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
/*<javadoc>*/

/*</javadoc>*/
/*<annotations>*/@Library("Network") @NativeProtocolProxy("OS_nw_framer")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWFramer/*</name>*/
/*<annotations>*/@Library("Network") @NativeClass("NSObject")/*</annotations>*/
/*<visibility>*/public final/*</visibility>*/ class /*<name>*/NWFramer/*</name>*/
extends /*<extends>*/NWObject/*</extends>*/
/*<implements>*/implements NSObjectProtocol/*</implements>*/ {

Expand All @@ -51,16 +51,11 @@
/*</properties>*/
/*<members>*//*</members>*/
/*<methods>*/
/**
* @since Available in iOS 13.0 and later.
*/
@Bridge(symbol="nw_framer_protocol_create_message", optional=true)
public static native NWProtocolMetadata protocolCreateMessage(NWProtocolDefinition definition);
/**
* @since Available in iOS 13.0 and later.
*/
@Bridge(symbol="nw_framer_message_create", optional=true)
public native NWProtocolMetadata createMessage();
public native NWFramerMessage createMessage();
/**
* @since Available in iOS 13.0 and later.
*/
Expand All @@ -75,7 +70,7 @@
* @since Available in iOS 13.0 and later.
*/
@Bridge(symbol="nw_framer_set_output_handler", optional=true)
public native void setOutputHandler(@Block("(,,@MachineSizedUInt,)") VoidBlock4<NWFramer, NWProtocolMetadata, Long, Boolean> output_handler);
public native void setOutputHandler(@Block("(,,@MachineSizedUInt,)") VoidBlock4<NWFramer, NWFramerMessage, Long, Boolean> output_handler);
/**
* @since Available in iOS 13.0 and later.
*/
Expand Down Expand Up @@ -115,12 +110,12 @@
* @since Available in iOS 13.0 and later.
*/
@Bridge(symbol="nw_framer_deliver_input", optional=true)
public native void deliverInput(BytePtr input_buffer, @MachineSizedUInt long input_length, NWProtocolMetadata message, boolean is_complete);
public native void deliverInput(BytePtr input_buffer, @MachineSizedUInt long input_length, NWFramerMessage message, boolean is_complete);
/**
* @since Available in iOS 13.0 and later.
*/
@Bridge(symbol="nw_framer_deliver_input_no_copy", optional=true)
public native boolean deliverInputNoCopy(@MachineSizedUInt long input_length, NWProtocolMetadata message, boolean is_complete);
public native boolean deliverInputNoCopy(@MachineSizedUInt long input_length, NWFramerMessage message, boolean is_complete);
/**
* @since Available in iOS 13.0 and later.
*/
Expand Down
Loading

0 comments on commit 3bd2d49

Please sign in to comment.