├── .gitignore ├── AUTHORS ├── LICENSE.md ├── README.md ├── android ├── java │ ├── build-extras.gradle │ └── org │ │ └── uproxy │ │ └── tun2socks │ │ ├── Tun2Socks.java │ │ ├── Tun2SocksJni.java │ │ ├── Tunnel.java │ │ ├── TunnelManager.java │ │ ├── TunnelState.java │ │ └── TunnelVpnService.java ├── jni │ ├── Android.mk │ ├── Application.mk │ ├── CMakeLists.txt │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── INSTALL-WINDOWS │ ├── arpprobe │ │ ├── BArpProbe.c │ │ ├── BArpProbe.h │ │ └── CMakeLists.txt │ ├── badvpn.7 │ ├── base │ │ ├── BLog.c │ │ ├── BLog.h │ │ ├── BLog_syslog.c │ │ ├── BLog_syslog.h │ │ ├── BMutex.h │ │ ├── BPending.c │ │ ├── BPending.h │ │ ├── BPending_list.h │ │ ├── CMakeLists.txt │ │ ├── DebugObject.c │ │ └── DebugObject.h │ ├── blog_channels.txt │ ├── blog_generator │ │ ├── blog.php │ │ └── blog_functions.php │ ├── bproto │ │ └── BProto.h │ ├── bproto_generator │ │ ├── ProtoParser.lime │ │ ├── ProtoParser.php │ │ ├── bproto.php │ │ └── bproto_functions.php │ ├── client │ │ ├── CMakeLists.txt │ │ ├── DPReceive.c │ │ ├── DPReceive.h │ │ ├── DPRelay.c │ │ ├── DPRelay.h │ │ ├── DataProto.c │ │ ├── DataProto.h │ │ ├── DataProtoKeepaliveSource.c │ │ ├── DataProtoKeepaliveSource.h │ │ ├── DatagramPeerIO.c │ │ ├── DatagramPeerIO.h │ │ ├── FragmentProtoAssembler.c │ │ ├── FragmentProtoAssembler.h │ │ ├── FragmentProtoAssembler_tree.h │ │ ├── FragmentProtoDisassembler.c │ │ ├── FragmentProtoDisassembler.h │ │ ├── FrameDecider.c │ │ ├── FrameDecider.h │ │ ├── FrameDecider_groups_tree.h │ │ ├── FrameDecider_macs_tree.h │ │ ├── FrameDecider_multicast_tree.h │ │ ├── PasswordListener.c │ │ ├── PasswordListener.h │ │ ├── PeerChat.c │ │ ├── PeerChat.h │ │ ├── SCOutmsgEncoder.c │ │ ├── SCOutmsgEncoder.h │ │ ├── SPProtoDecoder.c │ │ ├── SPProtoDecoder.h │ │ ├── SPProtoEncoder.c │ │ ├── SPProtoEncoder.h │ │ ├── SimpleStreamBuffer.c │ │ ├── SimpleStreamBuffer.h │ │ ├── SinglePacketSource.c │ │ ├── SinglePacketSource.h │ │ ├── StreamPeerIO.c │ │ ├── StreamPeerIO.h │ │ ├── badvpn-client.8 │ │ ├── client.c │ │ └── client.h │ ├── cmake │ │ └── modules │ │ │ ├── COPYING-CMAKE-SCRIPTS │ │ │ ├── FindGLIB2.cmake │ │ │ ├── FindLibraryWithDebug.cmake │ │ │ ├── FindNSPR.cmake │ │ │ ├── FindNSS.cmake │ │ │ └── FindOpenSSL.cmake │ ├── compile-tun2sock.sh │ ├── dhcpclient │ │ ├── BDHCPClient.c │ │ ├── BDHCPClient.h │ │ ├── BDHCPClientCore.c │ │ ├── BDHCPClientCore.h │ │ ├── CMakeLists.txt │ │ ├── DHCPIpUdpDecoder.c │ │ ├── DHCPIpUdpDecoder.h │ │ ├── DHCPIpUdpEncoder.c │ │ └── DHCPIpUdpEncoder.h │ ├── dostest │ │ ├── CMakeLists.txt │ │ ├── StreamBuffer.c │ │ ├── StreamBuffer.h │ │ ├── dostest-attacker.c │ │ └── dostest-server.c │ ├── examples │ │ ├── CMakeLists.txt │ │ ├── FastPacketSource.h │ │ ├── RandomPacketSink.h │ │ ├── TimerPacketSink.h │ │ ├── arpprobe_test.c │ │ ├── bavl_test.c │ │ ├── bencryption_bench.c │ │ ├── bprocess_example.c │ │ ├── brandom2_test.c │ │ ├── btimer_example.c │ │ ├── cavl_test.c │ │ ├── cavl_test_tree.h │ │ ├── dhcpclient_test.c │ │ ├── emscripten_test.c │ │ ├── fairqueue_test.c │ │ ├── fairqueue_test2.c │ │ ├── indexedlist_test.c │ │ ├── ipaddr6_test.c │ │ ├── ncd_parser_test.c │ │ ├── ncd_tokenizer_test.c │ │ ├── ncd_value_parser_test.c │ │ ├── ncdinterfacemonitor_test.c │ │ ├── ncdudevmanager_test.c │ │ ├── ncdudevmonitor_test.c │ │ ├── ncdval_test.c │ │ ├── ncdvalcons_test.c │ │ ├── parse_number_test.c │ │ ├── predicate_test.c │ │ ├── savl_test.c │ │ ├── savl_test_tree.h │ │ ├── stdin_input.c │ │ └── substring_test.c │ ├── fix_flex.php │ ├── flooder │ │ ├── CMakeLists.txt │ │ ├── flooder.c │ │ └── flooder.h │ ├── flow │ │ ├── BufferWriter.c │ │ ├── BufferWriter.h │ │ ├── CMakeLists.txt │ │ ├── LineBuffer.c │ │ ├── LineBuffer.h │ │ ├── PacketBuffer.c │ │ ├── PacketBuffer.h │ │ ├── PacketCopier.c │ │ ├── PacketCopier.h │ │ ├── PacketPassConnector.c │ │ ├── PacketPassConnector.h │ │ ├── PacketPassFairQueue.c │ │ ├── PacketPassFairQueue.h │ │ ├── PacketPassFairQueue_tree.h │ │ ├── PacketPassFifoQueue.c │ │ ├── PacketPassFifoQueue.h │ │ ├── PacketPassInterface.c │ │ ├── PacketPassInterface.h │ │ ├── PacketPassNotifier.c │ │ ├── PacketPassNotifier.h │ │ ├── PacketPassPriorityQueue.c │ │ ├── PacketPassPriorityQueue.h │ │ ├── PacketPassPriorityQueue_tree.h │ │ ├── PacketProtoDecoder.c │ │ ├── PacketProtoDecoder.h │ │ ├── PacketProtoEncoder.c │ │ ├── PacketProtoEncoder.h │ │ ├── PacketProtoFlow.c │ │ ├── PacketProtoFlow.h │ │ ├── PacketRecvBlocker.c │ │ ├── PacketRecvBlocker.h │ │ ├── PacketRecvConnector.c │ │ ├── PacketRecvConnector.h │ │ ├── PacketRecvInterface.c │ │ ├── PacketRecvInterface.h │ │ ├── PacketRouter.c │ │ ├── PacketRouter.h │ │ ├── PacketStreamSender.c │ │ ├── PacketStreamSender.h │ │ ├── RouteBuffer.c │ │ ├── RouteBuffer.h │ │ ├── SinglePacketBuffer.c │ │ ├── SinglePacketBuffer.h │ │ ├── SinglePacketSender.c │ │ ├── SinglePacketSender.h │ │ ├── SingleStreamReceiver.c │ │ ├── SingleStreamReceiver.h │ │ ├── SingleStreamSender.c │ │ ├── SingleStreamSender.h │ │ ├── StreamPacketSender.c │ │ ├── StreamPacketSender.h │ │ ├── StreamPassConnector.c │ │ ├── StreamPassConnector.h │ │ ├── StreamPassInterface.c │ │ ├── StreamPassInterface.h │ │ ├── StreamRecvConnector.c │ │ ├── StreamRecvConnector.h │ │ ├── StreamRecvInterface.c │ │ └── StreamRecvInterface.h │ ├── flowextra │ │ ├── CMakeLists.txt │ │ ├── KeepaliveIO.c │ │ ├── KeepaliveIO.h │ │ ├── PacketPassInactivityMonitor.c │ │ └── PacketPassInactivityMonitor.h │ ├── generate_files │ ├── generated │ │ ├── NCDConfigParser_parse.c │ │ ├── NCDConfigParser_parse.h │ │ ├── NCDConfigParser_parse.out │ │ ├── NCDConfigParser_parse.y │ │ ├── NCDValParser_parse.c │ │ ├── NCDValParser_parse.h │ │ ├── NCDValParser_parse.out │ │ ├── NCDValParser_parse.y │ │ ├── bison_BPredicate.c │ │ ├── bison_BPredicate.h │ │ ├── blog_channel_BArpProbe.h │ │ ├── blog_channel_BConnection.h │ │ ├── blog_channel_BDHCPClient.h │ │ ├── blog_channel_BDHCPClientCore.h │ │ ├── blog_channel_BDatagram.h │ │ ├── blog_channel_BEncryption.h │ │ ├── blog_channel_BInputProcess.h │ │ ├── blog_channel_BLockReactor.h │ │ ├── blog_channel_BNetwork.h │ │ ├── blog_channel_BPredicate.h │ │ ├── blog_channel_BProcess.h │ │ ├── blog_channel_BReactor.h │ │ ├── blog_channel_BSSLConnection.h │ │ ├── blog_channel_BSignal.h │ │ ├── blog_channel_BSocksClient.h │ │ ├── blog_channel_BTap.h │ │ ├── blog_channel_BThreadSignal.h │ │ ├── blog_channel_BThreadWork.h │ │ ├── blog_channel_BTime.h │ │ ├── blog_channel_BUnixSignal.h │ │ ├── blog_channel_DPReceive.h │ │ ├── blog_channel_DPRelay.h │ │ ├── blog_channel_DataProto.h │ │ ├── blog_channel_DatagramPeerIO.h │ │ ├── blog_channel_FragmentProtoAssembler.h │ │ ├── blog_channel_FrameDecider.h │ │ ├── blog_channel_LineBuffer.h │ │ ├── blog_channel_Listener.h │ │ ├── blog_channel_NCDBuildProgram.h │ │ ├── blog_channel_NCDConfigParser.h │ │ ├── blog_channel_NCDConfigTokenizer.h │ │ ├── blog_channel_NCDIfConfig.h │ │ ├── blog_channel_NCDInterfaceMonitor.h │ │ ├── blog_channel_NCDModuleIndex.h │ │ ├── blog_channel_NCDModuleProcess.h │ │ ├── blog_channel_NCDPlaceholderDb.h │ │ ├── blog_channel_NCDRequest.h │ │ ├── blog_channel_NCDRequestClient.h │ │ ├── blog_channel_NCDRfkillMonitor.h │ │ ├── blog_channel_NCDUdevCache.h │ │ ├── blog_channel_NCDUdevManager.h │ │ ├── blog_channel_NCDUdevMonitor.h │ │ ├── blog_channel_NCDUdevMonitorParser.h │ │ ├── blog_channel_NCDVal.h │ │ ├── blog_channel_NCDValGenerator.h │ │ ├── blog_channel_NCDValParser.h │ │ ├── blog_channel_PRStreamSink.h │ │ ├── blog_channel_PRStreamSource.h │ │ ├── blog_channel_PacketProtoDecoder.h │ │ ├── blog_channel_PasswordListener.h │ │ ├── blog_channel_PeerChat.h │ │ ├── blog_channel_SPProtoDecoder.h │ │ ├── blog_channel_ServerConnection.h │ │ ├── blog_channel_SocksUdpGwClient.h │ │ ├── blog_channel_StreamPeerIO.h │ │ ├── blog_channel_UdpGwClient.h │ │ ├── blog_channel_addr.h │ │ ├── blog_channel_client.h │ │ ├── blog_channel_dostest_attacker.h │ │ ├── blog_channel_dostest_server.h │ │ ├── blog_channel_flooder.h │ │ ├── blog_channel_lwip.h │ │ ├── blog_channel_ncd.h │ │ ├── blog_channel_ncd_alias.h │ │ ├── blog_channel_ncd_arithmetic.h │ │ ├── blog_channel_ncd_assert.h │ │ ├── blog_channel_ncd_backtrack.h │ │ ├── blog_channel_ncd_blocker.h │ │ ├── blog_channel_ncd_buffer.h │ │ ├── blog_channel_ncd_call2.h │ │ ├── blog_channel_ncd_choose.h │ │ ├── blog_channel_ncd_concat.h │ │ ├── blog_channel_ncd_daemon.h │ │ ├── blog_channel_ncd_depend.h │ │ ├── blog_channel_ncd_depend_scope.h │ │ ├── blog_channel_ncd_dynamic_depend.h │ │ ├── blog_channel_ncd_exit.h │ │ ├── blog_channel_ncd_explode.h │ │ ├── blog_channel_ncd_file.h │ │ ├── blog_channel_ncd_file_open.h │ │ ├── blog_channel_ncd_foreach.h │ │ ├── blog_channel_ncd_from_string.h │ │ ├── blog_channel_ncd_getargs.h │ │ ├── blog_channel_ncd_getenv.h │ │ ├── blog_channel_ncd_if.h │ │ ├── blog_channel_ncd_imperative.h │ │ ├── blog_channel_ncd_implode.h │ │ ├── blog_channel_ncd_index.h │ │ ├── blog_channel_ncd_list.h │ │ ├── blog_channel_ncd_load_module.h │ │ ├── blog_channel_ncd_log.h │ │ ├── blog_channel_ncd_log_msg.h │ │ ├── blog_channel_ncd_logical.h │ │ ├── blog_channel_ncd_multidepend.h │ │ ├── blog_channel_ncd_net_backend_badvpn.h │ │ ├── blog_channel_ncd_net_backend_rfkill.h │ │ ├── blog_channel_ncd_net_backend_waitdevice.h │ │ ├── blog_channel_ncd_net_backend_waitlink.h │ │ ├── blog_channel_ncd_net_backend_wpa_supplicant.h │ │ ├── blog_channel_ncd_net_dns.h │ │ ├── blog_channel_ncd_net_iptables.h │ │ ├── blog_channel_ncd_net_ipv4_addr.h │ │ ├── blog_channel_ncd_net_ipv4_addr_in_network.h │ │ ├── blog_channel_ncd_net_ipv4_arp_probe.h │ │ ├── blog_channel_ncd_net_ipv4_dhcp.h │ │ ├── blog_channel_ncd_net_ipv4_route.h │ │ ├── blog_channel_ncd_net_ipv6_addr.h │ │ ├── blog_channel_ncd_net_ipv6_addr_in_network.h │ │ ├── blog_channel_ncd_net_ipv6_route.h │ │ ├── blog_channel_ncd_net_ipv6_wait_dynamic_addr.h │ │ ├── blog_channel_ncd_net_up.h │ │ ├── blog_channel_ncd_net_watch_interfaces.h │ │ ├── blog_channel_ncd_netmask.h │ │ ├── blog_channel_ncd_ondemand.h │ │ ├── blog_channel_ncd_parse.h │ │ ├── blog_channel_ncd_print.h │ │ ├── blog_channel_ncd_process_manager.h │ │ ├── blog_channel_ncd_reboot.h │ │ ├── blog_channel_ncd_ref.h │ │ ├── blog_channel_ncd_regex_match.h │ │ ├── blog_channel_ncd_request.h │ │ ├── blog_channel_ncd_run.h │ │ ├── blog_channel_ncd_runonce.h │ │ ├── blog_channel_ncd_sleep.h │ │ ├── blog_channel_ncd_socket.h │ │ ├── blog_channel_ncd_spawn.h │ │ ├── blog_channel_ncd_strcmp.h │ │ ├── blog_channel_ncd_substr.h │ │ ├── blog_channel_ncd_sys_evdev.h │ │ ├── blog_channel_ncd_sys_request_client.h │ │ ├── blog_channel_ncd_sys_request_server.h │ │ ├── blog_channel_ncd_sys_start_process.h │ │ ├── blog_channel_ncd_sys_watch_directory.h │ │ ├── blog_channel_ncd_sys_watch_input.h │ │ ├── blog_channel_ncd_sys_watch_usb.h │ │ ├── blog_channel_ncd_timer.h │ │ ├── blog_channel_ncd_to_string.h │ │ ├── blog_channel_ncd_try.h │ │ ├── blog_channel_ncd_value.h │ │ ├── blog_channel_ncd_valuemetic.h │ │ ├── blog_channel_ncd_var.h │ │ ├── blog_channel_nsskey.h │ │ ├── blog_channel_server.h │ │ ├── blog_channel_tun2socks.h │ │ ├── blog_channel_udpgw.h │ │ ├── blog_channels_defines.h │ │ ├── blog_channels_list.h │ │ ├── bproto_addr.h │ │ ├── bproto_bproto_test.h │ │ ├── bproto_msgproto.h │ │ ├── flex_BPredicate.c │ │ └── flex_BPredicate.h │ ├── lemon │ │ ├── lemon.c │ │ └── lempar.c │ ├── lime │ │ ├── HOWTO │ │ ├── flex_token_stream.php │ │ ├── lemon.c │ │ ├── lime.bootstrap │ │ ├── lime.php │ │ ├── lime_scan_tokens.l │ │ ├── metagrammar │ │ ├── parse_engine.php │ │ └── set.so.php │ ├── lwip │ │ ├── CHANGELOG │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── FILES │ │ ├── README │ │ ├── UPGRADING │ │ ├── custom │ │ │ ├── arch │ │ │ │ ├── cc.h │ │ │ │ └── perf.h │ │ │ ├── lwipopts.h │ │ │ └── sys.c │ │ ├── doc │ │ │ ├── FILES │ │ │ ├── contrib.txt │ │ │ ├── rawapi.txt │ │ │ ├── savannah.txt │ │ │ ├── snmp_agent.txt │ │ │ └── sys_arch.txt │ │ ├── lwip-base-version │ │ ├── src │ │ │ ├── FILES │ │ │ ├── api │ │ │ │ ├── api_lib.c │ │ │ │ ├── api_msg.c │ │ │ │ ├── err.c │ │ │ │ ├── netbuf.c │ │ │ │ ├── netdb.c │ │ │ │ ├── netifapi.c │ │ │ │ ├── sockets.c │ │ │ │ └── tcpip.c │ │ │ ├── core │ │ │ │ ├── def.c │ │ │ │ ├── dhcp.c │ │ │ │ ├── dns.c │ │ │ │ ├── inet_chksum.c │ │ │ │ ├── init.c │ │ │ │ ├── ipv4 │ │ │ │ │ ├── autoip.c │ │ │ │ │ ├── icmp.c │ │ │ │ │ ├── igmp.c │ │ │ │ │ ├── ip4.c │ │ │ │ │ ├── ip4_addr.c │ │ │ │ │ └── ip_frag.c │ │ │ │ ├── ipv6 │ │ │ │ │ ├── README │ │ │ │ │ ├── dhcp6.c │ │ │ │ │ ├── ethip6.c │ │ │ │ │ ├── icmp6.c │ │ │ │ │ ├── inet6.c │ │ │ │ │ ├── ip6.c │ │ │ │ │ ├── ip6_addr.c │ │ │ │ │ ├── ip6_frag.c │ │ │ │ │ ├── mld6.c │ │ │ │ │ └── nd6.c │ │ │ │ ├── mem.c │ │ │ │ ├── memp.c │ │ │ │ ├── netif.c │ │ │ │ ├── pbuf.c │ │ │ │ ├── raw.c │ │ │ │ ├── snmp │ │ │ │ │ ├── asn1_dec.c │ │ │ │ │ ├── asn1_enc.c │ │ │ │ │ ├── mib2.c │ │ │ │ │ ├── mib_structs.c │ │ │ │ │ ├── msg_in.c │ │ │ │ │ └── msg_out.c │ │ │ │ ├── stats.c │ │ │ │ ├── sys.c │ │ │ │ ├── tcp.c │ │ │ │ ├── tcp_in.c │ │ │ │ ├── tcp_out.c │ │ │ │ ├── timers.c │ │ │ │ └── udp.c │ │ │ ├── include │ │ │ │ ├── ipv4 │ │ │ │ │ └── lwip │ │ │ │ │ │ ├── autoip.h │ │ │ │ │ │ ├── icmp.h │ │ │ │ │ │ ├── igmp.h │ │ │ │ │ │ ├── inet.h │ │ │ │ │ │ ├── ip4.h │ │ │ │ │ │ ├── ip4_addr.h │ │ │ │ │ │ └── ip_frag.h │ │ │ │ ├── ipv6 │ │ │ │ │ └── lwip │ │ │ │ │ │ ├── dhcp6.h │ │ │ │ │ │ ├── ethip6.h │ │ │ │ │ │ ├── icmp6.h │ │ │ │ │ │ ├── inet6.h │ │ │ │ │ │ ├── ip6.h │ │ │ │ │ │ ├── ip6_addr.h │ │ │ │ │ │ ├── ip6_frag.h │ │ │ │ │ │ ├── mld6.h │ │ │ │ │ │ └── nd6.h │ │ │ │ ├── lwip │ │ │ │ │ ├── api.h │ │ │ │ │ ├── api_msg.h │ │ │ │ │ ├── arch.h │ │ │ │ │ ├── debug.h │ │ │ │ │ ├── def.h │ │ │ │ │ ├── dhcp.h │ │ │ │ │ ├── dns.h │ │ │ │ │ ├── err.h │ │ │ │ │ ├── inet_chksum.h │ │ │ │ │ ├── init.h │ │ │ │ │ ├── ip.h │ │ │ │ │ ├── ip_addr.h │ │ │ │ │ ├── mem.h │ │ │ │ │ ├── memp.h │ │ │ │ │ ├── memp_std.h │ │ │ │ │ ├── netbuf.h │ │ │ │ │ ├── netdb.h │ │ │ │ │ ├── netif.h │ │ │ │ │ ├── netifapi.h │ │ │ │ │ ├── opt.h │ │ │ │ │ ├── pbuf.h │ │ │ │ │ ├── raw.h │ │ │ │ │ ├── sio.h │ │ │ │ │ ├── snmp.h │ │ │ │ │ ├── snmp_asn1.h │ │ │ │ │ ├── snmp_msg.h │ │ │ │ │ ├── snmp_structs.h │ │ │ │ │ ├── sockets.h │ │ │ │ │ ├── stats.h │ │ │ │ │ ├── sys.h │ │ │ │ │ ├── tcp.h │ │ │ │ │ ├── tcp_impl.h │ │ │ │ │ ├── tcpip.h │ │ │ │ │ ├── timers.h │ │ │ │ │ └── udp.h │ │ │ │ ├── netif │ │ │ │ │ ├── etharp.h │ │ │ │ │ ├── ppp_oe.h │ │ │ │ │ └── slipif.h │ │ │ │ └── posix │ │ │ │ │ ├── netdb.h │ │ │ │ │ └── sys │ │ │ │ │ └── socket.h │ │ │ └── netif │ │ │ │ ├── FILES │ │ │ │ ├── etharp.c │ │ │ │ ├── ethernetif.c │ │ │ │ ├── ppp │ │ │ │ ├── auth.c │ │ │ │ ├── auth.h │ │ │ │ ├── chap.c │ │ │ │ ├── chap.h │ │ │ │ ├── chpms.c │ │ │ │ ├── chpms.h │ │ │ │ ├── fsm.c │ │ │ │ ├── fsm.h │ │ │ │ ├── ipcp.c │ │ │ │ ├── ipcp.h │ │ │ │ ├── lcp.c │ │ │ │ ├── lcp.h │ │ │ │ ├── magic.c │ │ │ │ ├── magic.h │ │ │ │ ├── md5.c │ │ │ │ ├── md5.h │ │ │ │ ├── pap.c │ │ │ │ ├── pap.h │ │ │ │ ├── ppp.c │ │ │ │ ├── ppp.h │ │ │ │ ├── ppp_impl.h │ │ │ │ ├── ppp_oe.c │ │ │ │ ├── pppdebug.h │ │ │ │ ├── randm.c │ │ │ │ ├── randm.h │ │ │ │ ├── readme.txt │ │ │ │ ├── vj.c │ │ │ │ └── vj.h │ │ │ │ └── slipif.c │ │ └── test │ │ │ └── unit │ │ │ ├── core │ │ │ ├── test_mem.c │ │ │ ├── test_mem.h │ │ │ ├── test_pbuf.c │ │ │ └── test_pbuf.h │ │ │ ├── dhcp │ │ │ ├── test_dhcp.c │ │ │ └── test_dhcp.h │ │ │ ├── etharp │ │ │ ├── test_etharp.c │ │ │ └── test_etharp.h │ │ │ ├── lwip_check.h │ │ │ ├── lwip_unittests.c │ │ │ ├── lwipopts.h │ │ │ ├── tcp │ │ │ ├── tcp_helper.c │ │ │ ├── tcp_helper.h │ │ │ ├── test_tcp.c │ │ │ ├── test_tcp.h │ │ │ ├── test_tcp_oos.c │ │ │ └── test_tcp_oos.h │ │ │ └── udp │ │ │ ├── test_udp.c │ │ │ └── test_udp.h │ ├── misc │ │ ├── BRefTarget.h │ │ ├── Utf16Decoder.h │ │ ├── Utf16Encoder.h │ │ ├── Utf8Decoder.h │ │ ├── Utf8Encoder.h │ │ ├── arp_proto.h │ │ ├── array_length.h │ │ ├── balign.h │ │ ├── balloc.h │ │ ├── blimits.h │ │ ├── bsize.h │ │ ├── bsort.h │ │ ├── bstring.h │ │ ├── byteorder.h │ │ ├── cmdline.h │ │ ├── compare.h │ │ ├── concat_strings.h │ │ ├── cstring.h │ │ ├── dead.h │ │ ├── debug.h │ │ ├── debugcounter.h │ │ ├── debugerror.h │ │ ├── dhcp_proto.h │ │ ├── dns_proto.h │ │ ├── ethernet_proto.h │ │ ├── exparray.h │ │ ├── expstring.h │ │ ├── find_char.h │ │ ├── find_program.h │ │ ├── get_iface_info.h │ │ ├── grow_array.h │ │ ├── hashfun.h │ │ ├── igmp_proto.h │ │ ├── ipaddr.h │ │ ├── ipaddr6.h │ │ ├── ipv4_proto.h │ │ ├── ipv6_proto.h │ │ ├── loggers_string.h │ │ ├── loglevel.h │ │ ├── maxalign.h │ │ ├── merge.h │ │ ├── minmax.h │ │ ├── modadd.h │ │ ├── mswsock.h │ │ ├── nonblocking.h │ │ ├── nsskey.h │ │ ├── offset.h │ │ ├── open_standard_streams.h │ │ ├── overflow.h │ │ ├── packed.h │ │ ├── parse_number.h │ │ ├── print_macros.h │ │ ├── read_file.h │ │ ├── read_write_int.h │ │ ├── socks_proto.h │ │ ├── sslsocket.h │ │ ├── stdbuf_cmdline.h │ │ ├── strdup.h │ │ ├── string_begins_with.h │ │ ├── substring.h │ │ ├── udp_proto.h │ │ ├── unicode_funcs.h │ │ ├── version.h │ │ └── write_file.h │ ├── ncd-request │ │ ├── CMakeLists.txt │ │ └── ncd-request.c │ ├── ncd │ │ ├── CMakeLists.txt │ │ ├── NCDAst.c │ │ ├── NCDAst.h │ │ ├── NCDBuildProgram.c │ │ ├── NCDBuildProgram.h │ │ ├── NCDConfigParser.c │ │ ├── NCDConfigParser.h │ │ ├── NCDConfigParser_parse.y │ │ ├── NCDConfigTokenizer.c │ │ ├── NCDConfigTokenizer.h │ │ ├── NCDInterpProcess.c │ │ ├── NCDInterpProcess.h │ │ ├── NCDInterpProg.c │ │ ├── NCDInterpProg.h │ │ ├── NCDInterpProg_hash.h │ │ ├── NCDInterpreter.c │ │ ├── NCDInterpreter.h │ │ ├── NCDMethodIndex.c │ │ ├── NCDMethodIndex.h │ │ ├── NCDMethodIndex_hash.h │ │ ├── NCDModule.c │ │ ├── NCDModule.h │ │ ├── NCDModuleIndex.c │ │ ├── NCDModuleIndex.h │ │ ├── NCDModuleIndex_mhash.h │ │ ├── NCDObject.c │ │ ├── NCDObject.h │ │ ├── NCDPlaceholderDb.c │ │ ├── NCDPlaceholderDb.h │ │ ├── NCDStringIndex.c │ │ ├── NCDStringIndex.h │ │ ├── NCDStringIndex_hash.h │ │ ├── NCDSugar.c │ │ ├── NCDSugar.h │ │ ├── NCDVal.c │ │ ├── NCDVal.h │ │ ├── NCDValCons.c │ │ ├── NCDValCons.h │ │ ├── NCDValGenerator.c │ │ ├── NCDValGenerator.h │ │ ├── NCDValParser.c │ │ ├── NCDValParser.h │ │ ├── NCDValParser_parse.y │ │ ├── NCDVal_maptree.h │ │ ├── README │ │ ├── emncd.c │ │ ├── emncd.html │ │ ├── examples │ │ │ ├── dbus_start.ncd │ │ │ ├── dhcpd.conf.template │ │ │ ├── directory_updater.ncd │ │ │ ├── events.ncd │ │ │ ├── igmpproxy.conf.template │ │ │ ├── make_dhcp_config.ncd │ │ │ ├── make_igmpproxy_config.ncd │ │ │ ├── network.ncd │ │ │ ├── onoff_server.ncdi │ │ │ ├── onoff_server_test.ncd │ │ │ ├── tcp_echo_client.ncd │ │ │ └── tcp_echo_server.ncd │ │ ├── extra │ │ │ ├── BEventLock.c │ │ │ ├── BEventLock.h │ │ │ ├── NCDBProcessOpts.c │ │ │ ├── NCDBProcessOpts.h │ │ │ ├── NCDBuf.c │ │ │ ├── NCDBuf.h │ │ │ ├── NCDIfConfig.c │ │ │ ├── NCDIfConfig.h │ │ │ ├── NCDInterfaceMonitor.c │ │ │ ├── NCDInterfaceMonitor.h │ │ │ ├── NCDRequestClient.c │ │ │ ├── NCDRequestClient.h │ │ │ ├── NCDRfkillMonitor.c │ │ │ ├── NCDRfkillMonitor.h │ │ │ ├── address_utils.h │ │ │ ├── build_cmdline.c │ │ │ ├── build_cmdline.h │ │ │ ├── make_fast_names.h │ │ │ └── value_utils.h │ │ ├── include_linux_input.c │ │ ├── make_name_indices.h │ │ ├── modules │ │ │ ├── alias.c │ │ │ ├── arithmetic.c │ │ │ ├── assert.c │ │ │ ├── backtrack.c │ │ │ ├── blocker.c │ │ │ ├── buffer.c │ │ │ ├── buffer_chunks_tree.h │ │ │ ├── call2.c │ │ │ ├── choose.c │ │ │ ├── command_template.c │ │ │ ├── command_template.h │ │ │ ├── concat.c │ │ │ ├── daemon.c │ │ │ ├── depend.c │ │ │ ├── depend_scope.c │ │ │ ├── dynamic_depend.c │ │ │ ├── event_template.c │ │ │ ├── event_template.h │ │ │ ├── exit.c │ │ │ ├── explode.c │ │ │ ├── file.c │ │ │ ├── file_open.c │ │ │ ├── foreach.c │ │ │ ├── from_string.c │ │ │ ├── getargs.c │ │ │ ├── getenv.c │ │ │ ├── if.c │ │ │ ├── imperative.c │ │ │ ├── implode.c │ │ │ ├── index.c │ │ │ ├── list.c │ │ │ ├── load_module.c │ │ │ ├── log.c │ │ │ ├── logical.c │ │ │ ├── modules.h │ │ │ ├── multidepend.c │ │ │ ├── net_backend_badvpn.c │ │ │ ├── net_backend_rfkill.c │ │ │ ├── net_backend_waitdevice.c │ │ │ ├── net_backend_waitlink.c │ │ │ ├── net_backend_wpa_supplicant.c │ │ │ ├── net_dns.c │ │ │ ├── net_iptables.c │ │ │ ├── net_ipv4_addr.c │ │ │ ├── net_ipv4_addr_in_network.c │ │ │ ├── net_ipv4_arp_probe.c │ │ │ ├── net_ipv4_dhcp.c │ │ │ ├── net_ipv4_route.c │ │ │ ├── net_ipv6_addr.c │ │ │ ├── net_ipv6_addr_in_network.c │ │ │ ├── net_ipv6_route.c │ │ │ ├── net_ipv6_wait_dynamic_addr.c │ │ │ ├── net_up.c │ │ │ ├── net_watch_interfaces.c │ │ │ ├── netmask.c │ │ │ ├── ondemand.c │ │ │ ├── parse.c │ │ │ ├── print.c │ │ │ ├── process_manager.c │ │ │ ├── reboot.c │ │ │ ├── ref.c │ │ │ ├── regex_match.c │ │ │ ├── run.c │ │ │ ├── runonce.c │ │ │ ├── sleep.c │ │ │ ├── socket.c │ │ │ ├── spawn.c │ │ │ ├── strcmp.c │ │ │ ├── substr.c │ │ │ ├── sys_evdev.c │ │ │ ├── sys_request_client.c │ │ │ ├── sys_request_server.c │ │ │ ├── sys_start_process.c │ │ │ ├── sys_watch_directory.c │ │ │ ├── sys_watch_input.c │ │ │ ├── sys_watch_usb.c │ │ │ ├── timer.c │ │ │ ├── to_string.c │ │ │ ├── try.c │ │ │ ├── value.c │ │ │ ├── value_maptree.h │ │ │ ├── valuemetic.c │ │ │ └── var.c │ │ ├── ncd.c │ │ ├── ncd.h │ │ ├── parse_linux_input.sh │ │ ├── static_strings.h │ │ └── tests │ │ │ ├── addr_in_network.ncd │ │ │ ├── alias.ncd │ │ │ ├── arithmetic.ncd │ │ │ ├── backtracking.ncd │ │ │ ├── buffer.ncd │ │ │ ├── call.ncd │ │ │ ├── concat.ncd │ │ │ ├── depend.ncd │ │ │ ├── depend_scope.ncd │ │ │ ├── escape_and_nulls.ncd │ │ │ ├── explode.ncd │ │ │ ├── foreach.ncd │ │ │ ├── if.ncd │ │ │ ├── implode.ncd │ │ │ ├── include.ncd │ │ │ ├── include_included.ncdi │ │ │ ├── include_included2.ncdi │ │ │ ├── logical.ncd │ │ │ ├── multidepend.ncd │ │ │ ├── netmask.ncd │ │ │ ├── parse.ncd │ │ │ ├── process_manager.ncd │ │ │ ├── regex.ncd │ │ │ ├── run_tests │ │ │ ├── strings.ncd │ │ │ ├── substr.ncd │ │ │ ├── turing.ncd │ │ │ ├── value.ncd │ │ │ └── value_substr.ncd │ ├── nspr_support │ │ ├── BSSLConnection.c │ │ ├── BSSLConnection.h │ │ ├── CMakeLists.txt │ │ ├── DummyPRFileDesc.c │ │ └── DummyPRFileDesc.h │ ├── predicate │ │ ├── BPredicate.c │ │ ├── BPredicate.h │ │ ├── BPredicate.l │ │ ├── BPredicate.y │ │ ├── BPredicate_internal.h │ │ ├── BPredicate_parser.h │ │ ├── CMakeLists.txt │ │ └── LexMemoryBufferInput.h │ ├── protocol │ │ ├── addr.bproto │ │ ├── addr.h │ │ ├── dataproto.h │ │ ├── fragmentproto.h │ │ ├── msgproto.bproto │ │ ├── msgproto.h │ │ ├── packetproto.h │ │ ├── requestproto.h │ │ ├── scproto.h │ │ ├── spproto.h │ │ └── udpgw_proto.h │ ├── random │ │ ├── BRandom2.c │ │ ├── BRandom2.h │ │ └── CMakeLists.txt │ ├── scripts │ │ ├── cmake │ │ ├── copy_nss │ │ └── toolchain.cmake │ ├── security │ │ ├── BEncryption.c │ │ ├── BEncryption.h │ │ ├── BHash.c │ │ ├── BHash.h │ │ ├── BRandom.c │ │ ├── BRandom.h │ │ ├── BSecurity.c │ │ ├── BSecurity.h │ │ ├── CMakeLists.txt │ │ ├── OTPCalculator.c │ │ ├── OTPCalculator.h │ │ ├── OTPChecker.c │ │ ├── OTPChecker.h │ │ ├── OTPGenerator.c │ │ └── OTPGenerator.h │ ├── server │ │ ├── CMakeLists.txt │ │ ├── badvpn-server.8 │ │ ├── server.c │ │ └── server.h │ ├── server_connection │ │ ├── CMakeLists.txt │ │ ├── SCKeepaliveSource.c │ │ ├── SCKeepaliveSource.h │ │ ├── ServerConnection.c │ │ └── ServerConnection.h │ ├── socksclient │ │ ├── BSocksClient.c │ │ ├── BSocksClient.h │ │ └── CMakeLists.txt │ ├── stringmap │ │ ├── BStringMap.c │ │ ├── BStringMap.h │ │ └── CMakeLists.txt │ ├── structure │ │ ├── BAVL.h │ │ ├── CAvl.h │ │ ├── CAvl_decl.h │ │ ├── CAvl_footer.h │ │ ├── CAvl_header.h │ │ ├── CAvl_impl.h │ │ ├── CHash.h │ │ ├── CHash_decl.h │ │ ├── CHash_footer.h │ │ ├── CHash_header.h │ │ ├── CHash_impl.h │ │ ├── ChunkBuffer2.h │ │ ├── IndexedList.h │ │ ├── IndexedList_tree.h │ │ ├── LinkedList0.h │ │ ├── LinkedList1.h │ │ ├── LinkedList3.h │ │ ├── SAvl.h │ │ ├── SAvl_decl.h │ │ ├── SAvl_footer.h │ │ ├── SAvl_header.h │ │ ├── SAvl_impl.h │ │ ├── SAvl_tree.h │ │ ├── SLinkedList.h │ │ ├── SLinkedList_decl.h │ │ ├── SLinkedList_footer.h │ │ ├── SLinkedList_header.h │ │ └── SLinkedList_impl.h │ ├── system │ │ ├── BAddr.h │ │ ├── BConnection.h │ │ ├── BConnectionGeneric.h │ │ ├── BConnection_unix.c │ │ ├── BConnection_unix.h │ │ ├── BConnection_win.c │ │ ├── BConnection_win.h │ │ ├── BDatagram.h │ │ ├── BDatagram_unix.c │ │ ├── BDatagram_unix.h │ │ ├── BDatagram_win.c │ │ ├── BDatagram_win.h │ │ ├── BInputProcess.c │ │ ├── BInputProcess.h │ │ ├── BLockReactor.c │ │ ├── BLockReactor.h │ │ ├── BNetwork.c │ │ ├── BNetwork.h │ │ ├── BProcess.c │ │ ├── BProcess.h │ │ ├── BReactor.h │ │ ├── BReactor_badvpn.c │ │ ├── BReactor_badvpn.h │ │ ├── BReactor_badvpn_timerstree.h │ │ ├── BReactor_emscripten.c │ │ ├── BReactor_emscripten.h │ │ ├── BReactor_glib.c │ │ ├── BReactor_glib.h │ │ ├── BSignal.c │ │ ├── BSignal.h │ │ ├── BThreadSignal.c │ │ ├── BThreadSignal.h │ │ ├── BTime.c │ │ ├── BTime.h │ │ ├── BUnixSignal.c │ │ ├── BUnixSignal.h │ │ └── CMakeLists.txt │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── bproto_test.bproto │ │ ├── bproto_test.c │ │ ├── chunkbuffer2_test.c │ │ └── threadwork_test.c │ ├── threadwork │ │ ├── BThreadWork.c │ │ ├── BThreadWork.h │ │ └── CMakeLists.txt │ ├── tun2socks │ │ ├── CMakeLists.txt │ │ ├── SocksUdpGwClient.c │ │ ├── SocksUdpGwClient.h │ │ ├── badvpn-tun2socks.8 │ │ ├── jni │ │ │ └── ca │ │ │ │ └── psiphon │ │ │ │ └── Tun2Socks.java │ │ ├── tun2socks.c │ │ └── tun2socks.h │ ├── tunctl │ │ ├── CMakeLists.txt │ │ └── tunctl.c │ ├── tuntap │ │ ├── BTap.c │ │ ├── BTap.h │ │ ├── CMakeLists.txt │ │ ├── tapwin32-funcs.c │ │ ├── tapwin32-funcs.h │ │ └── wintap-common.h │ ├── udevmonitor │ │ ├── CMakeLists.txt │ │ ├── NCDUdevCache.c │ │ ├── NCDUdevCache.h │ │ ├── NCDUdevManager.c │ │ ├── NCDUdevManager.h │ │ ├── NCDUdevMonitor.c │ │ ├── NCDUdevMonitor.h │ │ ├── NCDUdevMonitorParser.c │ │ └── NCDUdevMonitorParser.h │ ├── udpgw │ │ ├── CMakeLists.txt │ │ ├── udpgw.c │ │ └── udpgw.h │ └── udpgw_client │ │ ├── CMakeLists.txt │ │ ├── UdpGwClient.c │ │ └── UdpGwClient.h └── libs │ └── armeabi-v7a │ └── libtun2socks.so ├── plugin.xml └── tun2socks.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.csproj.user 2 | *.suo 3 | *.cache 4 | Thumbs.db 5 | *.DS_Store 6 | 7 | *.bak 8 | *.cache 9 | *.log 10 | *.swp 11 | *.user 12 | 13 | .gradle 14 | .idea 15 | .vscode 16 | android/obj 17 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | University of Washington 2 | -------------------------------------------------------------------------------- /android/java/build-extras.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile 'com.android.support:appcompat-v7:23.4.0' 3 | } 4 | -------------------------------------------------------------------------------- /android/java/org/uproxy/tun2socks/Tun2SocksJni.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Psiphon Inc. 3 | * Released under badvpn licence: https://github.com/ambrop72/badvpn#license 4 | */ 5 | 6 | package org.uproxy.tun2socks; 7 | 8 | import android.util.Log; 9 | 10 | public class Tun2SocksJni { 11 | 12 | // runTun2Socks takes a tun device file descriptor (from Android's VpnService, 13 | // for example) and plugs it into tun2socks, which routes the tun TCP traffic 14 | // through the specified SOCKS proxy. UDP traffic is sent to the specified 15 | // udpgw server. 16 | // 17 | // The tun device file descriptor should be set to non-blocking mode. 18 | // tun2Socks does *not* take ownership of the tun device file descriptor; the 19 | // caller is responsible for closing it after tun2socks terminates. 20 | // 21 | // runTun2Socks blocks until tun2socks is stopped by calling terminateTun2Socks. 22 | // It's safe to call terminateTun2Socks from a different thread. 23 | // 24 | // logTun2Socks is called from tun2socks when an event is to be logged. 25 | 26 | public static native int runTun2Socks( 27 | int vpnInterfaceFileDescriptor, 28 | int vpnInterfaceMTU, 29 | String vpnIpAddress, 30 | String vpnNetMask, 31 | String socksServerAddress, 32 | String udpRelayAddress, 33 | String dnsResolverAddress, 34 | int transparentDNS); 35 | 36 | public static native int terminateTun2Socks(); 37 | 38 | public static void logTun2Socks(String level, String channel, String msg) { 39 | String logMsg = String.format("%s (%s): %s", level, channel, msg); 40 | Log.i("Tun2Socks", logMsg); 41 | } 42 | 43 | static { 44 | System.loadLibrary("tun2socks"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /android/java/org/uproxy/tun2socks/TunnelState.java: -------------------------------------------------------------------------------- 1 | package org.uproxy.tun2socks; 2 | 3 | // Singleton class to maintain state related to VPN Tunnel service. 4 | public class TunnelState { 5 | 6 | private static TunnelState m_tunnelState; 7 | 8 | public Object clone() throws CloneNotSupportedException { 9 | throw new CloneNotSupportedException(); 10 | } 11 | 12 | public static synchronized TunnelState getTunnelState() { 13 | if (m_tunnelState == null) { 14 | m_tunnelState = new TunnelState(); 15 | } 16 | return m_tunnelState; 17 | } 18 | 19 | private TunnelManager m_tunnelManager = null; 20 | private boolean m_startingTunnelManager = false; 21 | 22 | private TunnelState() {} 23 | 24 | public synchronized void setTunnelManager(TunnelManager tunnelManager) { 25 | m_tunnelManager = tunnelManager; 26 | m_startingTunnelManager = false; 27 | } 28 | 29 | public synchronized TunnelManager getTunnelManager() { 30 | return m_tunnelManager; 31 | } 32 | 33 | public synchronized void setStartingTunnelManager() { 34 | m_startingTunnelManager = true; 35 | } 36 | 37 | public synchronized boolean getStartingTunnelManager() { 38 | return m_startingTunnelManager; 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi-v7a 2 | APP_PLATFORM := android-23 3 | -------------------------------------------------------------------------------- /android/jni/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, Ambroz Bizjak 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the author nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /android/jni/arpprobe/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(arpprobe BArpProbe.c) 2 | target_link_libraries(arpprobe base system flow) 3 | -------------------------------------------------------------------------------- /android/jni/base/BLog_syslog.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BLog_syslog.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @section DESCRIPTION 30 | * 31 | * BLog syslog backend. 32 | */ 33 | 34 | #ifndef BADVPN_BLOG_SYSLOG_H 35 | #define BADVPN_BLOG_SYSLOG_H 36 | 37 | #include 38 | #include 39 | 40 | int BLog_InitSyslog (char *ident, char *facility) WARN_UNUSED; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /android/jni/base/BPending_list.h: -------------------------------------------------------------------------------- 1 | #define SLINKEDLIST_PARAM_NAME BPending__List 2 | #define SLINKEDLIST_PARAM_FEATURE_LAST 0 3 | #define SLINKEDLIST_PARAM_TYPE_ENTRY struct BSmallPending_s 4 | #define SLINKEDLIST_PARAM_MEMBER_NODE pending_node 5 | -------------------------------------------------------------------------------- /android/jni/base/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(BASE_ADDITIONAL_SOURCES) 2 | 3 | if (HAVE_SYSLOG_H) 4 | list(APPEND BASE_ADDITIONAL_SOURCES BLog_syslog.c) 5 | endif () 6 | 7 | set(BASE_SOURCES 8 | DebugObject.c 9 | BLog.c 10 | BPending.c 11 | ${BASE_ADDITIONAL_SOURCES} 12 | ) 13 | badvpn_add_library(base "" "" "${BASE_SOURCES}") 14 | -------------------------------------------------------------------------------- /android/jni/base/DebugObject.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file DebugObject.c 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include "DebugObject.h" 31 | 32 | #ifndef BADVPN_PLUGIN 33 | #ifndef NDEBUG 34 | DebugCounter debugobject_counter = DEBUGCOUNTER_STATIC; 35 | #if BADVPN_THREAD_SAFE 36 | pthread_mutex_t debugobject_mutex = PTHREAD_MUTEX_INITIALIZER; 37 | #endif 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /android/jni/blog_generator/blog_functions.php: -------------------------------------------------------------------------------- 1 | 0) { 7 | if (preg_match('/^\\/\\/.*/', $str, $matches)) { 8 | $str = substr($str, strlen($matches[0])); 9 | } 10 | else if (preg_match('/^\\s+/', $str, $matches)) { 11 | $str = substr($str, strlen($matches[0])); 12 | } 13 | else if (preg_match('/^[0-9]+/', $str, $matches)) { 14 | $out[] = array('number', $matches[0]); 15 | $str = substr($str, strlen($matches[0])); 16 | } 17 | else if (preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*/', $str, $matches)) { 18 | $out[] = array('name', $matches[0]); 19 | $str = substr($str, strlen($matches[0])); 20 | } 21 | else { 22 | return FALSE; 23 | } 24 | } 25 | 26 | return TRUE; 27 | } 28 | 29 | function fatal_error ($message) 30 | { 31 | fwrite(STDERR, "Fatal error: $message\n"); 32 | 33 | ob_get_clean(); 34 | exit(1); 35 | } 36 | -------------------------------------------------------------------------------- /android/jni/client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(badvpn-client 2 | client.c 3 | StreamPeerIO.c 4 | DatagramPeerIO.c 5 | PasswordListener.c 6 | DataProto.c 7 | FrameDecider.c 8 | DPRelay.c 9 | DPReceive.c 10 | FragmentProtoDisassembler.c 11 | FragmentProtoAssembler.c 12 | SPProtoEncoder.c 13 | SPProtoDecoder.c 14 | DataProtoKeepaliveSource.c 15 | PeerChat.c 16 | SCOutmsgEncoder.c 17 | SimpleStreamBuffer.c 18 | SinglePacketSource.c 19 | ) 20 | target_link_libraries(badvpn-client system flow flowextra tuntap server_conection security threadwork ${NSPR_LIBRARIES} ${NSS_LIBRARIES}) 21 | 22 | install( 23 | TARGETS badvpn-client 24 | RUNTIME DESTINATION bin 25 | ) 26 | 27 | install( 28 | FILES badvpn-client.8 29 | DESTINATION share/man/man8 30 | ) 31 | -------------------------------------------------------------------------------- /android/jni/client/FragmentProtoAssembler_tree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME FPAFramesTree 2 | #define SAVL_PARAM_FEATURE_COUNTS 0 3 | #define SAVL_PARAM_FEATURE_NOKEYS 0 4 | #define SAVL_PARAM_TYPE_ENTRY struct FragmentProtoAssembler_frame 5 | #define SAVL_PARAM_TYPE_KEY fragmentproto_frameid 6 | #define SAVL_PARAM_TYPE_ARG int 7 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) B_COMPARE((entry1)->id, (entry2)->id) 8 | #define SAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) B_COMPARE((key1), (entry2)->id) 9 | #define SAVL_PARAM_MEMBER_NODE tree_node 10 | -------------------------------------------------------------------------------- /android/jni/client/FrameDecider_groups_tree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME FDGroupsTree 2 | #define SAVL_PARAM_FEATURE_COUNTS 0 3 | #define SAVL_PARAM_FEATURE_NOKEYS 0 4 | #define SAVL_PARAM_TYPE_ENTRY struct _FrameDecider_group_entry 5 | #define SAVL_PARAM_TYPE_KEY uint32_t 6 | #define SAVL_PARAM_TYPE_ARG int 7 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) B_COMPARE((entry1)->group, (entry2)->group) 8 | #define SAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) B_COMPARE((key1), (entry2)->group) 9 | #define SAVL_PARAM_MEMBER_NODE tree_node 10 | -------------------------------------------------------------------------------- /android/jni/client/FrameDecider_macs_tree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME FDMacsTree 2 | #define SAVL_PARAM_FEATURE_COUNTS 0 3 | #define SAVL_PARAM_FEATURE_NOKEYS 0 4 | #define SAVL_PARAM_TYPE_ENTRY struct _FrameDecider_mac_entry 5 | #define SAVL_PARAM_TYPE_KEY FDMacsTree_key 6 | #define SAVL_PARAM_TYPE_ARG int 7 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) compare_macs((entry1)->mac, (entry2)->mac) 8 | #define SAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) compare_macs((key1), (entry2)->mac) 9 | #define SAVL_PARAM_MEMBER_NODE tree_node 10 | -------------------------------------------------------------------------------- /android/jni/client/FrameDecider_multicast_tree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME FDMulticastTree 2 | #define SAVL_PARAM_FEATURE_COUNTS 0 3 | #define SAVL_PARAM_FEATURE_NOKEYS 0 4 | #define SAVL_PARAM_TYPE_ENTRY struct _FrameDecider_group_entry 5 | #define SAVL_PARAM_TYPE_KEY uint32_t 6 | #define SAVL_PARAM_TYPE_ARG int 7 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) B_COMPARE((entry1)->master.sig, (entry2)->master.sig) 8 | #define SAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) B_COMPARE((key1), (entry2)->master.sig) 9 | #define SAVL_PARAM_MEMBER_NODE master.tree_node 10 | -------------------------------------------------------------------------------- /android/jni/cmake/modules/COPYING-CMAKE-SCRIPTS: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 5 | 1. Redistributions of source code must retain the copyright 6 | notice, this list of conditions and the following disclaimer. 7 | 2. Redistributions in binary form must reproduce the copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | 3. The name of the author may not be used to endorse or promote products 11 | derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /android/jni/cmake/modules/FindGLIB2.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the GLIB2 libraries 2 | # Once done this will define 3 | # 4 | # GLIB2_FOUND - system has glib2 5 | # GLIB2_INCLUDE_DIR - the glib2 include directory 6 | # GLIB2_LIBRARIES - glib2 library 7 | 8 | # Copyright (c) 2008 Laurent Montel, 9 | # 10 | # Redistribution and use is allowed according to the terms of the BSD license. 11 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 12 | 13 | 14 | if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) 15 | # Already in cache, be silent 16 | set(GLIB2_FIND_QUIETLY TRUE) 17 | endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) 18 | 19 | find_package(PkgConfig) 20 | pkg_check_modules(PC_LibGLIB2 QUIET glib-2.0) 21 | 22 | find_path(GLIB2_MAIN_INCLUDE_DIR 23 | NAMES glib.h 24 | HINTS ${PC_LibGLIB2_INCLUDEDIR} 25 | PATH_SUFFIXES glib-2.0) 26 | 27 | find_library(GLIB2_LIBRARY 28 | NAMES glib-2.0 29 | HINTS ${PC_LibGLIB2_LIBDIR} 30 | ) 31 | 32 | set(GLIB2_LIBRARIES ${GLIB2_LIBRARY}) 33 | 34 | # search the glibconfig.h include dir under the same root where the library is found 35 | get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH) 36 | 37 | find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h 38 | PATH_SUFFIXES glib-2.0/include 39 | HINTS ${PC_LibGLIB2_INCLUDEDIR} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) 40 | 41 | set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}") 42 | 43 | # not sure if this include dir is optional or required 44 | # for now it is optional 45 | if(GLIB2_INTERNAL_INCLUDE_DIR) 46 | set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}") 47 | endif(GLIB2_INTERNAL_INCLUDE_DIR) 48 | 49 | include(FindPackageHandleStandardArgs) 50 | find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR) 51 | 52 | mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES) 53 | -------------------------------------------------------------------------------- /android/jni/dhcpclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(dhcpclientcore 2 | BDHCPClientCore.c 3 | ) 4 | target_link_libraries(dhcpclientcore system flow flowextra badvpn_random) 5 | 6 | if (CMAKE_SYSTEM_NAME STREQUAL "Linux") 7 | add_library(dhcpclient 8 | BDHCPClient.c 9 | DHCPIpUdpEncoder.c 10 | DHCPIpUdpDecoder.c 11 | ) 12 | target_link_libraries(dhcpclient system flow dhcpclientcore) 13 | endif () 14 | -------------------------------------------------------------------------------- /android/jni/dostest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(dostest-server 2 | dostest-server.c 3 | StreamBuffer.c 4 | ) 5 | target_link_libraries(dostest-server base system) 6 | 7 | add_executable(dostest-attacker 8 | dostest-attacker.c 9 | ) 10 | target_link_libraries(dostest-attacker base system) 11 | -------------------------------------------------------------------------------- /android/jni/examples/cavl_test_tree.h: -------------------------------------------------------------------------------- 1 | #define CAVL_PARAM_NAME MyTree 2 | #define CAVL_PARAM_FEATURE_COUNTS USE_COUNTS 3 | #define CAVL_PARAM_FEATURE_KEYS_ARE_INDICES 0 4 | #define CAVL_PARAM_FEATURE_ASSOC USE_ASSOC 5 | #define CAVL_PARAM_TYPE_ENTRY struct entry 6 | #define CAVL_PARAM_TYPE_LINK entry_index 7 | #define CAVL_PARAM_TYPE_KEY entry_key 8 | #define CAVL_PARAM_TYPE_ARG entry_ptr 9 | #define CAVL_PARAM_TYPE_COUNT size_t 10 | #define CAVL_PARAM_TYPE_ASSOC assoc_sum 11 | #define CAVL_PARAM_VALUE_COUNT_MAX SIZE_MAX 12 | #define CAVL_PARAM_VALUE_NULL ((entry_index)-1) 13 | #define CAVL_PARAM_VALUE_ASSOC_ZERO 0 14 | #define CAVL_PARAM_FUN_DEREF(arg, link) (&(arg)[(link)]) 15 | #define CAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) B_COMPARE((entry1).ptr->key, (entry2).ptr->key) 16 | #define CAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) B_COMPARE((key1), (entry2).ptr->key) 17 | #define CAVL_PARAM_FUN_ASSOC_VALUE(arg, entry) ((entry).ptr->assoc_value) 18 | #define CAVL_PARAM_FUN_ASSOC_OPER(arg, value1, value2) ((value1) + (value2)) 19 | #define CAVL_PARAM_MEMBER_CHILD tree_child 20 | #define CAVL_PARAM_MEMBER_BALANCE tree_balance 21 | #define CAVL_PARAM_MEMBER_PARENT tree_parent 22 | #define CAVL_PARAM_MEMBER_COUNT tree_count 23 | #define CAVL_PARAM_MEMBER_ASSOC assoc_sum 24 | -------------------------------------------------------------------------------- /android/jni/examples/savl_test_tree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME MyTree 2 | #define SAVL_PARAM_FEATURE_COUNTS 1 3 | #define SAVL_PARAM_FEATURE_NOKEYS 1 4 | #define SAVL_PARAM_TYPE_ENTRY struct mynode 5 | #define SAVL_PARAM_TYPE_ARG int 6 | #define SAVL_PARAM_TYPE_COUNT int 7 | #define SAVL_PARAM_VALUE_COUNT_MAX INT_MAX 8 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) B_COMPARE((entry1)->num, (entry2)->num) 9 | #define SAVL_PARAM_MEMBER_NODE tree_node 10 | -------------------------------------------------------------------------------- /android/jni/fix_flex.php: -------------------------------------------------------------------------------- 1 | ", "#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L"); 7 | $replace = array("", "#if 1"); 8 | $contents = str_replace($search, $replace, $contents); 9 | $res = file_put_contents($filename, $contents); 10 | if ($res === FALSE) exit(1); 11 | -------------------------------------------------------------------------------- /android/jni/flooder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(badvpn-flooder flooder.c) 2 | target_link_libraries(badvpn-flooder system flow server_conection ${NSPR_LIBRARIES} ${NSS_LIBRARIES}) 3 | 4 | install( 5 | TARGETS badvpn-flooder 6 | RUNTIME DESTINATION bin 7 | ) 8 | -------------------------------------------------------------------------------- /android/jni/flooder/flooder.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file flooder.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | // name of the program 31 | #define PROGRAM_NAME "flooder" 32 | 33 | // server output buffer size 34 | #define SERVER_BUFFER_MIN_PACKETS 200 35 | 36 | // maximum number of peers to flood 37 | #define MAX_FLOODS 64 38 | -------------------------------------------------------------------------------- /android/jni/flow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(FLOW_SOURCES 2 | PacketPassFairQueue.c 3 | PacketPassPriorityQueue.c 4 | PacketPassConnector.c 5 | PacketRecvConnector.c 6 | StreamRecvConnector.c 7 | PacketRecvBlocker.c 8 | PacketPassNotifier.c 9 | PacketBuffer.c 10 | SinglePacketBuffer.c 11 | PacketCopier.c 12 | PacketStreamSender.c 13 | PacketProtoEncoder.c 14 | PacketProtoDecoder.c 15 | PacketProtoFlow.c 16 | SinglePacketSender.c 17 | BufferWriter.c 18 | PacketPassInterface.c 19 | PacketRecvInterface.c 20 | StreamPassInterface.c 21 | StreamRecvInterface.c 22 | RouteBuffer.c 23 | PacketRouter.c 24 | LineBuffer.c 25 | SingleStreamSender.c 26 | SingleStreamReceiver.c 27 | StreamPacketSender.c 28 | StreamPassConnector.c 29 | PacketPassFifoQueue.c 30 | ) 31 | badvpn_add_library(flow "base" "" "${FLOW_SOURCES}") 32 | -------------------------------------------------------------------------------- /android/jni/flow/PacketPassFairQueue_tree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME PacketPassFairQueue__Tree 2 | #define SAVL_PARAM_FEATURE_COUNTS 0 3 | #define SAVL_PARAM_FEATURE_NOKEYS 1 4 | #define SAVL_PARAM_TYPE_ENTRY struct PacketPassFairQueueFlow_s 5 | #define SAVL_PARAM_TYPE_ARG int 6 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) compare_flows((entry1), (entry2)) 7 | #define SAVL_PARAM_MEMBER_NODE queued.tree_node 8 | -------------------------------------------------------------------------------- /android/jni/flow/PacketPassPriorityQueue_tree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME PacketPassPriorityQueue__Tree 2 | #define SAVL_PARAM_FEATURE_COUNTS 0 3 | #define SAVL_PARAM_FEATURE_NOKEYS 1 4 | #define SAVL_PARAM_TYPE_ENTRY struct PacketPassPriorityQueueFlow_s 5 | #define SAVL_PARAM_TYPE_ARG int 6 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) compare_flows((entry1), (entry2)) 7 | #define SAVL_PARAM_MEMBER_NODE queued.tree_node 8 | -------------------------------------------------------------------------------- /android/jni/flowextra/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(flowextra 2 | PacketPassInactivityMonitor.c 3 | KeepaliveIO.c 4 | ) 5 | target_link_libraries(flowextra flow system) 6 | -------------------------------------------------------------------------------- /android/jni/generate_files: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | PHP_CMD=( php ) 6 | FLEX_CMD=( flex ) 7 | BISON_CMD=( bison ) 8 | 9 | OUT_DIR="generated/" 10 | 11 | function bproto() { 12 | local input="$1" 13 | local name="$2" 14 | "${PHP_CMD[@]}" bproto_generator/bproto.php --input-file "${input}" --output-dir "${OUT_DIR}" --name "bproto_${name}" 15 | } 16 | 17 | function do_flex() { 18 | local input="$1" 19 | local name="$2" 20 | "${FLEX_CMD[@]}" -o "${OUT_DIR}/flex_${name}.c" --header-file="${OUT_DIR}/flex_${name}.h" "${input}" 21 | "${PHP_CMD[@]}" fix_flex.php "${OUT_DIR}/flex_${name}.c" 22 | "${PHP_CMD[@]}" fix_flex.php "${OUT_DIR}/flex_${name}.h" 23 | } 24 | 25 | function do_bison() { 26 | local input="$1" 27 | local name="$2" 28 | "${BISON_CMD[@]}" -d -o "${OUT_DIR}/bison_${name}.c" "${input}" 29 | } 30 | 31 | function do_lemon() { 32 | local input="$1" 33 | local name=$(basename "${input}") 34 | ( 35 | cd generated && 36 | rm -f "${name}" && 37 | cp ../"${input}" "${name}" && 38 | ../lemon/lemon "${name}" 39 | ) 40 | } 41 | 42 | mkdir -p generated 43 | 44 | bproto tests/bproto_test.bproto bproto_test 45 | bproto protocol/msgproto.bproto msgproto 46 | bproto protocol/addr.bproto addr 47 | do_flex predicate/BPredicate.l BPredicate 48 | do_bison predicate/BPredicate.y BPredicate 49 | "${PHP_CMD[@]}" blog_generator/blog.php --input-file blog_channels.txt --output-dir "${OUT_DIR}" 50 | do_lemon ncd/NCDConfigParser_parse.y 51 | do_lemon ncd/NCDValParser_parse.y 52 | -------------------------------------------------------------------------------- /android/jni/generated/NCDConfigParser_parse.h: -------------------------------------------------------------------------------- 1 | #define INCLUDE 1 2 | #define STRING 2 3 | #define INCLUDE_GUARD 3 4 | #define NAME 4 5 | #define CURLY_OPEN 5 6 | #define CURLY_CLOSE 6 7 | #define ROUND_OPEN 7 8 | #define ROUND_CLOSE 8 9 | #define SEMICOLON 9 10 | #define ARROW 10 11 | #define IF 11 12 | #define FOREACH 12 13 | #define AS 13 14 | #define COLON 14 15 | #define ELIF 15 16 | #define ELSE 16 17 | #define DOT 17 18 | #define COMMA 18 19 | #define BRACKET_OPEN 19 20 | #define BRACKET_CLOSE 20 21 | #define PROCESS 21 22 | #define TEMPLATE 22 23 | -------------------------------------------------------------------------------- /android/jni/generated/NCDValParser_parse.h: -------------------------------------------------------------------------------- 1 | #define COMMA 1 2 | #define CURLY_OPEN 2 3 | #define CURLY_CLOSE 3 4 | #define COLON 4 5 | #define BRACKET_OPEN 5 6 | #define BRACKET_CLOSE 6 7 | #define STRING 7 8 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BArpProbe.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BArpProbe 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BConnection.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BConnection 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BDHCPClient.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BDHCPClient 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BDHCPClientCore.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BDHCPClientCore 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BDatagram.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BDatagram 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BEncryption.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BEncryption 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BInputProcess.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BInputProcess 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BLockReactor.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BLockReactor 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BNetwork.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BNetwork 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BPredicate.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BPredicate 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BProcess.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BProcess 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BReactor.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BReactor 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BSSLConnection.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BSSLConnection 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BSignal.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BSignal 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BSocksClient.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BSocksClient 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BTap.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BTap 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BThreadSignal.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BThreadSignal 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BThreadWork.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BThreadWork 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BTime.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BTime 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_BUnixSignal.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_BUnixSignal 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_DPReceive.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_DPReceive 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_DPRelay.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_DPRelay 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_DataProto.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_DataProto 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_DatagramPeerIO.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_DatagramPeerIO 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_FragmentProtoAssembler.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_FragmentProtoAssembler 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_FrameDecider.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_FrameDecider 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_LineBuffer.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_LineBuffer 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_Listener.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_Listener 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDBuildProgram.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDBuildProgram 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDConfigParser.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDConfigParser 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDConfigTokenizer.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDConfigTokenizer 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDIfConfig.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDIfConfig 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDInterfaceMonitor.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDInterfaceMonitor 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDModuleIndex.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDModuleIndex 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDModuleProcess.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDModuleProcess 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDPlaceholderDb.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDPlaceholderDb 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDRequest.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDRequest 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDRequestClient.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDRequestClient 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDRfkillMonitor.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDRfkillMonitor 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDUdevCache.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDUdevCache 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDUdevManager.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDUdevManager 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDUdevMonitor.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDUdevMonitor 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDUdevMonitorParser.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDUdevMonitorParser 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDVal.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDVal 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDValGenerator.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDValGenerator 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_NCDValParser.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_NCDValParser 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_PRStreamSink.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_PRStreamSink 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_PRStreamSource.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_PRStreamSource 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_PacketProtoDecoder.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_PacketProtoDecoder 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_PasswordListener.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_PasswordListener 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_PeerChat.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_PeerChat 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_SPProtoDecoder.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_SPProtoDecoder 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ServerConnection.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ServerConnection 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_SocksUdpGwClient.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_SocksUdpGwClient 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_StreamPeerIO.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_StreamPeerIO 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_UdpGwClient.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_UdpGwClient 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_addr.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_addr 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_client.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_client 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_dostest_attacker.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_dostest_attacker 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_dostest_server.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_dostest_server 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_flooder.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_flooder 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_lwip.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_lwip 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_alias.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_alias 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_arithmetic.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_arithmetic 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_assert.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_assert 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_backtrack.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_backtrack 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_blocker.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_blocker 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_buffer.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_buffer 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_call2.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_call2 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_choose.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_choose 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_concat.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_concat 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_daemon.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_daemon 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_depend.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_depend 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_depend_scope.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_depend_scope 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_dynamic_depend.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_dynamic_depend 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_exit.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_exit 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_explode.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_explode 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_file.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_file 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_file_open.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_file_open 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_foreach.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_foreach 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_from_string.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_from_string 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_getargs.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_getargs 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_getenv.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_getenv 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_if.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_if 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_imperative.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_imperative 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_implode.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_implode 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_index.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_index 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_list.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_list 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_load_module.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_load_module 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_log.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_log 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_log_msg.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_log_msg 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_logical.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_logical 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_multidepend.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_multidepend 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_backend_badvpn.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_backend_badvpn 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_backend_rfkill.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_backend_rfkill 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_backend_waitdevice.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_backend_waitdevice 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_backend_waitlink.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_backend_waitlink 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_backend_wpa_supplicant.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_backend_wpa_supplicant 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_dns.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_dns 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_iptables.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_iptables 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv4_addr.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv4_addr 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv4_addr_in_network.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv4_addr_in_network 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv4_arp_probe.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv4_arp_probe 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv4_dhcp.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv4_dhcp 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv4_route.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv4_route 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv6_addr.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv6_addr 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv6_addr_in_network.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv6_addr_in_network 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv6_route.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv6_route 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_ipv6_wait_dynamic_addr.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_ipv6_wait_dynamic_addr 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_up.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_up 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_net_watch_interfaces.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_net_watch_interfaces 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_netmask.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_netmask 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_ondemand.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_ondemand 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_parse.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_parse 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_print.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_print 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_process_manager.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_process_manager 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_reboot.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_reboot 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_ref.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_ref 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_regex_match.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_regex_match 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_request.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_request 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_run.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_run 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_runonce.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_runonce 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_sleep.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_sleep 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_socket.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_socket 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_spawn.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_spawn 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_strcmp.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_strcmp 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_substr.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_substr 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_sys_evdev.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_sys_evdev 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_sys_request_client.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_sys_request_client 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_sys_request_server.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_sys_request_server 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_sys_start_process.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_sys_start_process 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_sys_watch_directory.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_sys_watch_directory 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_sys_watch_input.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_sys_watch_input 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_sys_watch_usb.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_sys_watch_usb 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_timer.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_timer 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_to_string.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_to_string 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_try.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_try 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_value.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_value 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_valuemetic.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_valuemetic 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_ncd_var.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_ncd_var 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_nsskey.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_nsskey 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_server.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_server 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_tun2socks.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_tun2socks 5 | -------------------------------------------------------------------------------- /android/jni/generated/blog_channel_udpgw.h: -------------------------------------------------------------------------------- 1 | #ifdef BLOG_CURRENT_CHANNEL 2 | #undef BLOG_CURRENT_CHANNEL 3 | #endif 4 | #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_udpgw 5 | -------------------------------------------------------------------------------- /android/jni/lime/flex_token_stream.php: -------------------------------------------------------------------------------- 1 | executable(); 17 | $tokens = explode("\0", `$scanner < "\$PHP_LIME_SCAN_STDIN"`); 18 | array_pop($tokens); 19 | $this->tokens = $tokens; 20 | $this->lineno = 1; 21 | } 22 | function next() { 23 | if (list($key, $token) = each($this->tokens)) { 24 | list($this->lineno, $type, $text) = explode("\1", $token); 25 | return array($type, $text); 26 | } 27 | } 28 | function feed($parser) { 29 | while (list($type, $text) = $this->next()) { 30 | $parser->eat($type, $text); 31 | } 32 | return $parser->eat_eof(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /android/jni/lime/lime.bootstrap: -------------------------------------------------------------------------------- 1 | There is nothing to see here. Go and look at the file called "metagrammar". 2 | 3 | : $$ = new lime(); 4 | grammar pragma toklist stop : $$->pragma($2, $3); 5 | grammar rewrite stop : $2->update($$); 6 | to grammar 7 | : {$$=array();} 8 | toklist sym : $$[] = $2; 9 | toklist lit : $$[] = $2; 10 | to toklist 11 | sym '=' rhs : $$ = new lime_rewrite($1); $$->add_rhs($3); 12 | rewrite '|' rhs : $$->add_rhs($3); 13 | to rewrite 14 | list : $$ = new lime_rhs($1, ''); 15 | list action : $$ = new lime_rhs($1, $2); 16 | to rhs 17 | action : $$ = new lime_action($1, NULL); 18 | action lambda : $$ = new lime_action($1, $2); 19 | sym : $$ = new lime_glyph($1, NULL); 20 | sym lambda : $$ = new lime_glyph($1, $2); 21 | lit : $$ = new lime_glyph($1, NULL); 22 | to slot 23 | : $$ = new lime_rhs(); 24 | rhs slot : $$->add($2); 25 | to rhs 26 | '{' code '}' : $$ = $2; 27 | to action 28 | : 29 | code php : $$.=$2; 30 | code '{' code '}' : $$.='{'.$3.'}'; 31 | to code 32 | -------------------------------------------------------------------------------- /android/jni/lime/metagrammar: -------------------------------------------------------------------------------- 1 | # This program is free software; you can redistribute it and/or modify 2 | # it under the terms of the GNU General Public License as published by 3 | # the Free Software Foundation; either version 2 of the License, or 4 | # (at your option) any later version. 5 | # 6 | # This program is distributed in the hope that it will be useful, 7 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 | # GNU General Public License for more details. 10 | # 11 | # You should have received a copy of the GNU General Public License 12 | # along with this program; if not, write to the Free Software 13 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 14 | 15 | # This is the grammar for all other grammar files that will work with the 16 | # Lime LALR(1) Context-Free Grammar Parser Generator. 17 | # You can read this to get an idea how things work, but this file is not 18 | # actually used in the system. Rather, it's an implementation guide for the 19 | # file "lime.bootstrap". 20 | 21 | %class lime_metaparser 22 | %start grammar 23 | 24 | grammar 25 | = {$$ = new lime();} 26 | | grammar/$ pragma/p toklist/t stop {$$->pragma($p, $t);} 27 | | grammar/$ rewrite/r stop {$r->update($$);} 28 | . 29 | 30 | rewrite 31 | = sym/s '=' rhs/r {$$ = new lime_rewrite($s); $$->add_rhs($r);} 32 | | rewrite/$ '|' rhs/r {$$->add_rhs($r);} 33 | . 34 | 35 | slot 36 | = action/a {$$ = new lime_action($a, NULL);} 37 | | action/a lambda/l {$$ = new lime_action($a, $l);} 38 | | sym/s {$$ = new lime_glyph($s, NULL);} 39 | | sym/s lambda/l {$$ = new lime_glyph($s, $l);} 40 | | lit/l {$$ = new lime_glyph($l, NULL);} 41 | . 42 | 43 | rhs 44 | = {$$ = new lime_rhs();} 45 | | rhs/$ slot/s {$$->add($s);} 46 | . 47 | 48 | action = '{' code/$ '}' . 49 | 50 | toklist = {$$=array();} 51 | | toklist/$ sym/s {$$[] = $s;} 52 | | toklist/$ lit/l {$$[] = $l;} 53 | . 54 | 55 | code = {} 56 | | code/$ php/p {$$.=$p;} 57 | | code/$ '{' code/c '}' {$$.='{'.$c.'}';} 58 | . 59 | -------------------------------------------------------------------------------- /android/jni/lime/set.so.php: -------------------------------------------------------------------------------- 1 | data = array_count_values($list); } 11 | function has($item) { return isset($this->data[$item]); } 12 | function add($item) { $this->data[$item] = true; } 13 | function del($item) { unset($this->data[$item]); return $item;} 14 | function all() { return array_keys($this->data); } 15 | function one() { return key($this->data); } 16 | function count() { return count($this->data); } 17 | function pop() { return $this->del($this->one()); } 18 | function union($that) { 19 | $progress = false; 20 | foreach ($that->all() as $item) if (!$this->has($item)) { 21 | $this->add($item); 22 | $progress = true; 23 | } 24 | return $progress; 25 | } 26 | function text() { 27 | return ' { '.implode(' ', $this->all()).' } '; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /android/jni/lwip/CHANGELOG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UWNetworksLab/cordova-plugin-tun2socks/9b686fb3bad6792142425931799b8f7690a932eb/android/jni/lwip/CHANGELOG -------------------------------------------------------------------------------- /android/jni/lwip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(lwip 2 | src/core/timers.c 3 | src/core/udp.c 4 | src/core/memp.c 5 | src/core/init.c 6 | src/core/pbuf.c 7 | src/core/tcp.c 8 | src/core/tcp_out.c 9 | src/core/sys.c 10 | src/core/netif.c 11 | src/core/def.c 12 | src/core/mem.c 13 | src/core/tcp_in.c 14 | src/core/stats.c 15 | src/core/inet_chksum.c 16 | src/core/ipv4/icmp.c 17 | src/core/ipv4/ip4.c 18 | src/core/ipv4/ip4_addr.c 19 | src/core/ipv4/ip_frag.c 20 | src/core/ipv6/ip6.c 21 | src/core/ipv6/nd6.c 22 | src/core/ipv6/icmp6.c 23 | src/core/ipv6/ip6_addr.c 24 | src/core/ipv6/ip6_frag.c 25 | custom/sys.c 26 | ) 27 | -------------------------------------------------------------------------------- /android/jni/lwip/COPYING: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, 2002 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/jni/lwip/FILES: -------------------------------------------------------------------------------- 1 | src/ - The source code for the lwIP TCP/IP stack. 2 | doc/ - The documentation for lwIP. 3 | 4 | See also the FILES file in each subdirectory. 5 | -------------------------------------------------------------------------------- /android/jni/lwip/custom/arch/perf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file perf.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef LWIP_CUSTOM_PERF_H 31 | #define LWIP_CUSTOM_PERF_H 32 | 33 | #define PERF_START 34 | #define PERF_STOP(x) 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /android/jni/lwip/custom/sys.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sys.c 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | 32 | #include 33 | 34 | u32_t sys_now (void) 35 | { 36 | return btime_gettime(); 37 | } 38 | -------------------------------------------------------------------------------- /android/jni/lwip/doc/FILES: -------------------------------------------------------------------------------- 1 | savannah.txt - How to obtain the current development source code. 2 | contrib.txt - How to contribute to lwIP as a developer. 3 | rawapi.txt - The documentation for the core API of lwIP. 4 | Also provides an overview about the other APIs and multithreading. 5 | snmp_agent.txt - The documentation for the lwIP SNMP agent. 6 | sys_arch.txt - The documentation for a system abstraction layer of lwIP. 7 | -------------------------------------------------------------------------------- /android/jni/lwip/lwip-base-version: -------------------------------------------------------------------------------- 1 | 666e84eef281d0059377d0f5029c1c550488f829 2 | -------------------------------------------------------------------------------- /android/jni/lwip/src/FILES: -------------------------------------------------------------------------------- 1 | api/ - The code for the high-level wrapper API. Not needed if 2 | you use the lowel-level call-back/raw API. 3 | 4 | core/ - The core of the TPC/IP stack; protocol implementations, 5 | memory and buffer management, and the low-level raw API. 6 | 7 | include/ - lwIP include files. 8 | 9 | netif/ - Generic network interface device drivers are kept here, 10 | as well as the ARP module. 11 | 12 | For more information on the various subdirectories, check the FILES 13 | file in each directory. 14 | -------------------------------------------------------------------------------- /android/jni/lwip/src/core/ipv6/README: -------------------------------------------------------------------------------- 1 | IPv6 support in lwIP is very experimental. 2 | -------------------------------------------------------------------------------- /android/jni/lwip/src/core/ipv6/dhcp6.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * DHCPv6. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #include "lwip/opt.h" 43 | 44 | #if LWIP_IPV6_DHCP6 /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "lwip/ip6_addr.h" 47 | #include "lwip/def.h" 48 | 49 | 50 | #endif /* LWIP_IPV6_DHCP6 */ 51 | -------------------------------------------------------------------------------- /android/jni/lwip/src/core/ipv6/inet6.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * INET v6 addresses. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #include "lwip/opt.h" 43 | 44 | #if LWIP_IPV6 && LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "lwip/def.h" 47 | #include "lwip/inet6.h" 48 | 49 | /** @see ip6_addr.c for implementation of functions. */ 50 | 51 | #endif /* LWIP_IPV6 */ 52 | -------------------------------------------------------------------------------- /android/jni/lwip/src/include/posix/netdb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/netdb.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/netdb.h" 34 | -------------------------------------------------------------------------------- /android/jni/lwip/src/include/posix/sys/socket.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/sockets.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/sockets.h" 34 | -------------------------------------------------------------------------------- /android/jni/lwip/src/netif/FILES: -------------------------------------------------------------------------------- 1 | This directory contains generic network interface device drivers that 2 | do not contain any hardware or architecture specific code. The files 3 | are: 4 | 5 | etharp.c 6 | Implements the ARP (Address Resolution Protocol) over 7 | Ethernet. The code in this file should be used together with 8 | Ethernet device drivers. Note that this module has been 9 | largely made Ethernet independent so you should be able to 10 | adapt this for other link layers (such as Firewire). 11 | 12 | ethernetif.c 13 | An example of how an Ethernet device driver could look. This 14 | file can be used as a "skeleton" for developing new Ethernet 15 | network device drivers. It uses the etharp.c ARP code. 16 | 17 | loopif.c 18 | A "loopback" network interface driver. It requires configuration 19 | through the define LWIP_LOOPIF_MULTITHREADING (see opt.h). 20 | 21 | slipif.c 22 | A generic implementation of the SLIP (Serial Line IP) 23 | protocol. It requires a sio (serial I/O) module to work. 24 | 25 | ppp/ Point-to-Point Protocol stack 26 | The PPP stack has been ported from ucip (http://ucip.sourceforge.net). 27 | It matches quite well to pppd 2.3.1 (http://ppp.samba.org), although 28 | compared to that, it has some modifications for embedded systems and 29 | the source code has been reordered a bit. -------------------------------------------------------------------------------- /android/jni/lwip/src/netif/ppp/readme.txt: -------------------------------------------------------------------------------- 1 | About the PPP code: 2 | 3 | The PPP code is not our "own" code - we just copied it from pppd (http://ppp.samba.org/) and adapted it to lwIP. 4 | Unfortunately, not many here know their way around it too well. Back in 2009, we took the effort to see which 5 | version of pppd our code relates to and we're pretty much on 2.3.11 with some bugs from 2.4.x backported. 6 | 7 | Aside from simple code adaptions, there are some files that are different, however: 8 | - chpms.c/.h are named chap_ms.c/.h in the original pppd 2.3.11 sources 9 | - pap.c/.h are named upap.c/.h in the original pppd 2.3.11 sources 10 | - randm.c is a random generator not included in the original pppd 11 | - magic.c does not use the C library's random functions, but uses randm.c instead 12 | - vj.c/.h is an implementation of the Van Jacobson header compression algorithm adapted to lwIP pbufs, 13 | probably copied from one of the vjcompress.c files from pppd. 14 | - ppp.c, ppp.h and ppp_impl.h contain the adaption from pppd to lwIP. This is the "OS"-dependent part like there 15 | is an implementation for linux, xBSD etc. in the pppd sources. 16 | - ppp_oe.c is Marc Boucher's implementation based on NetBSD's if_pppoe.c 17 | 18 | There is of course potential for bugs in it, but when analyzing of reporting bugs, it is strongly encouraged to 19 | compare the code in question to pppd 2.3.11 (our basis) and newer versions (perhaps it's already fixed?) and to 20 | share this knowledge with us when reporting a bug. 21 | 22 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/core/test_mem.c: -------------------------------------------------------------------------------- 1 | #include "test_mem.h" 2 | 3 | #include "lwip/mem.h" 4 | #include "lwip/stats.h" 5 | 6 | #if !LWIP_STATS || !MEM_STATS 7 | #error "This tests needs MEM-statistics enabled" 8 | #endif 9 | #if LWIP_DNS 10 | #error "This test needs DNS turned off (as it mallocs on init)" 11 | #endif 12 | 13 | /* Setups/teardown functions */ 14 | 15 | static void 16 | mem_setup(void) 17 | { 18 | } 19 | 20 | static void 21 | mem_teardown(void) 22 | { 23 | } 24 | 25 | 26 | /* Test functions */ 27 | 28 | /** Call mem_malloc, mem_free and mem_trim and check stats */ 29 | START_TEST(test_mem_one) 30 | { 31 | #define SIZE1 16 32 | #define SIZE1_2 12 33 | #define SIZE2 16 34 | void *p1, *p2; 35 | mem_size_t s1, s2; 36 | LWIP_UNUSED_ARG(_i); 37 | 38 | #if LWIP_DNS 39 | fail("This test needs DNS turned off (as it mallocs on init)"); 40 | #endif 41 | 42 | fail_unless(lwip_stats.mem.used == 0); 43 | 44 | p1 = mem_malloc(SIZE1); 45 | fail_unless(p1 != NULL); 46 | fail_unless(lwip_stats.mem.used >= SIZE1); 47 | s1 = lwip_stats.mem.used; 48 | 49 | p2 = mem_malloc(SIZE2); 50 | fail_unless(p2 != NULL); 51 | fail_unless(lwip_stats.mem.used >= SIZE2 + s1); 52 | s2 = lwip_stats.mem.used; 53 | 54 | mem_trim(p1, SIZE1_2); 55 | 56 | mem_free(p2); 57 | fail_unless(lwip_stats.mem.used <= s2 - SIZE2); 58 | 59 | mem_free(p1); 60 | fail_unless(lwip_stats.mem.used == 0); 61 | } 62 | END_TEST 63 | 64 | 65 | /** Create the suite including all tests for this module */ 66 | Suite * 67 | mem_suite(void) 68 | { 69 | TFun tests[] = { 70 | test_mem_one 71 | }; 72 | return create_suite("MEM", tests, sizeof(tests)/sizeof(TFun), mem_setup, mem_teardown); 73 | } 74 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/core/test_mem.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_MEM_H__ 2 | #define __TEST_MEM_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *mem_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/core/test_pbuf.c: -------------------------------------------------------------------------------- 1 | #include "test_pbuf.h" 2 | 3 | #include "lwip/pbuf.h" 4 | #include "lwip/stats.h" 5 | 6 | #if !LWIP_STATS || !MEM_STATS ||!MEMP_STATS 7 | #error "This tests needs MEM- and MEMP-statistics enabled" 8 | #endif 9 | #if LWIP_DNS 10 | #error "This test needs DNS turned off (as it mallocs on init)" 11 | #endif 12 | 13 | /* Setups/teardown functions */ 14 | 15 | static void 16 | pbuf_setup(void) 17 | { 18 | } 19 | 20 | static void 21 | pbuf_teardown(void) 22 | { 23 | } 24 | 25 | 26 | /* Test functions */ 27 | 28 | /** Call pbuf_copy on a pbuf with zero length */ 29 | START_TEST(test_pbuf_copy_zero_pbuf) 30 | { 31 | struct pbuf *p1, *p2, *p3; 32 | err_t err; 33 | LWIP_UNUSED_ARG(_i); 34 | 35 | fail_unless(lwip_stats.mem.used == 0); 36 | fail_unless(lwip_stats.memp[MEMP_PBUF_POOL].used == 0); 37 | 38 | p1 = pbuf_alloc(PBUF_RAW, 1024, PBUF_RAM); 39 | fail_unless(p1 != NULL); 40 | fail_unless(p1->ref == 1); 41 | 42 | p2 = pbuf_alloc(PBUF_RAW, 2, PBUF_POOL); 43 | fail_unless(p2 != NULL); 44 | fail_unless(p2->ref == 1); 45 | p2->len = p2->tot_len = 0; 46 | 47 | pbuf_cat(p1, p2); 48 | fail_unless(p1->ref == 1); 49 | fail_unless(p2->ref == 1); 50 | 51 | p3 = pbuf_alloc(PBUF_RAW, p1->tot_len, PBUF_POOL); 52 | err = pbuf_copy(p3, p1); 53 | fail_unless(err == ERR_VAL); 54 | 55 | pbuf_free(p1); 56 | pbuf_free(p3); 57 | fail_unless(lwip_stats.mem.used == 0); 58 | 59 | fail_unless(lwip_stats.mem.used == 0); 60 | fail_unless(lwip_stats.memp[MEMP_PBUF_POOL].used == 0); 61 | } 62 | END_TEST 63 | 64 | 65 | /** Create the suite including all tests for this module */ 66 | Suite * 67 | pbuf_suite(void) 68 | { 69 | TFun tests[] = { 70 | test_pbuf_copy_zero_pbuf 71 | }; 72 | return create_suite("PBUF", tests, sizeof(tests)/sizeof(TFun), pbuf_setup, pbuf_teardown); 73 | } 74 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/core/test_pbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_PBUF_H__ 2 | #define __TEST_PBUF_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *pbuf_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/dhcp/test_dhcp.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_DHCP_H__ 2 | #define __TEST_DHCP_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* dhcp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/etharp/test_etharp.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_ETHARP_H__ 2 | #define __TEST_ETHARP_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* etharp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/lwip_check.h: -------------------------------------------------------------------------------- 1 | #ifndef __LWIP_CHECK_H__ 2 | #define __LWIP_CHECK_H__ 3 | 4 | /* Common header file for lwIP unit tests using the check framework */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #define FAIL_RET() do { fail(); return; } while(0) 11 | #define EXPECT(x) fail_unless(x) 12 | #define EXPECT_RET(x) do { fail_unless(x); if(!(x)) { return; }} while(0) 13 | #define EXPECT_RETX(x, y) do { fail_unless(x); if(!(x)) { return y; }} while(0) 14 | #define EXPECT_RETNULL(x) EXPECT_RETX(x, NULL) 15 | 16 | /** typedef for a function returning a test suite */ 17 | typedef Suite* (suite_getter_fn)(void); 18 | 19 | /** Create a test suite */ 20 | static Suite* create_suite(const char* name, TFun *tests, size_t num_tests, SFun setup, SFun teardown) 21 | { 22 | size_t i; 23 | Suite *s = suite_create(name); 24 | 25 | for(i = 0; i < num_tests; i++) { 26 | /* Core test case */ 27 | TCase *tc_core = tcase_create("Core"); 28 | if ((setup != NULL) || (teardown != NULL)) { 29 | tcase_add_checked_fixture(tc_core, setup, teardown); 30 | } 31 | tcase_add_test(tc_core, tests[i]); 32 | suite_add_tcase(s, tc_core); 33 | } 34 | return s; 35 | } 36 | 37 | #endif /* __LWIP_CHECK_H__ */ 38 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/lwip_unittests.c: -------------------------------------------------------------------------------- 1 | #include "lwip_check.h" 2 | 3 | #include "udp/test_udp.h" 4 | #include "tcp/test_tcp.h" 5 | #include "tcp/test_tcp_oos.h" 6 | #include "core/test_mem.h" 7 | #include "core/test_pbuf.h" 8 | #include "etharp/test_etharp.h" 9 | #include "dhcp/test_dhcp.h" 10 | 11 | #include "lwip/init.h" 12 | 13 | 14 | int main() 15 | { 16 | int number_failed; 17 | SRunner *sr; 18 | size_t i; 19 | suite_getter_fn* suites[] = { 20 | udp_suite, 21 | tcp_suite, 22 | tcp_oos_suite, 23 | mem_suite, 24 | pbuf_suite, 25 | etharp_suite, 26 | dhcp_suite 27 | }; 28 | size_t num = sizeof(suites)/sizeof(void*); 29 | LWIP_ASSERT("No suites defined", num > 0); 30 | 31 | lwip_init(); 32 | 33 | sr = srunner_create((suites[0])()); 34 | for(i = 1; i < num; i++) { 35 | srunner_add_suite(sr, ((suite_getter_fn*)suites[i])()); 36 | } 37 | 38 | #ifdef LWIP_UNITTESTS_NOFORK 39 | srunner_set_fork_status(sr, CK_NOFORK); 40 | #endif 41 | #ifdef LWIP_UNITTESTS_FORK 42 | srunner_set_fork_status(sr, CK_FORK); 43 | #endif 44 | 45 | srunner_run_all(sr, CK_NORMAL); 46 | number_failed = srunner_ntests_failed(sr); 47 | srunner_free(sr); 48 | return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; 49 | } 50 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/tcp/tcp_helper.h: -------------------------------------------------------------------------------- 1 | #ifndef __TCP_HELPER_H__ 2 | #define __TCP_HELPER_H__ 3 | 4 | #include "../lwip_check.h" 5 | #include "lwip/arch.h" 6 | #include "lwip/tcp.h" 7 | #include "lwip/netif.h" 8 | 9 | /* counters used for test_tcp_counters_* callback functions */ 10 | struct test_tcp_counters { 11 | u32_t recv_calls; 12 | u32_t recved_bytes; 13 | u32_t recv_calls_after_close; 14 | u32_t recved_bytes_after_close; 15 | u32_t close_calls; 16 | u32_t err_calls; 17 | err_t last_err; 18 | char* expected_data; 19 | u32_t expected_data_len; 20 | }; 21 | 22 | struct test_tcp_txcounters { 23 | u32_t num_tx_calls; 24 | u32_t num_tx_bytes; 25 | u8_t copy_tx_packets; 26 | struct pbuf *tx_packets; 27 | }; 28 | 29 | /* Helper functions */ 30 | void tcp_remove_all(void); 31 | 32 | struct pbuf* tcp_create_segment(ip_addr_t* src_ip, ip_addr_t* dst_ip, 33 | u16_t src_port, u16_t dst_port, void* data, size_t data_len, 34 | u32_t seqno, u32_t ackno, u8_t headerflags); 35 | struct pbuf* tcp_create_rx_segment(struct tcp_pcb* pcb, void* data, size_t data_len, 36 | u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags); 37 | struct pbuf* tcp_create_rx_segment_wnd(struct tcp_pcb* pcb, void* data, size_t data_len, 38 | u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags, u16_t wnd); 39 | void tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, ip_addr_t* local_ip, 40 | ip_addr_t* remote_ip, u16_t local_port, u16_t remote_port); 41 | void test_tcp_counters_err(void* arg, err_t err); 42 | err_t test_tcp_counters_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err); 43 | 44 | struct tcp_pcb* test_tcp_new_counters_pcb(struct test_tcp_counters* counters); 45 | 46 | void test_tcp_input(struct pbuf *p, struct netif *inp); 47 | 48 | void test_tcp_init_netif(struct netif *netif, struct test_tcp_txcounters *txcounters, 49 | ip_addr_t *ip_addr, ip_addr_t *netmask); 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/tcp/test_tcp.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_TCP_H__ 2 | #define __TEST_TCP_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *tcp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/tcp/test_tcp_oos.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_TCP_OOS_H__ 2 | #define __TEST_TCP_OOS_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *tcp_oos_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/udp/test_udp.c: -------------------------------------------------------------------------------- 1 | #include "test_udp.h" 2 | 3 | #include "lwip/udp.h" 4 | #include "lwip/stats.h" 5 | 6 | #if !LWIP_STATS || !UDP_STATS || !MEMP_STATS 7 | #error "This tests needs UDP- and MEMP-statistics enabled" 8 | #endif 9 | 10 | /* Helper functions */ 11 | static void 12 | udp_remove_all(void) 13 | { 14 | struct udp_pcb *pcb = udp_pcbs; 15 | struct udp_pcb *pcb2; 16 | 17 | while(pcb != NULL) { 18 | pcb2 = pcb; 19 | pcb = pcb->next; 20 | udp_remove(pcb2); 21 | } 22 | fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0); 23 | } 24 | 25 | /* Setups/teardown functions */ 26 | 27 | static void 28 | udp_setup(void) 29 | { 30 | udp_remove_all(); 31 | } 32 | 33 | static void 34 | udp_teardown(void) 35 | { 36 | udp_remove_all(); 37 | } 38 | 39 | 40 | /* Test functions */ 41 | 42 | START_TEST(test_udp_new_remove) 43 | { 44 | struct udp_pcb* pcb; 45 | LWIP_UNUSED_ARG(_i); 46 | 47 | fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0); 48 | 49 | pcb = udp_new(); 50 | fail_unless(pcb != NULL); 51 | if (pcb != NULL) { 52 | fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 1); 53 | udp_remove(pcb); 54 | fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0); 55 | } 56 | } 57 | END_TEST 58 | 59 | 60 | /** Create the suite including all tests for this module */ 61 | Suite * 62 | udp_suite(void) 63 | { 64 | TFun tests[] = { 65 | test_udp_new_remove, 66 | }; 67 | return create_suite("UDP", tests, sizeof(tests)/sizeof(TFun), udp_setup, udp_teardown); 68 | } 69 | -------------------------------------------------------------------------------- /android/jni/lwip/test/unit/udp/test_udp.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEST_UDP_H__ 2 | #define __TEST_UDP_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* udp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /android/jni/misc/array_length.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file array_length.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_ARRAY_LENGTH 31 | #define BADVPN_ARRAY_LENGTH 32 | 33 | #define B_ARRAY_LENGTH(arr) (sizeof((arr)) / sizeof((arr)[0])) 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /android/jni/misc/compare.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file compare.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_COMPARE_H 31 | #define BADVPN_COMPARE_H 32 | 33 | #define B_COMPARE(a, b) (((a) > (b)) - ((a) < (b))) 34 | #define B_COMPARE_COMBINE(cmp1, cmp2) ((cmp1) ? (cmp1) : (cmp2)) 35 | #define B_COMPARE2(a, b, c, d) B_COMPARE_COMBINE(B_COMPARE((a), (b)), B_COMPARE((c), (d))) 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /android/jni/misc/ethernet_proto.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ethernet_proto.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @section DESCRIPTION 30 | * 31 | * Definitions for the Ethernet protocol. 32 | */ 33 | 34 | #ifndef BADVPN_MISC_ETHERNET_PROTO_H 35 | #define BADVPN_MISC_ETHERNET_PROTO_H 36 | 37 | #include 38 | 39 | #include 40 | 41 | #define ETHERTYPE_IPV4 0x0800 42 | #define ETHERTYPE_ARP 0x0806 43 | 44 | B_START_PACKED 45 | struct ethernet_header { 46 | uint8_t dest[6]; 47 | uint8_t source[6]; 48 | uint16_t type; 49 | } B_PACKED; 50 | B_END_PACKED 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /android/jni/misc/loggers_string.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file loggers_string.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @section DESCRIPTION 30 | * 31 | * List of available loggers. 32 | */ 33 | 34 | #ifndef BADVPN_MISC_LOGGERSSTRING_H 35 | #define BADVPN_MISC_LOGGERSSTRING_H 36 | 37 | #ifdef BADVPN_USE_WINAPI 38 | #define LOGGERS_STRING "stdout" 39 | #else 40 | #define LOGGERS_STRING "stdout/syslog" 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /android/jni/misc/maxalign.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file maxalign.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_MAXALIGN_H 31 | #define BADVPN_MAXALIGN_H 32 | 33 | #include 34 | #include 35 | 36 | typedef union { 37 | short a; 38 | long b; 39 | long long c; 40 | double d; 41 | long double e; 42 | void *f; 43 | uint8_t g; 44 | uint16_t h; 45 | uint32_t i; 46 | uint64_t j; 47 | size_t k; 48 | void (*l) (void); 49 | } bmax_align_t; 50 | 51 | #define BMAX_ALIGN (__alignof(bmax_align_t)) 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /android/jni/misc/merge.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file merge.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_MERGE_H 31 | #define BADVPN_MERGE_H 32 | 33 | #define MERGE_HELPER(x, y) x ## y 34 | #define MERGE(x, y) MERGE_HELPER(x, y) 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /android/jni/misc/nonblocking.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file nonblocking.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @section DESCRIPTION 30 | * 31 | * Function for enabling non-blocking mode for a file descriptor. 32 | */ 33 | 34 | #ifndef BADVPN_MISC_NONBLOCKING_H 35 | #define BADVPN_MISC_NONBLOCKING_H 36 | 37 | #include 38 | #include 39 | 40 | static int badvpn_set_nonblocking (int fd); 41 | 42 | int badvpn_set_nonblocking (int fd) 43 | { 44 | if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { 45 | return 0; 46 | } 47 | 48 | return 1; 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /android/jni/misc/packed.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file packed.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @section DESCRIPTION 30 | * 31 | * Structure packing macros. 32 | */ 33 | 34 | #ifndef BADVPN_PACKED_H 35 | #define BADVPN_PACKED_H 36 | 37 | #ifdef _MSC_VER 38 | 39 | #define B_START_PACKED __pragma(pack(push, 1)) 40 | #define B_END_PACKED __pragma(pack(pop)) 41 | #define B_PACKED 42 | 43 | #else 44 | 45 | #define B_START_PACKED 46 | #define B_END_PACKED 47 | #define B_PACKED __attribute__((packed)) 48 | 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /android/jni/misc/sslsocket.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sslsocket.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @section DESCRIPTION 30 | * 31 | * Structure for moving around sockets, possibly together with SSL compoments. 32 | */ 33 | 34 | #ifndef BADVPN_MISC_SSLSOCKET_H 35 | #define BADVPN_MISC_SSLSOCKET_H 36 | 37 | #include 38 | 39 | #include 40 | #include 41 | 42 | typedef struct { 43 | BConnection con; 44 | PRFileDesc bottom_prfd; 45 | PRFileDesc *ssl_prfd; 46 | } sslsocket; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /android/jni/misc/version.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file version.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @section DESCRIPTION 30 | * 31 | * Product information definitions. 32 | */ 33 | 34 | #ifndef BADVPN_MISC_VERSION_H 35 | #define BADVPN_MISC_VERSION_H 36 | 37 | #define GLOBAL_PRODUCT_NAME "BadVPN" 38 | #define GLOBAL_VERSION "1.999.128" 39 | #define GLOBAL_COPYRIGHT_NOTICE "Copyright (C) 2010 Ambroz Bizjak " 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /android/jni/ncd-request/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(badvpn-ncd-request 2 | ncd-request.c 3 | ) 4 | target_link_libraries(badvpn-ncd-request ncdrequest ncdvalgenerator ncdvalparser) 5 | 6 | install( 7 | TARGETS badvpn-ncd-request 8 | RUNTIME DESTINATION bin 9 | ) 10 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDConfigParser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NCDConfigParser.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_NCDCONFIG_NCDCONFIGPARSER_H 31 | #define BADVPN_NCDCONFIG_NCDCONFIGPARSER_H 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | int NCDConfigParser_Parse (char *config, size_t config_len, NCDProgram *out_ast) WARN_UNUSED; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDInterpProg_hash.h: -------------------------------------------------------------------------------- 1 | #define CHASH_PARAM_NAME NCDInterpProg__Hash 2 | #define CHASH_PARAM_ENTRY NCDInterpProg__hashentry 3 | #define CHASH_PARAM_LINK int 4 | #define CHASH_PARAM_KEY NCD_string_id_t 5 | #define CHASH_PARAM_ARG NCDInterpProg__hasharg 6 | #define CHASH_PARAM_NULL ((int)-1) 7 | #define CHASH_PARAM_DEREF(arg, link) (&(arg)[(link)]) 8 | #define CHASH_PARAM_ENTRYHASH(arg, entry) ((size_t)(entry).ptr->name) 9 | #define CHASH_PARAM_KEYHASH(arg, key) ((size_t)(key)) 10 | #define CHASH_PARAM_COMPARE_ENTRIES(arg, entry1, entry2) ((entry1).ptr->name == (entry2).ptr->name) 11 | #define CHASH_PARAM_COMPARE_KEY_ENTRY(arg, key1, entry2) ((key1) == (entry2).ptr->name) 12 | #define CHASH_PARAM_ENTRY_NEXT hash_next 13 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDMethodIndex_hash.h: -------------------------------------------------------------------------------- 1 | #define CHASH_PARAM_NAME NCDMethodIndex__Hash 2 | #define CHASH_PARAM_ENTRY NCDMethodIndex__hashentry 3 | #define CHASH_PARAM_LINK int 4 | #define CHASH_PARAM_KEY NCDMethodIndex__hashkey 5 | #define CHASH_PARAM_ARG NCDMethodIndex__hasharg 6 | #define CHASH_PARAM_NULL ((int)-1) 7 | #define CHASH_PARAM_DEREF(arg, link) (&(arg)[(link)]) 8 | #define CHASH_PARAM_ENTRYHASH(arg, entry) (badvpn_djb2_hash((const uint8_t *)(entry).ptr->method_name)) 9 | #define CHASH_PARAM_KEYHASH(arg, key) (badvpn_djb2_hash((const uint8_t *)(key))) 10 | #define CHASH_PARAM_COMPARE_ENTRIES(arg, entry1, entry2) (!strcmp((entry1).ptr->method_name, (entry2).ptr->method_name)) 11 | #define CHASH_PARAM_COMPARE_KEY_ENTRY(arg, key1, entry2) (!strcmp((key1), (entry2).ptr->method_name)) 12 | #define CHASH_PARAM_ENTRY_NEXT hash_next 13 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDModuleIndex_mhash.h: -------------------------------------------------------------------------------- 1 | #define CHASH_PARAM_NAME NCDModuleIndex__MHash 2 | #define CHASH_PARAM_ENTRY struct NCDModuleIndex_module 3 | #define CHASH_PARAM_LINK NCDModuleIndex__mhash_link 4 | #define CHASH_PARAM_KEY NCDModuleIndex__mhash_key 5 | #define CHASH_PARAM_ARG int 6 | #define CHASH_PARAM_NULL ((NCDModuleIndex__mhash_link)NULL) 7 | #define CHASH_PARAM_DEREF(arg, link) (link) 8 | #define CHASH_PARAM_ENTRYHASH(arg, entry) (badvpn_djb2_hash((const uint8_t *)(entry).ptr->imodule.module.type)) 9 | #define CHASH_PARAM_KEYHASH(arg, key) (badvpn_djb2_hash((const uint8_t *)(key))) 10 | #define CHASH_PARAM_COMPARE_ENTRIES(arg, entry1, entry2) (!strcmp((entry1).ptr->imodule.module.type, (entry2).ptr->imodule.module.type)) 11 | #define CHASH_PARAM_COMPARE_KEY_ENTRY(arg, key1, entry2) (!strcmp((key1), (entry2).ptr->imodule.module.type)) 12 | #define CHASH_PARAM_ENTRY_NEXT hash_next 13 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDObject.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NCDObject.c 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include "NCDObject.h" 31 | 32 | int NCDObject_no_getvar (const NCDObject *obj, NCD_string_id_t name, NCDValMem *mem, NCDValRef *out_value) 33 | { 34 | return 0; 35 | } 36 | 37 | int NCDObject_no_getobj (const NCDObject *obj, NCD_string_id_t name, NCDObject *out_object) 38 | { 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDStringIndex_hash.h: -------------------------------------------------------------------------------- 1 | #define CHASH_PARAM_NAME NCDStringIndex__Hash 2 | #define CHASH_PARAM_ENTRY struct NCDStringIndex__entry 3 | #define CHASH_PARAM_LINK NCD_string_id_t 4 | #define CHASH_PARAM_KEY NCDStringIndex_hash_key 5 | #define CHASH_PARAM_ARG NCDStringIndex_hash_arg 6 | #define CHASH_PARAM_NULL ((NCD_string_id_t)-1) 7 | #define CHASH_PARAM_DEREF(arg, link) (&(arg)[(link)]) 8 | #define CHASH_PARAM_ENTRYHASH(arg, entry) badvpn_djb2_hash_bin((const uint8_t *)(entry).ptr->str, (entry).ptr->str_len) 9 | #define CHASH_PARAM_KEYHASH(arg, key) badvpn_djb2_hash_bin((const uint8_t *)(key).str, (key).len) 10 | #define CHASH_PARAM_ENTRYHASH_IS_CHEAP 0 11 | #define CHASH_PARAM_COMPARE_ENTRIES(arg, entry1, entry2) ((entry1).ptr->str_len == (entry2).ptr->str_len && !memcmp((entry1).ptr->str, (entry2).ptr->str, (entry1).ptr->str_len)) 12 | #define CHASH_PARAM_COMPARE_KEY_ENTRY(arg, key1, entry2) ((key1).len == (entry2).ptr->str_len && !memcmp((key1).str, (entry2).ptr->str, (key1).len)) 13 | #define CHASH_PARAM_ENTRY_NEXT hash_next 14 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDSugar.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NCDSugar.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_NCDSUGAR_H 31 | #define BADVPN_NCDSUGAR_H 32 | 33 | #include 34 | #include 35 | 36 | int NCDSugar_Desugar (NCDProgram *prog) WARN_UNUSED; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDValGenerator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NCDValGenerator.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_NCDVALUEGENERATOR_H 31 | #define BADVPN_NCDVALUEGENERATOR_H 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | char * NCDValGenerator_Generate (NCDValRef value); 38 | int NCDValGenerator_AppendGenerate (NCDValRef value, ExpString *str) WARN_UNUSED; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /android/jni/ncd/NCDVal_maptree.h: -------------------------------------------------------------------------------- 1 | #define CAVL_PARAM_NAME NCDVal__MapTree 2 | #define CAVL_PARAM_FEATURE_COUNTS 0 3 | #define CAVL_PARAM_FEATURE_KEYS_ARE_INDICES 0 4 | #define CAVL_PARAM_FEATURE_NOKEYS 0 5 | #define CAVL_PARAM_TYPE_ENTRY NCDVal__maptree_entry 6 | #define CAVL_PARAM_TYPE_LINK NCDVal__idx 7 | #define CAVL_PARAM_TYPE_KEY NCDValRef 8 | #define CAVL_PARAM_TYPE_ARG NCDVal__maptree_arg 9 | #define CAVL_PARAM_VALUE_NULL ((NCDVal__idx)-1) 10 | #define CAVL_PARAM_FUN_DEREF(arg, link) ((struct NCDVal__mapelem *)NCDValMem__BufAt((arg), (link))) 11 | #define CAVL_PARAM_FUN_COMPARE_ENTRIES(arg, node1, node2) NCDVal_Compare(NCDVal__Ref((arg), (node1).ptr->key_idx), NCDVal__Ref((arg), (node2).ptr->key_idx)) 12 | #define CAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, node2) NCDVal_Compare((key1), NCDVal__Ref((arg), (node2).ptr->key_idx)) 13 | #define CAVL_PARAM_MEMBER_CHILD tree_child 14 | #define CAVL_PARAM_MEMBER_BALANCE tree_balance 15 | #define CAVL_PARAM_MEMBER_PARENT tree_parent 16 | -------------------------------------------------------------------------------- /android/jni/ncd/examples/dhcpd.conf.template: -------------------------------------------------------------------------------- 1 | default-lease-time 600; 2 | max-lease-time 7200; 3 | log-facility local7; 4 | ddns-update-style none; 5 | local-address ; 6 | 7 | subnet netmask { 8 | range ; 9 | option routers ; 10 | option domain-name-servers ; 11 | } 12 | -------------------------------------------------------------------------------- /android/jni/ncd/examples/igmpproxy.conf.template: -------------------------------------------------------------------------------- 1 | quickleave 2 | 3 | phyint upstream ratelimit 0 threshold 1 4 | altnet 89.143.8.0/24 5 | altnet 95.176.0.0/16 6 | 7 | phyint downstream ratelimit 0 threshold 1 8 | 9 | # A lot of these will be appended by make_igmpproxy_config: 10 | # phyint eth0 disabled 11 | -------------------------------------------------------------------------------- /android/jni/ncd/examples/make_dhcp_config.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | call("make_dhcp_config", {"192.168.1.1", "24", "192.168.1.100", "192.168.1.199", {"192.168.1.1"}, {"192.168.1.1", "4.4.4.4"}, "dhcpd.conf.template", "dhcpd.conf"}) config; 3 | exit("0"); 4 | } 5 | 6 | template make_dhcp_config { 7 | alias("_arg0") addr; 8 | alias("_arg1") prefix; 9 | alias("_arg2") range_start; 10 | alias("_arg3") range_end; 11 | alias("_arg4") routers; 12 | alias("_arg5") dns_servers; 13 | alias("_arg6") template_file; 14 | alias("_arg7") output_file; 15 | 16 | ipv4_net_from_addr_and_prefix(addr, prefix) network; 17 | ipv4_prefix_to_mask(prefix) netmask; 18 | implode(", ", routers) routers_str; 19 | implode(", ", dns_servers) dns_servers_str; 20 | 21 | var({"", "", "", "", "", "", ""}) regex; 22 | var({addr, network, netmask, range_start, range_end, routers_str, dns_servers_str}) replace; 23 | 24 | file_read(template_file) template_data; 25 | regex_replace(template_data, regex, replace) replaced_data; 26 | file_write(output_file, replaced_data); 27 | } 28 | -------------------------------------------------------------------------------- /android/jni/ncd/examples/make_igmpproxy_config.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | call("make_igmpproxy_config", {"br0", "eth1", "./igmpproxy.conf.template", "./igmpproxy.conf"}); 3 | 4 | println("Done."); 5 | exit("0"); 6 | } 7 | 8 | template make_igmpproxy_config { 9 | alias("_arg0") upstream_iface; 10 | alias("_arg1") downstream_iface; 11 | alias("_arg2") template_file; 12 | alias("_arg3") output_file; 13 | 14 | # Make a list of interfaces to add as disabled (upstream and downstream will not be disabled). 15 | var({ 16 | "eth0", "eth1", "eth2", "eth3", "eth4", "eth5", "eth6", "eth7", "eth8", "eth9", 17 | "wlan0", "wlan1", "wlan2", "wlan3", "wlan4", "wlan5", "wlan6", "wlan7", "wlan8", "wlan9", 18 | "tap0", "tap1", "tap2", "tap3", "tap4", "tap5", "tap6", "tap7", "tap8", "tap9", 19 | "br0", "br1", "br2", "br3", "br4", "br5", "br6", "br7", "br8", "br9" 20 | }) disabled_ifaces; 21 | 22 | # Build replacements for template config. 23 | var({"", ""}) regex; 24 | var({upstream_iface, downstream_iface}) replace; 25 | 26 | # Read template config. 27 | file_read(template_file) template_data; 28 | 29 | # Perform replacements. 30 | regex_replace(template_data, regex, replace) replaced_data; 31 | 32 | # Build string value from replaced_data, to which we will append 33 | # configuration for disabled interfaces. 34 | value(replaced_data) output_data; 35 | 36 | # Build disabled strings. 37 | Foreach (disabled_ifaces As iface) { 38 | # Determine if the interface is disabled. 39 | val_equal(iface, upstream_iface) is_up; 40 | val_equal(iface, downstream_iface) is_down; 41 | or(is_up, is_down) is_not_disabled; 42 | not(is_not_disabled) is_disabled; 43 | 44 | # If it's disabled, append to the configuration file. 45 | If (is_disabled) { 46 | concat("phyint ", iface, " disabled\n") str; 47 | output_data->append(str); 48 | }; 49 | }; 50 | 51 | # Write config. 52 | file_write(output_file, output_data); 53 | } 54 | -------------------------------------------------------------------------------- /android/jni/ncd/examples/onoff_server_test.ncd: -------------------------------------------------------------------------------- 1 | include "onoff_server.ncdi" 2 | 3 | process main { 4 | call("onoff_server_main", {"/home/ambro/onoff.socket"}) onoff_server; 5 | 6 | process_manager() mgr; 7 | mgr->start("service1", {}); 8 | #mgr->start("service2", {}); 9 | } 10 | 11 | template service1 { 12 | alias("_caller") main; 13 | 14 | call("onoff_server_onoff", {"_caller.main.onoff_server", "ServiceId1", "true"}); 15 | 16 | println("service1 up"); 17 | rprintln("service1 down"); 18 | 19 | # Do your stuff. 20 | } 21 | -------------------------------------------------------------------------------- /android/jni/ncd/examples/tcp_echo_client.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | getargs() args; 3 | value(args) args; 4 | 5 | num_different(args.length, "2") bad_args; 6 | If (bad_args) { 7 | println("bad arguments"); 8 | exit("1"); 9 | }; 10 | 11 | args->get("0") addr_ip; 12 | args->get("1") addr_port; 13 | 14 | sys.connect({"tcp", {"ipv4", addr_ip, addr_port}}) socket; 15 | If (socket.is_error) { 16 | println("connection error!"); 17 | exit("1"); 18 | }; 19 | 20 | println("connected"); 21 | 22 | socket->write("This echo client is implemented in NCD!\n\n"); 23 | 24 | backtrack_point() recv_point; 25 | 26 | socket->read() data; 27 | If (data.not_eof) { 28 | socket->write(data); 29 | recv_point->go(); 30 | }; 31 | 32 | println("server disconnected"); 33 | 34 | exit("0"); 35 | } 36 | -------------------------------------------------------------------------------- /android/jni/ncd/examples/tcp_echo_server.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | getargs() args; 3 | value(args) args; 4 | 5 | num_different(args.length, "2") bad_args; 6 | If (bad_args) { 7 | println("bad arguments"); 8 | exit("1"); 9 | }; 10 | 11 | args->get("0") addr_ip; 12 | args->get("1") addr_port; 13 | 14 | sys.listen({"tcp", {"ipv4", addr_ip, addr_port}}, "client_handler", {}) listener; 15 | If (listener.is_error) { 16 | println("failed to listen"); 17 | exit("1"); 18 | }; 19 | 20 | println("listening"); 21 | } 22 | 23 | template client_handler { 24 | to_string(_socket.client_addr) addr_str; 25 | 26 | println("client ", addr_str, ": connected"); 27 | rprintln("client ", addr_str, ": disconnected"); 28 | 29 | _socket->write("This echo server is implemented in NCD!\n\n"); 30 | 31 | backtrack_point() recv_point; 32 | 33 | _socket->read() data; 34 | If (data.not_eof) { 35 | _socket->write(data); 36 | recv_point->go(); 37 | }; 38 | 39 | _socket->close(); 40 | } 41 | -------------------------------------------------------------------------------- /android/jni/ncd/extra/build_cmdline.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file build_cmdline.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef NCD_BUILD_CMDLINE_H 31 | #define NCD_BUILD_CMDLINE_H 32 | 33 | #include 34 | #include 35 | 36 | int ncd_build_cmdline (NCDModuleInst *i, int log_channel, NCDValRef cmd_arg, char **exec, CmdLine *cl); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /android/jni/ncd/include_linux_input.c: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /android/jni/ncd/modules/buffer_chunks_tree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME ChunksTree 2 | #define SAVL_PARAM_FEATURE_COUNTS 0 3 | #define SAVL_PARAM_FEATURE_NOKEYS 0 4 | #define SAVL_PARAM_TYPE_ENTRY struct chunk 5 | #define SAVL_PARAM_TYPE_KEY size_t 6 | #define SAVL_PARAM_TYPE_ARG int 7 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) B_COMPARE((entry1)->offset, (entry2)->offset) 8 | #define SAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) B_COMPARE((key1), (entry2)->offset) 9 | #define SAVL_PARAM_MEMBER_NODE chunks_tree_node 10 | -------------------------------------------------------------------------------- /android/jni/ncd/modules/value_maptree.h: -------------------------------------------------------------------------------- 1 | #define SAVL_PARAM_NAME MapTree 2 | #define SAVL_PARAM_FEATURE_COUNTS 1 3 | #define SAVL_PARAM_FEATURE_NOKEYS 0 4 | #define SAVL_PARAM_TYPE_ENTRY struct value 5 | #define SAVL_PARAM_TYPE_KEY NCDValRef 6 | #define SAVL_PARAM_TYPE_ARG int 7 | #define SAVL_PARAM_TYPE_COUNT size_t 8 | #define SAVL_PARAM_VALUE_COUNT_MAX SIZE_MAX 9 | #define SAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) NCDVal_Compare((entry1)->map_parent.key, (entry2)->map_parent.key) 10 | #define SAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) NCDVal_Compare((key1), (entry2)->map_parent.key) 11 | #define SAVL_PARAM_MEMBER_NODE map_parent.maptree_node 12 | -------------------------------------------------------------------------------- /android/jni/ncd/ncd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ncd.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | // name of the program 31 | #define PROGRAM_NAME "ncd" 32 | 33 | // how long to wait after an error before retrying 34 | #define DEFAULT_RETRY_TIME 5000 35 | 36 | // default loglevel 37 | #define DEFAULT_LOGLEVEL BLOG_WARNING 38 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/addr_in_network.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | net.ipv4.addr_in_network("192.168.6.0", "192.168.6.0", "24") r; 3 | assert(r); 4 | 5 | net.ipv4.addr_in_network("192.168.6.0", "192.168.6.0/24") r; 6 | assert(r); 7 | 8 | net.ipv4.addr_in_network("192.168.6.1", "192.168.6.0", "24") r; 9 | assert(r); 10 | 11 | net.ipv4.addr_in_network("192.168.6.255", "192.168.6.0", "24") r; 12 | assert(r); 13 | 14 | net.ipv4.addr_in_network("192.168.5.255", "192.168.6.0", "24") r; 15 | not(r) r; 16 | assert(r); 17 | 18 | net.ipv4.addr_in_network("192.168.7.0", "192.168.6.0", "24") r; 19 | not(r) r; 20 | assert(r); 21 | 22 | net.ipv4.addr_in_network("192.168.7.0", "192.168.6.0/24") r; 23 | not(r) r; 24 | assert(r); 25 | 26 | net.ipv4.addr_in_network("0.0.0.0", "192.168.6.0", "0") r; 27 | assert(r); 28 | 29 | net.ipv4.addr_in_network("0.0.0.0", "0.0.0.0", "0") r; 30 | assert(r); 31 | 32 | net.ipv4.addr_in_network("255.255.255.255", "0.0.0.0", "0") r; 33 | assert(r); 34 | 35 | net.ipv6.addr_in_network("::123:0", "::123:0/112") r; 36 | assert(r); 37 | 38 | net.ipv6.addr_in_network("::123:1", "::123:0/112") r; 39 | assert(r); 40 | 41 | net.ipv6.addr_in_network("::123:ffff", "::123:0/112") r; 42 | assert(r); 43 | 44 | net.ipv6.addr_in_network("::123:ffff", "::123:ffff/128") r; 45 | assert(r); 46 | 47 | net.ipv6.addr_in_network("::122:ffff", "::123:0/112") r; 48 | not(r) r; 49 | assert(r); 50 | 51 | net.ipv6.addr_in_network("::124:0", "::123:0/112") r; 52 | not(r) r; 53 | assert(r); 54 | 55 | net.ipv6.addr_in_network("::123:fffe", "::123:ffff/128") r; 56 | not(r) r; 57 | assert(r); 58 | 59 | exit("0"); 60 | } 61 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/alias.ncd: -------------------------------------------------------------------------------- 1 | process foo { 2 | var("hello") x; 3 | alias("x") y; 4 | val_equal(y, "hello") a; 5 | assert(a); 6 | 7 | var("hello") x; 8 | alias("x") y; 9 | y->set("world"); 10 | val_equal(y, "world") a; 11 | assert(a); 12 | 13 | var("hello") x; 14 | alias("x") y; 15 | alias("y") z; 16 | z->set("world"); 17 | val_equal(x, "world") a; 18 | assert(a); 19 | 20 | call("test", {"hello"}) c; 21 | alias("c.x") x; 22 | val_equal(x, "hello") a; 23 | assert(a); 24 | 25 | call("test", {"hello"}) c; 26 | alias("c") x; 27 | alias("x") y; 28 | alias("y.x") z; 29 | c.x->set("world"); 30 | val_equal(z, "world") a; 31 | assert(a); 32 | 33 | var("hello") x; 34 | call("test2", {"_caller.x"}) c; 35 | c.x->set("world"); 36 | val_equal(x, "world") a; 37 | assert(a); 38 | 39 | exit("0"); 40 | } 41 | 42 | template test { 43 | var(_arg0) x; 44 | } 45 | 46 | template test2 { 47 | alias(_arg0) x; 48 | } 49 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/arithmetic.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | num_lesser("6", "7") r; 3 | assert(r); 4 | 5 | num_lesser("7", "7") r; 6 | not(r) a; 7 | assert(a); 8 | 9 | num_greater("7", "6") r; 10 | assert(r); 11 | 12 | num_greater("7", "7") r; 13 | not(r) a; 14 | assert(a); 15 | 16 | num_lesser_equal("7", "7") r; 17 | assert(r); 18 | 19 | num_lesser_equal("8", "7") r; 20 | not(r) a; 21 | assert(a); 22 | 23 | num_greater_equal("7", "7") r; 24 | assert(r); 25 | 26 | num_greater_equal("7", "8") r; 27 | not(r) a; 28 | assert(a); 29 | 30 | num_equal("7", "7") r; 31 | assert(r); 32 | 33 | num_equal("6", "7") r; 34 | not(r) a; 35 | assert(a); 36 | 37 | num_equal("7", "6") r; 38 | not(r) a; 39 | assert(a); 40 | 41 | num_different("7", "6") a; 42 | assert(a); 43 | 44 | num_different("7", "007") a; 45 | not(a) a; 46 | assert(a); 47 | 48 | num_add("4", "7") r; 49 | strcmp(r, "11") a; 50 | assert(a); 51 | 52 | num_subtract("4", "3") r; 53 | strcmp(r, "1") a; 54 | assert(a); 55 | 56 | num_multiply("4", "5") r; 57 | strcmp(r, "20") a; 58 | assert(a); 59 | 60 | num_divide("7", "3") r; 61 | strcmp(r, "2") a; 62 | assert(a); 63 | 64 | num_modulo("7", "3") r; 65 | strcmp(r, "1") a; 66 | assert(a); 67 | 68 | exit("0"); 69 | } 70 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/backtracking.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | value({}) list; 3 | var("0") i; 4 | backtrack_point() point; 5 | num_lesser(i, "100") do_more; 6 | If (do_more) { 7 | list->insert(i); 8 | num_add(i, "1") new_i; 9 | i->set(new_i); 10 | point->go(); 11 | }; 12 | val_equal(list.length, "100") a; 13 | assert(a); 14 | 15 | value({}) list; 16 | var("0") i; 17 | blocker() blk; 18 | blk->up(); 19 | blk->use(); 20 | num_lesser(i, "100") do_more; 21 | If (do_more) { 22 | list->insert(i); 23 | num_add(i, "1") new_i; 24 | i->set(new_i); 25 | blk->downup(); 26 | }; 27 | val_equal(list.length, "100") a; 28 | assert(a); 29 | 30 | exit("0"); 31 | } 32 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/buffer.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | buffer() buf; 3 | val_equal(buf, "") a; 4 | assert(a); 5 | 6 | buf->append("12"); 7 | val_equal(buf, "12") a; 8 | assert(a); 9 | 10 | buf->append("345"); 11 | val_equal(buf, "12345") a; 12 | assert(a); 13 | 14 | buf->consume("1"); 15 | val_equal(buf, "2345") a; 16 | assert(a); 17 | 18 | buf->consume("1"); 19 | val_equal(buf, "345") a; 20 | assert(a); 21 | 22 | buf->consume("3"); 23 | val_equal(buf, "") a; 24 | assert(a); 25 | 26 | buf->append("6"); 27 | val_equal(buf, "6") a; 28 | assert(a); 29 | 30 | buf->append("7890"); 31 | val_equal(buf, "67890") a; 32 | assert(a); 33 | 34 | buf->append(""); 35 | val_equal(buf, "67890") a; 36 | assert(a); 37 | 38 | buf->consume("4"); 39 | val_equal(buf, "0") a; 40 | assert(a); 41 | 42 | buf->append("1234567890"); 43 | val_equal(buf, "01234567890") a; 44 | assert(a); 45 | 46 | val_equal(buf.length, "11") a; 47 | assert(a); 48 | 49 | buffer("hello") buf2; 50 | val_equal(buf2, "hello") a; 51 | assert(a); 52 | 53 | exit("0"); 54 | } 55 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/call.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | var("bad_x") x; 3 | var("good_x") y; 4 | call("helper_func", {}) helper; 5 | call_with_caller_target("func1", {}, "helper") c; 6 | val_equal(c.x, "good_x") a; 7 | assert(a); 8 | 9 | exit("0"); 10 | } 11 | 12 | template helper_func { 13 | var(_caller.y) x; 14 | } 15 | 16 | template func1 { 17 | var(_caller.x) x; 18 | } 19 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/concat.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | concat("Hello", "", "World") x; 3 | strcmp(x, "HelloWorld") a; 4 | assert(a); 5 | 6 | concat("\x00\x00", "\x00") x; 7 | strcmp(x, "\x00\x00\x00") a; 8 | assert(a); 9 | 10 | concatv({"Hello", "", "World"}) x; 11 | strcmp(x, "HelloWorld") a; 12 | assert(a); 13 | 14 | concatv({"\x00\x00", "\x00"}) x; 15 | strcmp(x, "\x00\x00\x00") a; 16 | assert(a); 17 | 18 | exit("0"); 19 | } 20 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/depend.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | var("hello") x; 3 | provide("A"); 4 | depend("A") d; 5 | val_equal(d.x, "hello") a; 6 | assert(a); 7 | d.x->set("world"); 8 | val_equal(d.x, "world") a; 9 | assert(a); 10 | 11 | var("hello") x; 12 | provide("B"); 13 | val_equal(x, "world") a; 14 | assert(a); 15 | 16 | var("hello") x; 17 | provide("C"); 18 | val_equal(x, "hello") a; 19 | assert(a); 20 | depend("C_done"); 21 | val_equal(x, "world") a; 22 | assert(a); 23 | 24 | var("hello") x; 25 | blocker() blk; 26 | provide("D"); 27 | val_equal(x, "hello") a; 28 | assert(a); 29 | blk->up(); 30 | val_equal(x, "0") a; 31 | assert(a); 32 | blk->down(); 33 | blk->up(); 34 | val_equal(x, "1") a; 35 | assert(a); 36 | 37 | exit("0"); 38 | } 39 | 40 | process proc1 { 41 | depend("B") dep; 42 | dep.x->set("world"); 43 | } 44 | 45 | process proc2 { 46 | depend("C") dep; 47 | sleep("0", "0"); 48 | dep.x->set("world"); 49 | provide("C_done"); 50 | } 51 | 52 | process proc3 { 53 | depend("D") dep; 54 | dep.blk->use(); 55 | provide("E"); 56 | } 57 | 58 | process proc4 { 59 | var("0") i; 60 | depend("E") dep; 61 | dep.dep.x->set(i); 62 | num_add(i, "1") j; 63 | i->set(j); 64 | } 65 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/depend_scope.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | depend_scope() scope; 3 | var("0") x; 4 | process_manager() mgr; 5 | 6 | var("false") backtrack_check; 7 | backtrack_point() point; 8 | If (backtrack_check) { 9 | val_equal(x, "2") a; # must not have rebound temporarily to A during backtracking 10 | assert(a); 11 | exit("0"); 12 | }; 13 | 14 | scope->provide("A"); 15 | mgr->start("t1", "t1", {}); 16 | val_equal(x, "1") a; # must have bound to A immediately 17 | assert(a); 18 | 19 | scope->provide("B") mgr; 20 | val_equal(x, "2") a; # must have rebound to B immediately 21 | assert(a); 22 | 23 | backtrack_check->set("true"); 24 | point->go(); 25 | } 26 | 27 | template t1 { 28 | _caller.scope->depend({"B", "A"}) dep; 29 | num_add(dep.x, "1") new_x; 30 | dep.x->set(new_x); 31 | } 32 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/escape_and_nulls.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | value("ab\0") str1; 3 | value("ab") str2; 4 | 5 | strcmp(str1.length, "3") a; 6 | assert(a); 7 | 8 | strcmp(str2.length, "2") a; 9 | assert(a); 10 | 11 | strcmp(str1, str2) a; 12 | not(a) a; 13 | assert(a); 14 | 15 | concat(str1, str2) strc; 16 | strcmp(strc, "ab\0ab") a; 17 | assert(a); 18 | 19 | concat(str2, str1) strc; 20 | strcmp(strc, "abab\0") a; 21 | assert(a); 22 | 23 | value("") str1; 24 | value("\x00\x00") str2; 25 | value("\x00\x01") str3; 26 | value("\x01") str4; 27 | 28 | val_lesser(str1, str2) a; 29 | assert(a); 30 | 31 | val_lesser(str2, str3) a; 32 | assert(a); 33 | 34 | val_lesser(str3, str4) a; 35 | assert(a); 36 | 37 | exit("0"); 38 | } 39 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/explode.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | explode("FOO", "aaaFOObbbFOOcccFOOddd") l; 3 | val_equal(l, {"aaa", "bbb", "ccc", "ddd"}) a; 4 | assert(a); 5 | 6 | explode("FOO", "FOObbbFOOFOO") l; 7 | val_equal(l, {"", "bbb", "", ""}) a; 8 | assert(a); 9 | 10 | explode("FOO", "foo") l; 11 | val_equal(l, {"foo"}) a; 12 | assert(a); 13 | 14 | explode("FOO", "FOO") l; 15 | val_equal(l, {"", ""}) a; 16 | assert(a); 17 | 18 | explode("participate in parachute", "parachute in participation of participate in parachuteparparticipate in parachute participate in parachut") l; 19 | val_equal(l, {"parachute in participation of ", "par", " participate in parachut"}) a; 20 | assert(a); 21 | 22 | exit("0"); 23 | } 24 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/foreach.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | var({"a", "b", "c", "d"}) list; 3 | value(["a":"1", "b":"2", "c":"3", "d":"4"]) map; 4 | 5 | value({}) new; 6 | Foreach (list As value) { 7 | new->insert(new.length, value); 8 | }; 9 | val_equal(new, list) a; 10 | assert(a); 11 | 12 | value({}) new; 13 | Foreach (list As index:value) { 14 | new->insert(index, value); 15 | }; 16 | val_equal(new, list) a; 17 | assert(a); 18 | 19 | value([]) new; 20 | Foreach (map As key) { 21 | map->get(key) value; 22 | new->insert(key, value); 23 | }; 24 | val_equal(new, map) a; 25 | assert(a); 26 | 27 | value([]) new; 28 | Foreach (map As key:value) { 29 | new->insert(key, value); 30 | }; 31 | val_equal(new, map) a; 32 | assert(a); 33 | 34 | exit("0"); 35 | } 36 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/if.ncd: -------------------------------------------------------------------------------- 1 | process foo { 2 | If ("true") { 3 | If ("truee") { 4 | var("A1") y; 5 | } else { 6 | If ("true") { 7 | var("A11") q; 8 | } else { 9 | var("A22") q; 10 | } t; 11 | var(t.q) y; 12 | } s; 13 | var(s.y) x; 14 | } elif ("true") { 15 | var("B") x; 16 | } else { 17 | var("C") x; 18 | } ifs; 19 | 20 | val_equal(ifs.x, "A11") a; 21 | assert(a); 22 | 23 | var("a") v; 24 | If ("false") { 25 | v->set("b"); 26 | }; 27 | val_equal(v, "a") a; 28 | assert(a); 29 | 30 | var("a") v; 31 | If ("true") { 32 | v->set("b"); 33 | }; 34 | val_equal(v, "b") a; 35 | assert(a); 36 | 37 | exit("0"); 38 | } 39 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/implode.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | implode("X", {"a", "bb", "", "c"}) str; 3 | strcmp(str, "aXbbXXc") a; 4 | assert(a); 5 | 6 | implode("", {"a", "b"}) str; 7 | strcmp(str, "ab") a; 8 | assert(a); 9 | 10 | implode("X", {}) str; 11 | strcmp(str, "") a; 12 | assert(a); 13 | 14 | exit("0"); 15 | } 16 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/include.ncd: -------------------------------------------------------------------------------- 1 | include "include_included.ncdi" 2 | include "include_included.ncdi" 3 | include "include_included2.ncdi" 4 | include "include_included2.ncdi" 5 | 6 | process main { 7 | call("incl_tmpl", {}) c; 8 | val_equal(c.x, "good") a; 9 | assert(a); 10 | 11 | call("incl_tmpl2", {}) c; 12 | val_equal(c.x, "good2") a; 13 | assert(a); 14 | 15 | exit("0"); 16 | } 17 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/include_included.ncdi: -------------------------------------------------------------------------------- 1 | include_guard "include_included" 2 | 3 | template incl_tmpl { 4 | var("good") x; 5 | } 6 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/include_included2.ncdi: -------------------------------------------------------------------------------- 1 | include_guard "include_included2" 2 | 3 | template incl_tmpl2 { 4 | var("good2") x; 5 | } 6 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/logical.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | var("true") t; 3 | var("Faalse") f; 4 | 5 | and(t, f) r; 6 | strcmp(r, "false") a; 7 | assert(a); 8 | 9 | and(f, t) r; 10 | strcmp(r, "false") a; 11 | assert(a); 12 | 13 | and(f, f) r; 14 | strcmp(r, "false") a; 15 | assert(a); 16 | 17 | and(t, t) r; 18 | strcmp(r, "true") a; 19 | assert(a); 20 | 21 | or(t, f) r; 22 | strcmp(r, "true") a; 23 | assert(a); 24 | 25 | or(f, t) r; 26 | strcmp(r, "true") a; 27 | assert(a); 28 | 29 | or(t, t) r; 30 | strcmp(r, "true") a; 31 | assert(a); 32 | 33 | or(f, f) r; 34 | strcmp(r, "false") a; 35 | assert(a); 36 | 37 | not(f) r; 38 | strcmp(r, "true") a; 39 | assert(a); 40 | 41 | not(t) r; 42 | strcmp(r, "false") a; 43 | assert(a); 44 | 45 | exit("0"); 46 | } 47 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/multidepend.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | var("0") x; 3 | process_manager() mgr; 4 | 5 | var("false") backtrack_check; 6 | backtrack_point() point; 7 | If (backtrack_check) { 8 | val_equal(x, "2") a; # must not have rebound temporarily to A during backtracking 9 | assert(a); 10 | exit("0"); 11 | }; 12 | 13 | multiprovide("A"); 14 | mgr->start("t1", "t1", {}); 15 | val_equal(x, "1") a; # must have bound to A immediately 16 | assert(a); 17 | 18 | multiprovide("B") mgr; 19 | val_equal(x, "2") a; # must have rebound to B immediately 20 | assert(a); 21 | 22 | backtrack_check->set("true"); 23 | point->go(); 24 | } 25 | 26 | template t1 { 27 | multidepend({"B", "A"}) dep; 28 | num_add(dep.x, "1") new_x; 29 | dep.x->set(new_x); 30 | } 31 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/netmask.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | ipv4_prefix_to_mask("16") mask; 3 | strcmp(mask, "255.255.0.0") a; 4 | assert(a); 5 | 6 | ipv4_mask_to_prefix("128.0.0.0") prefix; 7 | strcmp(prefix, "1") a; 8 | assert(a); 9 | 10 | ipv4_net_from_addr_and_prefix("192.168.1.4", "24") net; 11 | strcmp(net, "192.168.1.0") a; 12 | assert(a); 13 | 14 | exit("0"); 15 | } 16 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/regex.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | var("FOO BAR BAZ QUX goo") x; 3 | regex_replace(x, {"FOO", "BAR", "goo"}, {"BAR", "bar", "GOO"}) y; 4 | strcmp(y, "BAR bar BAZ QUX GOO") a; 5 | assert(a); 6 | 7 | var("hello world") x; 8 | regex_replace(x, {"^hello"}, {"Hello,"}) y; 9 | strcmp(y, "Hello, world") a; 10 | assert(a); 11 | 12 | var("hello world") x; 13 | regex_replace(x, {"goodbye"}, {"hello"}) y; 14 | strcmp(y, "hello world") a; 15 | assert(a); 16 | 17 | var("hello world") x; 18 | regex_replace(x, {"hello world"}, {"hello NCD"}) y; 19 | strcmp(y, "hello NCD") a; 20 | assert(a); 21 | 22 | var("hello world") x; 23 | regex_replace(x, {"wor"}, {"Wor"}) y; 24 | strcmp(y, "hello World") a; 25 | assert(a); 26 | 27 | var("hello world") x; 28 | regex_replace(x, {"ell", "llo"}, {"ELL", "LLO"}) y; 29 | strcmp(y, "hELLo world") a; 30 | assert(a); 31 | 32 | var("hello world") x; 33 | regex_replace(x, {"ell", "el"}, {"ELL", "EL"}) y; 34 | strcmp(y, "hELLo world") a; 35 | assert(a); 36 | 37 | var("hello world") x; 38 | regex_replace(x, {"el", "lo"}, {"EL", "LO"}) y; 39 | strcmp(y, "hELLO world") a; 40 | assert(a); 41 | 42 | var("hello world") x; 43 | regex_replace(x, {"ell", "ll"}, {"ELL", "LL"}) y; 44 | strcmp(y, "hELLo world") a; 45 | assert(a); 46 | 47 | exit("0"); 48 | } 49 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/run_tests: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NCD=$1 4 | USE_VALGRIND=$2 5 | 6 | if [[ -z $NCD ]] || [[ -n $USE_VALGRIND && $USE_VALGRIND != use_valgrind ]]; then 7 | echo "Usage: $0 [use_valgrind]" 8 | exit 1 9 | fi 10 | 11 | if [[ ! -e ./run_tests ]]; then 12 | echo "Must run from the tests directory" 13 | exit 1 14 | fi 15 | 16 | failed=0 17 | 18 | for file in ./*.ncd; do 19 | echo "Running: $file" 20 | if [[ $USE_VALGRIND = use_valgrind ]]; then 21 | valgrind --error-exitcode=1 --leak-check=full "$NCD" --loglevel none --config-file "$file" 22 | else 23 | "$NCD" --loglevel none --config-file "$file" 24 | fi 25 | res=$? 26 | if [[ ! $res -eq 0 ]]; then 27 | echo "FAILED" 28 | let failed+=1 29 | fi 30 | done 31 | 32 | if [[ $failed -gt 0 ]]; then 33 | echo "$failed tests FAILED" 34 | exit 1 35 | fi 36 | 37 | echo "all tests passed" 38 | exit 0 39 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/strings.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | buffer() buf; 3 | buf->append("12"); 4 | buf->append("345"); 5 | buf->append("6"); 6 | num_equal(buf, "123456") a; 7 | assert(a); 8 | 9 | var("false") check; 10 | call("test_func", {}); 11 | assert(check); 12 | 13 | buffer() buf; 14 | buf->append("test_func"); 15 | var("false") check; 16 | call(buf, {}); 17 | assert(check); 18 | 19 | concat("test_func") cnc; 20 | var("false") check; 21 | call(cnc, {}); 22 | assert(check); 23 | 24 | buffer() buf; 25 | buf->append("test_func"); 26 | var("false") check; 27 | process_manager() mgr; 28 | mgr->start(buf, {}); 29 | assert(check); 30 | 31 | buffer() buf; 32 | buf->append("/bin/echo"); 33 | runonce({buf, buf}); 34 | 35 | buffer() buf; 36 | buf->append("12"); 37 | buf->append("345"); 38 | to_string(buf) str; 39 | val_equal(str, "\"12345\"") a; 40 | assert(a); 41 | 42 | exit("0"); 43 | } 44 | 45 | template test_func { 46 | _caller.check->set("true"); 47 | } 48 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/substr.ncd: -------------------------------------------------------------------------------- 1 | process main { 2 | var("0123456789") str; 3 | concat(str) external_str; 4 | 5 | call("do_test", {"_caller.str"}); 6 | call("do_test", {"_caller.external_str"}); 7 | 8 | exit("0"); 9 | } 10 | 11 | template do_test { 12 | alias(_arg0) str; 13 | 14 | substr(str, "0") sub; 15 | val_equal(sub, "0123456789") a; 16 | assert(a); 17 | 18 | substr(str, "2") sub; 19 | val_equal(sub, "23456789") a; 20 | assert(a); 21 | 22 | substr(str, "3", "0") sub; 23 | val_equal(sub, "") a; 24 | assert(a); 25 | 26 | substr(str, "3", "6") sub; 27 | val_equal(sub, "345678") a; 28 | assert(a); 29 | 30 | substr(str, "3", "7") sub; 31 | val_equal(sub, "3456789") a; 32 | assert(a); 33 | 34 | substr(str, "3", "8") sub; 35 | val_equal(sub, "3456789") a; 36 | assert(a); 37 | } 38 | -------------------------------------------------------------------------------- /android/jni/ncd/tests/value_substr.ncd: -------------------------------------------------------------------------------- 1 | process foo { 2 | value("0123456789") str; 3 | 4 | str->substr("0") sub; 5 | strcmp(sub, str) a; 6 | assert(a); 7 | 8 | str->substr("1") sub; 9 | strcmp(sub, "123456789") a; 10 | assert(a); 11 | 12 | str->substr("1", "0") sub; 13 | strcmp(sub, "") a; 14 | assert(a); 15 | 16 | str->substr("1", "9") sub; 17 | strcmp(sub, "123456789") a; 18 | assert(a); 19 | 20 | str->substr("1", "8") sub; 21 | strcmp(sub, "12345678") a; 22 | assert(a); 23 | 24 | exit("0"); 25 | } 26 | -------------------------------------------------------------------------------- /android/jni/nspr_support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(nspr_support 2 | DummyPRFileDesc.c 3 | BSSLConnection.c 4 | ) 5 | target_link_libraries(nspr_support system flow threadwork ${NSPR_LIBRARIES} ${NSS_LIBRARIES}) 6 | -------------------------------------------------------------------------------- /android/jni/predicate/BPredicate_parser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BPredicate_parser.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @section DESCRIPTION 30 | * 31 | * {@link BPredicate} parser definitions. 32 | */ 33 | 34 | #ifndef BADVPN_PREDICATE_BPREDICATE_PARSER_H 35 | #define BADVPN_PREDICATE_BPREDICATE_PARSER_H 36 | 37 | #define YY_NO_UNISTD_H 38 | 39 | #include 40 | 41 | #include 42 | #include 43 | 44 | // implemented in BPredicate.c 45 | void yyerror (YYLTYPE *yylloc, yyscan_t scanner, struct predicate_node **result, char *str); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /android/jni/predicate/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(predicate 2 | BPredicate.c 3 | ${PROJECT_SOURCE_DIR}/generated/flex_BPredicate.c 4 | ${PROJECT_SOURCE_DIR}/generated/bison_BPredicate.c 5 | ) 6 | target_link_libraries(predicate system) 7 | -------------------------------------------------------------------------------- /android/jni/protocol/addr.bproto: -------------------------------------------------------------------------------- 1 | // message for an AddrProto address 2 | message addr { 3 | // address type. from addr.h 4 | required uint8 type = 1; 5 | // for IPv4 and IPv6 addresses, the port (network byte order) 6 | optional data("2") ip_port = 2; 7 | // for IPv4 addresses, the IP address 8 | optional data("4") ipv4_addr = 3; 9 | // for IPv6 addresses, the IP address 10 | optional data("16") ipv6_addr = 4; 11 | }; 12 | -------------------------------------------------------------------------------- /android/jni/protocol/msgproto.bproto: -------------------------------------------------------------------------------- 1 | // message for all MsgProto messages 2 | message msg { 3 | // message type, from msgproto.h 4 | required uint16 type = 1; 5 | // message payload. Is itself one of the messages below 6 | // for "youconnect", "seed" and "confirmseed" messages, 7 | // and empty for other messages 8 | required data payload = 2; 9 | }; 10 | 11 | // "youconnect" message payload 12 | message msg_youconnect { 13 | // external addresses to try; one or more msg_youconnect_addr messages 14 | required repeated data addr = 1; 15 | // encryption key if using UDP and encryption is enabled 16 | optional data key = 2; 17 | // password if using TCP 18 | optional uint64 password = 3; 19 | }; 20 | 21 | // an external address 22 | message msg_youconnect_addr { 23 | // scope name for this address 24 | required data name = 1; 25 | // address according to AddrProto 26 | required data addr = 2; 27 | }; 28 | 29 | // "seed" message payload 30 | message msg_seed { 31 | // identifier for the seed being send 32 | required uint16 seed_id = 1; 33 | // seed encryption key 34 | required data key = 2; 35 | // seed IV 36 | required data iv = 3; 37 | }; 38 | 39 | // "confirmseed" message payload 40 | message msg_confirmseed { 41 | // identifier for the seed being confirmed 42 | required uint16 seed_id = 1; 43 | }; 44 | -------------------------------------------------------------------------------- /android/jni/random/BRandom2.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BRandom2.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_RANDOM2_H 31 | #define BADVPN_RANDOM2_H 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | #define BRANDOM2_INIT_LAZY (1 << 0) 39 | 40 | typedef struct { 41 | int initialized; 42 | int urandom_fd; 43 | DebugObject d_obj; 44 | } BRandom2; 45 | 46 | int BRandom2_Init (BRandom2 *o, int flags) WARN_UNUSED; 47 | void BRandom2_Free (BRandom2 *o); 48 | int BRandom2_GenBytes (BRandom2 *o, void *out, size_t len) WARN_UNUSED; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /android/jni/random/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(badvpn_random 2 | BRandom2.c 3 | ) 4 | target_link_libraries(badvpn_random base) 5 | -------------------------------------------------------------------------------- /android/jni/scripts/cmake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export ROOT="" 4 | export MINGW="/home//mingw/cross_win32" 5 | 6 | export PATH="$MINGW/bin:$PATH" 7 | 8 | exec /usr/bin/cmake -DCMAKE_TOOLCHAIN_FILE="$ROOT/toolchain.cmake" "$@" 9 | -------------------------------------------------------------------------------- /android/jni/scripts/copy_nss: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | NSSDIST="$1" 4 | DEST="$2" 5 | 6 | if [ -z "${NSSDIST}" ] || [ -z "${DEST}" ]; then 7 | echo "Copies a Windows build of NSS such that it can be found by the BadVPN build system" 8 | echo "Usage: $0 " 9 | exit 1 10 | fi 11 | 12 | NSSOBJ="${NSSDIST}/WINNT5.1_OPT.OBJ" 13 | 14 | set -e 15 | 16 | mkdir -p "${DEST}"/include 17 | cp -r "${NSSOBJ}/include"/* "${DEST}"/include/ 18 | cp -r "${NSSDIST}/public/nss"/* "${DEST}"/include/ 19 | mkdir -p "${DEST}"/lib 20 | cp "${NSSOBJ}/lib"/{libnspr4,libplc4,libplds4,ssl3,smime3,nss3}.lib "${DEST}"/lib/ 21 | mkdir -p "${DEST}"/bin 22 | cp "${NSSOBJ}/lib"/*.dll "${DEST}"/bin/ 23 | cp "${NSSOBJ}/bin"/*.exe "${DEST}"/bin/ 24 | -------------------------------------------------------------------------------- /android/jni/scripts/toolchain.cmake: -------------------------------------------------------------------------------- 1 | SET(CMAKE_SYSTEM_NAME Windows) 2 | SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc) 3 | SET(CMAKE_FIND_ROOT_PATH $ENV{ROOT}) 4 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) 5 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 6 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 7 | -------------------------------------------------------------------------------- /android/jni/security/BRandom.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BRandom.c 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | 36 | void BRandom_randomize (uint8_t *buf, int len) 37 | { 38 | ASSERT(len >= 0) 39 | 40 | DEBUG_ZERO_MEMORY(buf, len) 41 | ASSERT_FORCE(RAND_bytes(buf, len) == 1) 42 | } 43 | -------------------------------------------------------------------------------- /android/jni/security/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(security 2 | BSecurity.c 3 | BEncryption.c 4 | BHash.c 5 | BRandom.c 6 | OTPCalculator.c 7 | OTPChecker.c 8 | OTPGenerator.c 9 | ) 10 | target_link_libraries(security system threadwork ${LIBCRYPTO_LIBRARIES}) 11 | -------------------------------------------------------------------------------- /android/jni/server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(badvpn-server server.c) 2 | target_link_libraries(badvpn-server system flow flowextra nspr_support predicate security ${NSPR_LIBRARIES} ${NSS_LIBRARIES}) 3 | 4 | install( 5 | TARGETS badvpn-server 6 | RUNTIME DESTINATION bin 7 | ) 8 | 9 | install( 10 | FILES badvpn-server.8 11 | DESTINATION share/man/man8 12 | ) 13 | -------------------------------------------------------------------------------- /android/jni/server_connection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(server_conection 2 | ServerConnection.c 3 | SCKeepaliveSource.c 4 | ) 5 | target_link_libraries(server_conection system flow flowextra nspr_support ${NSPR_LIBRARIES} ${NSS_LIBRARIES}) 6 | -------------------------------------------------------------------------------- /android/jni/socksclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(socksclient 2 | BSocksClient.c 3 | ) 4 | target_link_libraries(socksclient system flow flowextra) 5 | -------------------------------------------------------------------------------- /android/jni/stringmap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(stringmap 2 | BStringMap.c 3 | ) 4 | -------------------------------------------------------------------------------- /android/jni/structure/CAvl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CAvl.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_CAVL_H 31 | #define BADVPN_CAVL_H 32 | 33 | #include 34 | #include 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /android/jni/structure/CHash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CHash.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_CHASH_H 31 | #define BADVPN_CHASH_H 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /android/jni/structure/IndexedList_tree.h: -------------------------------------------------------------------------------- 1 | #define CAVL_PARAM_NAME IndexedList__Tree 2 | #define CAVL_PARAM_FEATURE_COUNTS 1 3 | #define CAVL_PARAM_FEATURE_KEYS_ARE_INDICES 1 4 | #define CAVL_PARAM_FEATURE_NOKEYS 0 5 | #define CAVL_PARAM_TYPE_ENTRY IndexedListNode 6 | #define CAVL_PARAM_TYPE_LINK IndexedList__tree_link 7 | #define CAVL_PARAM_TYPE_ARG int 8 | #define CAVL_PARAM_TYPE_COUNT uint64_t 9 | #define CAVL_PARAM_VALUE_COUNT_MAX UINT64_MAX 10 | #define CAVL_PARAM_VALUE_NULL ((IndexedList__tree_link)NULL) 11 | #define CAVL_PARAM_FUN_DEREF(arg, link) (link) 12 | #define CAVL_PARAM_MEMBER_CHILD tree_child 13 | #define CAVL_PARAM_MEMBER_BALANCE tree_balance 14 | #define CAVL_PARAM_MEMBER_PARENT tree_parent 15 | #define CAVL_PARAM_MEMBER_COUNT tree_count 16 | -------------------------------------------------------------------------------- /android/jni/structure/SAvl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file SAvl.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_SAVL_H 31 | #define BADVPN_SAVL_H 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /android/jni/structure/SAvl_tree.h: -------------------------------------------------------------------------------- 1 | #define CAVL_PARAM_NAME SAvl__Tree 2 | #define CAVL_PARAM_FEATURE_COUNTS SAVL_PARAM_FEATURE_COUNTS 3 | #define CAVL_PARAM_FEATURE_KEYS_ARE_INDICES 0 4 | #define CAVL_PARAM_FEATURE_NOKEYS SAVL_PARAM_FEATURE_NOKEYS 5 | #define CAVL_PARAM_TYPE_ENTRY SAvlEntry 6 | #define CAVL_PARAM_TYPE_LINK SAvl__TreeLink 7 | #define CAVL_PARAM_TYPE_KEY SAvlKey 8 | #define CAVL_PARAM_TYPE_ARG SAvlArg 9 | #define CAVL_PARAM_TYPE_COUNT SAvlCount 10 | #define CAVL_PARAM_VALUE_COUNT_MAX SAVL_PARAM_VALUE_COUNT_MAX 11 | #define CAVL_PARAM_VALUE_NULL ((SAvl__TreeLink)NULL) 12 | #define CAVL_PARAM_FUN_DEREF(arg, link) (link) 13 | #define CAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) SAVL_PARAM_FUN_COMPARE_ENTRIES((arg), (entry1).link, (entry2).link) 14 | #define CAVL_PARAM_FUN_COMPARE_KEY_ENTRY(arg, key1, entry2) SAVL_PARAM_FUN_COMPARE_KEY_ENTRY((arg), (key1), (entry2).link) 15 | #define CAVL_PARAM_MEMBER_CHILD SAVL_PARAM_MEMBER_NODE . child 16 | #define CAVL_PARAM_MEMBER_BALANCE SAVL_PARAM_MEMBER_NODE . balance 17 | #define CAVL_PARAM_MEMBER_PARENT SAVL_PARAM_MEMBER_NODE . parent 18 | #define CAVL_PARAM_MEMBER_COUNT SAVL_PARAM_MEMBER_NODE . count 19 | -------------------------------------------------------------------------------- /android/jni/structure/SLinkedList.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file SLinkedList.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_SLINKEDLIST_H 31 | #define BADVPN_SLINKEDLIST_H 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /android/jni/system/BNetwork.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BNetwork.h 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef BADVPN_SYSTEM_BNETWORK_H 31 | #define BADVPN_SYSTEM_BNETWORK_H 32 | 33 | int BNetwork_GlobalInit (void); 34 | void BNetwork_Assert (void); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /android/jni/system/BReactor.h: -------------------------------------------------------------------------------- 1 | #if defined(BADVPN_BREACTOR_BADVPN) + defined(BADVPN_BREACTOR_GLIB) + defined(BADVPN_BREACTOR_EMSCRIPTEN) != 1 2 | #error No reactor backend or too many reactor backens 3 | #endif 4 | 5 | #if defined(BADVPN_BREACTOR_BADVPN) 6 | #include "BReactor_badvpn.h" 7 | #elif defined(BADVPN_BREACTOR_GLIB) 8 | #include "BReactor_glib.h" 9 | #elif defined(BADVPN_BREACTOR_EMSCRIPTEN) 10 | #include "BReactor_emscripten.h" 11 | #endif 12 | -------------------------------------------------------------------------------- /android/jni/system/BReactor_badvpn_timerstree.h: -------------------------------------------------------------------------------- 1 | #define CAVL_PARAM_NAME BReactor__TimersTree 2 | #define CAVL_PARAM_FEATURE_COUNTS 0 3 | #define CAVL_PARAM_FEATURE_KEYS_ARE_INDICES 0 4 | #define CAVL_PARAM_FEATURE_NOKEYS 1 5 | #define CAVL_PARAM_TYPE_ENTRY struct BSmallTimer_t 6 | #define CAVL_PARAM_TYPE_LINK BReactor_timerstree_link 7 | #define CAVL_PARAM_TYPE_ARG int 8 | #define CAVL_PARAM_VALUE_NULL ((BReactor_timerstree_link)NULL) 9 | #define CAVL_PARAM_FUN_DEREF(arg, link) (link) 10 | #define CAVL_PARAM_FUN_COMPARE_ENTRIES(arg, entry1, entry2) compare_timers((entry1).link, (entry2).link) 11 | #define CAVL_PARAM_MEMBER_CHILD u.tree_child 12 | #define CAVL_PARAM_MEMBER_BALANCE tree_balance 13 | #define CAVL_PARAM_MEMBER_PARENT tree_parent 14 | -------------------------------------------------------------------------------- /android/jni/system/BTime.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file BTime.c 3 | * @author Ambroz Bizjak 4 | * 5 | * @section LICENSE 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. Neither the name of the author nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include 31 | 32 | #ifndef BADVPN_PLUGIN 33 | struct _BTime_global btime_global = { 34 | #ifndef NDEBUG 35 | 0 36 | #endif 37 | }; 38 | #endif 39 | -------------------------------------------------------------------------------- /android/jni/system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(BSYSTEM_ADDITIONAL_LIBS) 2 | set(BSYSTEM_ADDITIONAL_SOURCES) 3 | 4 | if (NOT EMSCRIPTEN) 5 | list(APPEND BSYSTEM_ADDITIONAL_SOURCES 6 | BSignal.c 7 | BNetwork.c 8 | ) 9 | 10 | if (WIN32) 11 | list(APPEND BSYSTEM_ADDITIONAL_LIBS ws2_32 mswsock) 12 | list(APPEND BSYSTEM_ADDITIONAL_SOURCES 13 | BConnection_win.c 14 | BDatagram_win.c 15 | ) 16 | endif () 17 | 18 | if (NOT WIN32) 19 | list(APPEND BSYSTEM_ADDITIONAL_SOURCES 20 | BUnixSignal.c 21 | BConnection_unix.c 22 | BDatagram_unix.c 23 | BProcess.c 24 | BInputProcess.c 25 | BThreadSignal.c 26 | BLockReactor.c 27 | ) 28 | endif () 29 | endif () 30 | 31 | if (BREACTOR_BACKEND STREQUAL "badvpn") 32 | list(APPEND BSYSTEM_ADDITIONAL_SOURCES BReactor_badvpn.c) 33 | elseif (BREACTOR_BACKEND STREQUAL "glib") 34 | list(APPEND BSYSTEM_ADDITIONAL_SOURCES BReactor_glib.c) 35 | list(APPEND BSYSTEM_ADDITIONAL_LIBS ${GLIB2_LIBRARIES}) 36 | elseif (BREACTOR_BACKEND STREQUAL "emscripten") 37 | list(APPEND BSYSTEM_ADDITIONAL_SOURCES BReactor_emscripten.c) 38 | endif () 39 | 40 | set(SYSTEM_SOURCES 41 | BTime.c 42 | ${BSYSTEM_ADDITIONAL_SOURCES} 43 | ) 44 | badvpn_add_library(system "base;flow" "${BSYSTEM_ADDITIONAL_LIBS}" "${SYSTEM_SOURCES}") 45 | -------------------------------------------------------------------------------- /android/jni/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(chunkbuffer2_test chunkbuffer2_test.c) 2 | 3 | add_executable(bproto_test bproto_test.c) 4 | 5 | if (BUILDING_THREADWORK) 6 | add_executable(threadwork_test threadwork_test.c) 7 | target_link_libraries(threadwork_test threadwork) 8 | endif () 9 | -------------------------------------------------------------------------------- /android/jni/tests/bproto_test.bproto: -------------------------------------------------------------------------------- 1 | message msg1 { 2 | required uint16 a = 5; 3 | optional uint32 b = 6; 4 | required repeated uint64 c = 7; 5 | repeated uint16 d = 8; 6 | required uint8 e = 9; 7 | required data f = 10; 8 | required data("4") g = 11; 9 | }; 10 | -------------------------------------------------------------------------------- /android/jni/tests/threadwork_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | BReactor reactor; 10 | BThreadWorkDispatcher twd; 11 | BThreadWork tw1; 12 | BThreadWork tw2; 13 | BThreadWork tw3; 14 | int num_left; 15 | 16 | static void handler_done (void *user) 17 | { 18 | printf("work done\n"); 19 | 20 | num_left--; 21 | 22 | if (num_left == 0) { 23 | printf("all works done, quitting\n"); 24 | BReactor_Quit(&reactor, 0); 25 | } 26 | } 27 | 28 | static void work_func (void *user) 29 | { 30 | unsigned int x = 0; 31 | 32 | for (int i = 0; i < 10000; i++) { 33 | for (int j = 0; j < 10000; j++) { 34 | x++; 35 | } 36 | } 37 | } 38 | 39 | static void dummy_works (int n) 40 | { 41 | for (int i = 0; i < n; i++) { 42 | BThreadWork tw_tmp; 43 | BThreadWork_Init(&tw_tmp, &twd, handler_done, NULL, work_func, NULL); 44 | BThreadWork_Free(&tw_tmp); 45 | } 46 | } 47 | 48 | int main () 49 | { 50 | BLog_InitStdout(); 51 | BLog_SetChannelLoglevel(BLOG_CHANNEL_BThreadWork, BLOG_DEBUG); 52 | 53 | if (!BReactor_Init(&reactor)) { 54 | DEBUG("BReactor_Init failed"); 55 | goto fail1; 56 | } 57 | 58 | if (!BThreadWorkDispatcher_Init(&twd, &reactor, 1)) { 59 | DEBUG("BThreadWorkDispatcher_Init failed"); 60 | goto fail2; 61 | } 62 | 63 | dummy_works(200); 64 | 65 | BThreadWork_Init(&tw1, &twd, handler_done, NULL, work_func, NULL); 66 | 67 | BThreadWork_Init(&tw2, &twd, handler_done, NULL, work_func, NULL); 68 | 69 | BThreadWork_Init(&tw3, &twd, handler_done, NULL, work_func, NULL); 70 | 71 | dummy_works(200); 72 | 73 | num_left = 3; 74 | 75 | BReactor_Exec(&reactor); 76 | 77 | BThreadWork_Free(&tw3); 78 | BThreadWork_Free(&tw2); 79 | BThreadWork_Free(&tw1); 80 | BThreadWorkDispatcher_Free(&twd); 81 | fail2: 82 | BReactor_Free(&reactor); 83 | fail1: 84 | BLog_Free(); 85 | DebugObjectGlobal_Finish(); 86 | return 0; 87 | } 88 | -------------------------------------------------------------------------------- /android/jni/threadwork/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(BADVPN_THREADWORK_EXTRA_LIBS) 2 | if (BADVPN_THREADWORK_USE_PTHREAD) 3 | list(APPEND BADVPN_THREADWORK_EXTRA_LIBS pthread) 4 | endif () 5 | 6 | add_library(threadwork BThreadWork.c) 7 | target_link_libraries(threadwork system ${BADVPN_THREADWORK_EXTRA_LIBS}) 8 | -------------------------------------------------------------------------------- /android/jni/tun2socks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(badvpn-tun2socks 2 | tun2socks.c 3 | SocksUdpGwClient.c 4 | ) 5 | target_link_libraries(badvpn-tun2socks system flow tuntap lwip socksclient udpgw_client) 6 | 7 | install( 8 | TARGETS badvpn-tun2socks 9 | RUNTIME DESTINATION bin 10 | ) 11 | 12 | install( 13 | FILES badvpn-tun2socks.8 14 | DESTINATION share/man/man8 15 | ) 16 | -------------------------------------------------------------------------------- /android/jni/tun2socks/jni/ca/psiphon/Tun2Socks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Psiphon Inc. 3 | * Released under badvpn licence: https://github.com/ambrop72/badvpn#license 4 | */ 5 | 6 | package ca.psiphon; 7 | 8 | public class Tun2Socks { 9 | 10 | // runTun2Socks takes a tun device file descriptor (from Android's VpnService, 11 | // for example) and plugs it into tun2socks, which routes the tun TCP traffic 12 | // through the specified SOCKS proxy. UDP traffic is sent to the specified 13 | // udpgw server. 14 | // 15 | // The tun device file descriptor should be set to non-blocking mode. 16 | // tun2Socks takes ownership of the tun device file descriptor and will close 17 | // it when tun2socks is stopped. 18 | // 19 | // runTun2Socks blocks until tun2socks is stopped by calling terminateTun2Socks. 20 | // It's safe to call terminateTun2Socks from a different thread. 21 | // 22 | // logTun2Socks is called from tun2socks when an event is to be logged. 23 | 24 | private native static int runTun2Socks( 25 | int vpnInterfaceFileDescriptor, 26 | int vpnInterfaceMTU, 27 | String vpnIpAddress, 28 | String vpnNetMask, 29 | String socksServerAddress, 30 | String udpgwServerAddress, 31 | int udpgwTransparentDNS); 32 | 33 | private native static int terminateTun2Socks(); 34 | 35 | public static void logTun2Socks(String level, String channel, String msg) { 36 | } 37 | 38 | static { 39 | System.loadLibrary("tun2socks"); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /android/jni/tunctl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(badvpn-tunctl tunctl.c) 2 | 3 | install( 4 | TARGETS badvpn-tunctl 5 | RUNTIME DESTINATION bin 6 | ) 7 | -------------------------------------------------------------------------------- /android/jni/tuntap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TUNTAP_ADDITIONAL_SOURCES) 2 | if (WIN32) 3 | list(APPEND TUNTAP_ADDITIONAL_SOURCES tapwin32-funcs.c) 4 | endif () 5 | 6 | set(TUNTAP_SOURCES 7 | BTap.c 8 | ${TUNTAP_ADDITIONAL_SOURCES} 9 | ) 10 | badvpn_add_library(tuntap "system;flow" "" "${TUNTAP_SOURCES}") 11 | -------------------------------------------------------------------------------- /android/jni/udevmonitor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(udevmonitor 2 | NCDUdevMonitorParser.c 3 | NCDUdevMonitor.c 4 | NCDUdevCache.c 5 | NCDUdevManager.c 6 | ) 7 | target_link_libraries(udevmonitor system flow stringmap) 8 | -------------------------------------------------------------------------------- /android/jni/udpgw/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(badvpn-udpgw 2 | udpgw.c 3 | ) 4 | target_link_libraries(badvpn-udpgw system flow flowextra) 5 | 6 | install( 7 | TARGETS badvpn-udpgw 8 | RUNTIME DESTINATION bin 9 | ) 10 | -------------------------------------------------------------------------------- /android/jni/udpgw_client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(udpgw_client UdpGwClient.c) 2 | target_link_libraries(udpgw_client system flow flowextra) 3 | -------------------------------------------------------------------------------- /android/libs/armeabi-v7a/libtun2socks.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UWNetworksLab/cordova-plugin-tun2socks/9b686fb3bad6792142425931799b8f7690a932eb/android/libs/armeabi-v7a/libtun2socks.so -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tun2Socks 5 | Tun2Socks for Android 6 | Apache 2.0 7 | cordova,tun2socks,badvpn 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 41 | 42 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /tun2socks.js: -------------------------------------------------------------------------------- 1 | /* globals cordova, window, Promise */ 2 | 3 | window.tun2socks = {}; 4 | 5 | window.tun2socks._genericHandler = function(method, params) { 6 | "use strict"; 7 | var args = Array.prototype.slice.call(arguments, 1); 8 | return new Promise(function(resolve, reject) { 9 | cordova.exec(resolve, reject, "Tun2Socks", method, args); 10 | }); 11 | }; 12 | 13 | module.exports = { 14 | start: window.tun2socks._genericHandler.bind({}, "start"), 15 | stop: window.tun2socks._genericHandler.bind({}, "stop"), 16 | onDisconnect: window.tun2socks._genericHandler.bind({}, "onDisconnect"), 17 | deviceSupportsPlugin: window.tun2socks._genericHandler.bind({}, "deviceSupportsPlugin") 18 | }; 19 | --------------------------------------------------------------------------------