├── .gitignore
├── .gitmodules
├── .idea
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── ottylab
│ │ └── bitzenyminer
│ │ └── MainActivityTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── ottylab
│ │ │ └── bitzenyminer
│ │ │ ├── MainActivity.java
│ │ │ └── Utils.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── ottylab
│ └── bitzenyminer
│ └── UtilsUnitTest.java
├── bitzenymininglibrary
├── .gitignore
├── CMakeLists.txt
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── ottylab
│ │ └── bitzenymininglibrary
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── cpp
│ │ └── bitzenymininglibrary.cpp
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── ottylab
│ │ │ └── bitzenymininglibrary
│ │ │ └── BitZenyMiningLibrary.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── ottylab
│ └── bitzenymininglibrary
│ └── ExampleUnitTest.java
├── build.gradle
├── distribution
├── curl
│ ├── include
│ │ └── curl
│ │ │ ├── curl.h
│ │ │ ├── curlver.h
│ │ │ ├── easy.h
│ │ │ ├── mprintf.h
│ │ │ ├── multi.h
│ │ │ ├── stdcheaders.h
│ │ │ ├── system.h
│ │ │ └── typecheck-gcc.h
│ ├── lib
│ │ ├── arm64-v8a
│ │ │ └── libcurl.a
│ │ ├── armeabi-v7a
│ │ │ └── libcurl.a
│ │ ├── x86
│ │ │ └── libcurl.a
│ │ └── x86_64
│ │ │ └── libcurl.a
│ └── lib19
│ │ ├── armeabi-v7a
│ │ └── libcurl.a
│ │ └── x86
│ │ └── libcurl.a
├── jansson
│ ├── include
│ │ ├── jansson.h
│ │ └── jansson_config.h
│ ├── lib
│ │ ├── arm64-v8a
│ │ │ └── libjansson.a
│ │ ├── armeabi-v7a
│ │ │ └── libjansson.a
│ │ ├── x86
│ │ │ └── libjansson.a
│ │ └── x86_64
│ │ │ └── libjansson.a
│ └── lib19
│ │ ├── armeabi-v7a
│ │ └── libjansson.a
│ │ └── x86
│ │ └── libjansson.a
└── zlib
│ ├── include
│ ├── zconf.h
│ └── zlib.h
│ ├── lib
│ ├── arm64-v8a
│ │ └── libz.a
│ ├── armeabi-v7a
│ │ └── libz.a
│ ├── x86
│ │ └── libz.a
│ └── x86_64
│ │ └── libz.a
│ └── lib19
│ ├── armeabi-v7a
│ └── libz.a
│ └── x86
│ └── libz.a
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # IntelliJ
36 | *.iml
37 | .idea/
38 |
39 | # Keystore files
40 | # Uncomment the following line if you do not want to check your keystore files in.
41 | #*.jks
42 |
43 | # External native build folder generated in Android Studio 2.2 and later
44 | .externalNativeBuild
45 |
46 | # Google Services (e.g. APIs or Firebase)
47 | google-services.json
48 |
49 | # Freeline
50 | freeline.py
51 | freeline/
52 | freeline_project_description.json
53 |
54 | # fastlane
55 | fastlane/report.xml
56 | fastlane/Preview.html
57 | fastlane/screenshots
58 | fastlane/test_output
59 | fastlane/readme.md
60 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "bitzenymininglibrary/src/main/cpp/libcpuminer"]
2 | path = bitzenymininglibrary/src/main/cpp/libcpuminer
3 | url = https://github.com/OttyLab/cpuminer2.git
4 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
16 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BitZeny Miner for Android
2 |
3 | ## Summary
4 | This is a BitZeny Miner for Android based on [cpuminer](https://github.com/bitzeny/cpuminer). cpuminer is modifed to work as a library through JNI.
5 |
6 | ## Environment
7 | NDK r17b
8 |
9 | ## Library
10 |
11 |
12 | ### Constructors
13 |
14 |
15 | ```
16 | public BitZenyMiningLibrary()
17 | ```
18 | ```
19 | public BitZenyMiningLibrary(Handler handler)
20 | ```
21 |
22 | Library `putString` log strings with 'log' tag. Applications can `getString` then use the log strings.
23 |
24 |
25 | ### Methods
26 |
27 | ```
28 | public boolean isMiningRunning()
29 | public int startMining(String url, String user, String password, int n_threads)
30 | public int startBenchmark(int n_threads)
31 | public int stopMining()
32 | ```
33 |
34 | ## Tips
35 |
36 | Library core uses submodule. Therefore, run below commands after clone;
37 |
38 | ```
39 | git submodule init
40 | git submodule update
41 | ```
42 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | applicationId "com.example.ottylab.bitzenyminer"
7 | minSdkVersion 21
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | flavorDimensions 'default'
20 | productFlavors {
21 | standard {
22 | }
23 | kitkat {
24 | minSdkVersion 19
25 | }
26 | }
27 | }
28 |
29 | dependencies {
30 | implementation project(':bitzenymininglibrary')
31 | implementation fileTree(dir: 'libs', include: ['*.jar'])
32 | implementation 'com.android.support:appcompat-v7:26.1.0'
33 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
34 | testImplementation 'junit:junit:4.12'
35 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
36 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
37 | androidTestImplementation 'com.microsoft.appcenter:espresso-test-extension:1.2'
38 | }
39 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/ottylab/bitzenyminer/MainActivityTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ottylab.bitzenyminer;
2 |
3 |
4 | import android.support.test.espresso.ViewInteraction;
5 | import android.support.test.rule.ActivityTestRule;
6 | import android.support.test.runner.AndroidJUnit4;
7 | import android.test.suitebuilder.annotation.LargeTest;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.view.ViewParent;
11 |
12 | import com.microsoft.appcenter.espresso.Factory;
13 | import com.microsoft.appcenter.espresso.ReportHelper;
14 |
15 | import org.hamcrest.Description;
16 | import org.hamcrest.Matcher;
17 | import org.hamcrest.TypeSafeMatcher;
18 | import org.junit.After;
19 | import org.junit.Rule;
20 | import org.junit.Test;
21 | import org.junit.runner.RunWith;
22 |
23 | import static android.support.test.espresso.Espresso.onView;
24 | import static android.support.test.espresso.action.ViewActions.click;
25 | import static android.support.test.espresso.assertion.ViewAssertions.matches;
26 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
27 | import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
28 | import static android.support.test.espresso.matcher.ViewMatchers.withId;
29 | import static android.support.test.espresso.matcher.ViewMatchers.withText;
30 | import static org.hamcrest.Matchers.allOf;
31 | import static org.hamcrest.Matchers.containsString;
32 | import static org.hamcrest.Matchers.is;
33 |
34 | @LargeTest
35 | @RunWith(AndroidJUnit4.class)
36 | public class MainActivityTest {
37 |
38 | @Rule
39 | public ActivityTestRule mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
40 |
41 | @Rule
42 | public ReportHelper reportHelper = Factory.getReportHelper();
43 |
44 | @After
45 | public void TearDown(){
46 | reportHelper.label("Stopping App");
47 | }
48 |
49 | @Test
50 | public void mainActivityTest() {
51 | ViewInteraction appCompatCheckBox = onView(
52 | allOf(withId(R.id.checkBoxBenchmark), withText("Benchmark"),
53 | childAtPosition(
54 | childAtPosition(
55 | withClassName(is("android.widget.LinearLayout")),
56 | 4),
57 | 1),
58 | isDisplayed()));
59 | appCompatCheckBox.perform(click());
60 |
61 | ViewInteraction appCompatButton = onView(
62 | allOf(withId(R.id.buttonDrive), withText("Start"),
63 | childAtPosition(
64 | childAtPosition(
65 | withClassName(is("android.widget.LinearLayout")),
66 | 4),
67 | 0),
68 | isDisplayed()));
69 | appCompatButton.perform(click());
70 |
71 | try{
72 | Thread.sleep(5000);
73 | } catch (InterruptedException e){}
74 |
75 | ViewInteraction textView = onView(
76 | allOf(withId(R.id.textViewLog),
77 | childAtPosition(
78 | childAtPosition(
79 | withId(android.R.id.content),
80 | 0),
81 | 5),
82 | isDisplayed()));
83 | textView.check(matches(withText(containsString("miner threads started, using 'yescrypt' algorithm."))));
84 | }
85 |
86 | private static Matcher childAtPosition(
87 | final Matcher parentMatcher, final int position) {
88 |
89 | return new TypeSafeMatcher() {
90 | @Override
91 | public void describeTo(Description description) {
92 | description.appendText("Child at position " + position + " in parent ");
93 | parentMatcher.describeTo(description);
94 | }
95 |
96 | @Override
97 | public boolean matchesSafely(View view) {
98 | ViewParent parent = view.getParent();
99 | return parent instanceof ViewGroup && parentMatcher.matches(parent)
100 | && view.equals(((ViewGroup) parent).getChildAt(position));
101 | }
102 | };
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ottylab/bitzenyminer/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ottylab.bitzenyminer;
2 |
3 | import android.content.SharedPreferences;
4 | import android.os.Build;
5 | import android.os.Handler;
6 | import android.os.Message;
7 | import android.preference.PreferenceManager;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.os.Bundle;
10 | import android.text.method.ScrollingMovementMethod;
11 | import android.util.Log;
12 | import android.view.View;
13 | import android.widget.AdapterView;
14 | import android.widget.ArrayAdapter;
15 | import android.widget.Button;
16 | import android.widget.CheckBox;
17 | import android.widget.EditText;
18 | import android.widget.Spinner;
19 | import android.widget.TextView;
20 |
21 | import com.example.ottylab.bitzenymininglibrary.BitZenyMiningLibrary;
22 |
23 | import java.lang.ref.WeakReference;
24 | import java.util.concurrent.BlockingQueue;
25 | import java.util.concurrent.LinkedBlockingQueue;
26 |
27 | public class MainActivity extends AppCompatActivity {
28 | private static final String TAG = "BitZenyMiner";
29 | private static final int LOG_LINES = 1000;
30 |
31 | private BitZenyMiningLibrary miner;
32 |
33 | private EditText editTextServer;
34 | private EditText editTextUser;
35 | private EditText editTextPassword;
36 | private EditText editTextNThreads;
37 | private Button buttonDrive;
38 | private CheckBox checkBoxBenchmark;
39 | private Spinner spinnerAlgorithm;
40 | private TextView textViewLog;
41 |
42 | private boolean running;
43 | private BlockingQueue logs = new LinkedBlockingQueue<>(LOG_LINES);
44 |
45 | private static class JNICallbackHandler extends Handler {
46 | private final WeakReference activity;
47 |
48 | public JNICallbackHandler(MainActivity activity) {
49 | this.activity = new WeakReference(activity);
50 | }
51 |
52 | @Override
53 | public void handleMessage(Message msg) {
54 | MainActivity activity = this.activity.get();
55 | if (activity != null) {
56 | String log = msg.getData().getString("log");
57 | String logs = Utils.rotateStringQueue(activity.logs, log);
58 | activity.textViewLog.setText(logs);
59 | Log.d(TAG, log);
60 | }
61 | }
62 | }
63 |
64 | private static JNICallbackHandler sHandler;
65 |
66 | @Override
67 | protected void onCreate(Bundle savedInstanceState) {
68 | super.onCreate(savedInstanceState);
69 | setContentView(R.layout.activity_main);
70 |
71 | showDeviceInfo();
72 |
73 | sHandler = new JNICallbackHandler(this);
74 | miner = new BitZenyMiningLibrary(sHandler);
75 |
76 | editTextServer = (EditText) findViewById(R.id.editTextServer);
77 | editTextServer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
78 | @Override
79 | public void onFocusChange(View view, boolean b) {
80 | storeSetting();
81 | }
82 | });
83 |
84 | editTextUser = (EditText) findViewById(R.id.editTextUser);
85 | editTextUser.setOnFocusChangeListener(new View.OnFocusChangeListener() {
86 | @Override
87 | public void onFocusChange(View view, boolean b) {
88 | storeSetting();
89 | }
90 | });
91 |
92 | editTextPassword= (EditText) findViewById(R.id.editTextPassword);
93 | editTextPassword.setOnFocusChangeListener(new View.OnFocusChangeListener() {
94 | @Override
95 | public void onFocusChange(View view, boolean b) {
96 | storeSetting();
97 | }
98 | });
99 |
100 | editTextNThreads = (EditText) findViewById(R.id.editTextNThreads);
101 | editTextNThreads.setOnFocusChangeListener(new View.OnFocusChangeListener() {
102 | @Override
103 | public void onFocusChange(View view, boolean b) {
104 | storeSetting();
105 | }
106 | });
107 |
108 | buttonDrive = (Button) findViewById(R.id.buttonDrive);
109 | buttonDrive.setOnClickListener(new View.OnClickListener() {
110 | @Override
111 | public void onClick(View view) {
112 | if (running) {
113 | Log.d(TAG, "Stop");
114 | miner.stopMining();
115 | } else {
116 | Log.d(TAG, "Start");
117 | int n_threads = 0;
118 | try {
119 | n_threads = Integer.parseInt(editTextNThreads.getText().toString());
120 | } catch (NumberFormatException e){}
121 |
122 | BitZenyMiningLibrary.Algorithm algorithm =
123 | spinnerAlgorithm.getSelectedItemPosition() == 0 ?
124 | BitZenyMiningLibrary.Algorithm.YESCRYPT : BitZenyMiningLibrary.Algorithm.YESPOWER;
125 | if (checkBoxBenchmark.isChecked()) {
126 | miner.startBenchmark(n_threads, algorithm);
127 | } else {
128 | miner.startMining(
129 | editTextServer.getText().toString(),
130 | editTextUser.getText().toString(),
131 | editTextPassword.getText().toString(),
132 | n_threads,
133 | algorithm);
134 | }
135 | }
136 |
137 | changeState(!running);
138 | storeSetting();
139 | }
140 | });
141 |
142 | checkBoxBenchmark = (CheckBox) findViewById(R.id.checkBoxBenchmark);
143 | spinnerAlgorithm = (Spinner) findViewById(R.id.spinnerAlgorithm);
144 | ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.algorithms, android.R.layout.simple_spinner_item);
145 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
146 | spinnerAlgorithm.setAdapter(adapter);
147 |
148 | textViewLog = (TextView) findViewById(R.id.textViewLog);
149 | textViewLog.setMovementMethod(new ScrollingMovementMethod());
150 |
151 | restoreSetting();
152 | changeState(miner.isMiningRunning());
153 | }
154 |
155 | private void changeState(boolean running) {
156 | buttonDrive.setText(running ? "Stop" : "Start");
157 | disableSetting(running);
158 | this.running = running;
159 | }
160 |
161 | private void disableSetting(boolean running) {
162 | editTextServer.setEnabled(!running);
163 | editTextUser.setEnabled(!running);
164 | editTextPassword.setEnabled(!running);
165 | editTextNThreads.setEnabled(!running);
166 | spinnerAlgorithm.setEnabled(!running);
167 | }
168 |
169 | private void storeSetting() {
170 | SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
171 | SharedPreferences.Editor editor = pref.edit();
172 | editor.putString("server", editTextServer.getText().toString());
173 | editor.putString("user", editTextUser.getText().toString());
174 | editor.putString("password", editTextPassword.getText().toString());
175 | editor.putString("n_threads", editTextNThreads.getText().toString());
176 | editor.putInt("algorithm", spinnerAlgorithm.getSelectedItemPosition());
177 | editor.commit();
178 | }
179 |
180 | private void restoreSetting() {
181 | SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
182 | editTextServer.setText(pref.getString("server", null));
183 | editTextUser.setText(pref.getString("user", null));
184 | editTextPassword.setText(pref.getString("password", null));
185 | editTextNThreads.setText(pref.getString("n_threads", null));
186 | spinnerAlgorithm.setSelection(pref.getInt("algorithm", 0));
187 | }
188 |
189 | private void showDeviceInfo() {
190 | String[] keys = new String[]{ "os.arch", "os.name", "os.version" };
191 | for (String key : keys) {
192 | Log.d(TAG, key + ": " + System.getProperty(key));
193 | }
194 | Log.d(TAG, "CODE NAME: " + Build.VERSION.CODENAME);
195 | Log.d(TAG, "SDK INT: " + Build.VERSION.SDK_INT);
196 | Log.d(TAG, "MANUFACTURER: " + Build.MANUFACTURER);
197 | Log.d(TAG, "MODEL: " + Build.MODEL);
198 | Log.d(TAG, "PRODUCT: " + Build.PRODUCT);
199 | }
200 | }
201 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ottylab/bitzenyminer/Utils.java:
--------------------------------------------------------------------------------
1 | package com.example.ottylab.bitzenyminer;
2 |
3 | import java.util.concurrent.BlockingQueue;
4 |
5 | /**
6 | * Created by ochikage on 2018/02/18.
7 | */
8 |
9 | public class Utils {
10 | public static String rotateStringQueue(BlockingQueue queue, String next) {
11 | while (!queue.offer(next)) {
12 | try {
13 | queue.take();
14 | } catch (InterruptedException e){
15 | ;
16 | }
17 | }
18 |
19 | StringBuilder logs = new StringBuilder();
20 | for (String element: queue) {
21 | logs.append(element);
22 | }
23 |
24 | return logs.toString();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
23 |
24 |
37 |
38 |
51 |
52 |
65 |
66 |
70 |
71 |
80 |
81 |
90 |
91 |
97 |
98 |
99 |
111 |
112 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BitZenyMiner
3 |
4 | - yescrypt
5 | - yespower
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/ottylab/bitzenyminer/UtilsUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ottylab.bitzenyminer;
2 |
3 |
4 | import junit.framework.Assert;
5 |
6 | import org.junit.Test;
7 |
8 | import java.util.concurrent.BlockingQueue;
9 | import java.util.concurrent.LinkedBlockingQueue;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Example local unit test, which will execute on the development machine (host).
15 | *
16 | * @see Testing documentation
17 | */
18 | public class UtilsUnitTest {
19 | @Test
20 | public void testLogQueue() throws Exception {
21 | final int CAPACITY = 10;
22 |
23 | BlockingQueue queue = new LinkedBlockingQueue<>(CAPACITY);
24 | for (int i = 0; i < CAPACITY * 10; i++) {
25 | String output = Utils.rotateStringQueue(queue, String.valueOf(i));
26 |
27 | int j = 0;
28 | for (String element: queue) {
29 | int expected = ((i < CAPACITY) ? 0 : i - CAPACITY + 1) + (j++);
30 | Assert.assertEquals(String.valueOf(expected), element);
31 | }
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/bitzenymininglibrary/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/bitzenymininglibrary/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.4.1)
2 |
3 | # Include sub directory
4 | add_subdirectory(${CMAKE_SOURCE_DIR}/src/main/cpp/libcpuminer)
5 |
6 | add_library(
7 | bitzenymininglibrary
8 | SHARED
9 | src/main/cpp/bitzenymininglibrary.cpp)
10 |
11 | find_library(
12 | log-lib
13 | log)
14 |
15 | target_link_libraries(
16 | bitzenymininglibrary
17 | ${log-lib}
18 | cpuminer)
19 |
20 |
--------------------------------------------------------------------------------
/bitzenymininglibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | minSdkVersion 21
7 | targetSdkVersion 26
8 | versionCode 1
9 | versionName "1.0"
10 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
11 | externalNativeBuild {
12 | cmake {
13 | cppFlags "-fexceptions"
14 | arguments "-DTARGET=STANDARD"
15 | }
16 | }
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | publishNonDefault true
25 | flavorDimensions 'default'
26 | productFlavors {
27 | standard {
28 | dimension 'default'
29 | ndk {
30 | abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
31 | }
32 | }
33 | kitkat {
34 | dimension 'default'
35 | minSdkVersion 19
36 | externalNativeBuild {
37 | cmake {
38 | cFlags "-D__KITKAT__"
39 | arguments "-DTARGET=__KITKAT__"
40 | }
41 | }
42 | ndk {
43 | abiFilters 'armeabi-v7a', 'x86'
44 | }
45 | }
46 | }
47 | externalNativeBuild {
48 | cmake {
49 | path "CMakeLists.txt"
50 | }
51 | }
52 |
53 | }
54 |
55 | dependencies {
56 | implementation fileTree(dir: 'libs', include: ['*.jar'])
57 | implementation 'com.android.support:appcompat-v7:26.1.0'
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
61 | }
62 |
--------------------------------------------------------------------------------
/bitzenymininglibrary/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/bitzenymininglibrary/src/androidTest/java/com/example/ottylab/bitzenymininglibrary/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ottylab.bitzenymininglibrary;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.ottylab.bitzenymininglibrary.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bitzenymininglibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/bitzenymininglibrary/src/main/cpp/bitzenymininglibrary.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "libcpuminer/libcpuminer.h"
5 |
6 | #define Log(...) \
7 | ((void)__android_log_print(ANDROID_LOG_INFO, "native: ", __VA_ARGS__))
8 |
9 | JavaVM *g_jvm;
10 | jclass g_class;
11 |
12 | extern "C"
13 | void vprintf_app(const char *format, va_list arg) {
14 | char msg[1024]; //TODO: may cause buffer overflow
15 | vsprintf(msg, format, arg);
16 |
17 | JNIEnv *env;
18 | int is_detach_requred = 0;
19 |
20 | g_jvm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6);
21 | if (!env) {
22 | g_jvm->AttachCurrentThread(&env, NULL);
23 | is_detach_requred = 1;
24 | }
25 |
26 | jstring smsg = env->NewStringUTF(msg);
27 | jmethodID mid = env->GetStaticMethodID(g_class, "output", "(Ljava/lang/String;)V");
28 | env->CallStaticVoidMethod(g_class, mid, smsg);
29 |
30 | if (is_detach_requred) {
31 | g_jvm->DetachCurrentThread();
32 | }
33 | }
34 |
35 | JNIEXPORT jint
36 | JNICALL
37 | JNI_OnLoad(JavaVM *vm, void *reserved) {
38 | Log("JNI_OnLoad");
39 | g_jvm = vm;
40 |
41 | JNIEnv *env;
42 | if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) {
43 | return -1;
44 | }
45 |
46 | jclass clazz = env->FindClass("com/example/ottylab/bitzenymininglibrary/BitZenyMiningLibrary");
47 | g_class = (jclass) env->NewGlobalRef(clazz);
48 |
49 | init(vprintf_app);
50 |
51 | return JNI_VERSION_1_6;
52 | }
53 |
54 | extern "C"
55 | JNIEXPORT jint
56 | JNICALL
57 | Java_com_example_ottylab_bitzenymininglibrary_BitZenyMiningLibrary_initMining(
58 | JNIEnv *env,
59 | jobject /* this */) {
60 | Log("initMining");
61 | return init(vprintf_app);
62 | }
63 |
64 | extern "C"
65 | JNIEXPORT jboolean
66 | JNICALL
67 | Java_com_example_ottylab_bitzenymininglibrary_BitZenyMiningLibrary_isMiningRunning(
68 | JNIEnv *env,
69 | jobject /* this */) {
70 | Log("isMiningRunning");
71 | return (jboolean) is_running();
72 | }
73 |
74 | extern "C"
75 | JNIEXPORT jint
76 | JNICALL
77 | Java_com_example_ottylab_bitzenymininglibrary_BitZenyMiningLibrary_startMining(
78 | JNIEnv *env,
79 | jobject /* this */,
80 | jstring url,
81 | jstring user,
82 | jstring password,
83 | jint n_threads,
84 | jint algo) {
85 | Log("startMining");
86 |
87 | const char *c_url = env->GetStringUTFChars(url, NULL);
88 | const char *c_user = env->GetStringUTFChars(user, NULL);
89 | const char *c_password = env->GetStringUTFChars(password, NULL);
90 |
91 | int result = start(c_url, c_user, c_password, n_threads, algo);
92 |
93 | env->ReleaseStringUTFChars(url, c_url);
94 | env->ReleaseStringUTFChars(user, c_user);
95 | env->ReleaseStringUTFChars(password, c_password);
96 |
97 | return result;
98 | }
99 | extern "C"
100 | JNIEXPORT jint
101 | JNICALL
102 | Java_com_example_ottylab_bitzenymininglibrary_BitZenyMiningLibrary_startBenchmark(
103 | JNIEnv *env,
104 | jobject /* this */,
105 | jint n_threads,
106 | jint algo = 0) {
107 | Log("startBenchmark");
108 | return start(NULL, NULL, NULL, n_threads, algo);
109 | }
110 |
111 |
112 | extern "C"
113 | JNIEXPORT jint
114 | JNICALL
115 | Java_com_example_ottylab_bitzenymininglibrary_BitZenyMiningLibrary_stopMining(
116 | JNIEnv *env,
117 | jobject /* this */) {
118 | Log("stopMining");
119 | return stop();
120 | }
121 |
--------------------------------------------------------------------------------
/bitzenymininglibrary/src/main/java/com/example/ottylab/bitzenymininglibrary/BitZenyMiningLibrary.java:
--------------------------------------------------------------------------------
1 | package com.example.ottylab.bitzenymininglibrary;
2 |
3 | import android.os.Bundle;
4 | import android.os.Handler;
5 | import android.os.Message;
6 |
7 | public class BitZenyMiningLibrary {
8 | private static final String TAG = "BitZenyMiningLibrary";
9 |
10 | static {
11 | System.loadLibrary("bitzenymininglibrary");
12 | }
13 |
14 | public enum Algorithm {
15 | YESCRYPT,
16 | YESPOWER,
17 | }
18 |
19 | private static Handler sHandler;
20 |
21 | public BitZenyMiningLibrary() {}
22 | public BitZenyMiningLibrary(Handler handler) {
23 | sHandler = handler;
24 | }
25 | public int startMining(String url, String user, String password, int n_threads, Algorithm algo) {
26 | switch (algo) {
27 | case YESCRYPT:
28 | return startMining(url, user, password, n_threads, 0);
29 | case YESPOWER:
30 | return startMining(url, user, password, n_threads, 1);
31 | default:
32 | return -1;
33 | }
34 | }
35 |
36 | public int startBenchmark(int n_threads, Algorithm algo) {
37 | switch (algo) {
38 | case YESCRYPT:
39 | return startBenchmark(n_threads, 0);
40 | case YESPOWER:
41 | return startBenchmark(n_threads, 1);
42 | default:
43 | return -1;
44 | }
45 | }
46 |
47 | private static void output(String message) {
48 | // Generate message
49 | Message msg = new Message();
50 | Bundle bundle = new Bundle();
51 | bundle.putString("log", message);
52 | msg.setData(bundle);
53 |
54 | if (sHandler != null) {
55 | sHandler.sendMessage(msg);
56 | }
57 | }
58 |
59 | public native boolean isMiningRunning();
60 | public native int stopMining();
61 | private native int startMining(String url, String user, String password, int n_threads, int algo);
62 | private native int startBenchmark(int n_threads, int algo);
63 | }
--------------------------------------------------------------------------------
/bitzenymininglibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BitzenyMiningLibrary
3 |
4 |
--------------------------------------------------------------------------------
/bitzenymininglibrary/src/test/java/com/example/ottylab/bitzenymininglibrary/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ottylab.bitzenymininglibrary;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.3'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/distribution/curl/include/curl/curlver.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_CURLVER_H
2 | #define __CURL_CURLVER_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /* This header file contains nothing but libcurl version info, generated by
26 | a script at release-time. This was made its own header file in 7.11.2 */
27 |
28 | /* This is the global package copyright */
29 | #define LIBCURL_COPYRIGHT "1996 - 2017 Daniel Stenberg, ."
30 |
31 | /* This is the version number of the libcurl package from which this header
32 | file origins: */
33 | #define LIBCURL_VERSION "7.57.0"
34 |
35 | /* The numeric version number is also available "in parts" by using these
36 | defines: */
37 | #define LIBCURL_VERSION_MAJOR 7
38 | #define LIBCURL_VERSION_MINOR 57
39 | #define LIBCURL_VERSION_PATCH 0
40 |
41 | /* This is the numeric version of the libcurl version number, meant for easier
42 | parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
43 | always follow this syntax:
44 |
45 | 0xXXYYZZ
46 |
47 | Where XX, YY and ZZ are the main version, release and patch numbers in
48 | hexadecimal (using 8 bits each). All three numbers are always represented
49 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7
50 | appears as "0x090b07".
51 |
52 | This 6-digit (24 bits) hexadecimal number does not show pre-release number,
53 | and it is always a greater number in a more recent release. It makes
54 | comparisons with greater than and less than work.
55 |
56 | Note: This define is the full hex number and _does not_ use the
57 | CURL_VERSION_BITS() macro since curl's own configure script greps for it
58 | and needs it to contain the full number.
59 | */
60 | #define LIBCURL_VERSION_NUM 0x073900
61 |
62 | /*
63 | * This is the date and time when the full source package was created. The
64 | * timestamp is not stored in git, as the timestamp is properly set in the
65 | * tarballs by the maketgz script.
66 | *
67 | * The format of the date follows this template:
68 | *
69 | * "2007-11-23"
70 | */
71 | #define LIBCURL_TIMESTAMP "2017-11-29"
72 |
73 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
74 | #define CURL_AT_LEAST_VERSION(x,y,z) \
75 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
76 |
77 | #endif /* __CURL_CURLVER_H */
78 |
--------------------------------------------------------------------------------
/distribution/curl/include/curl/easy.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_EASY_H
2 | #define __CURL_EASY_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | CURL_EXTERN CURL *curl_easy_init(void);
29 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
30 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
31 | CURL_EXTERN void curl_easy_cleanup(CURL *curl);
32 |
33 | /*
34 | * NAME curl_easy_getinfo()
35 | *
36 | * DESCRIPTION
37 | *
38 | * Request internal information from the curl session with this function. The
39 | * third argument MUST be a pointer to a long, a pointer to a char * or a
40 | * pointer to a double (as the documentation describes elsewhere). The data
41 | * pointed to will be filled in accordingly and can be relied upon only if the
42 | * function returns CURLE_OK. This function is intended to get used *AFTER* a
43 | * performed transfer, all results from this function are undefined until the
44 | * transfer is completed.
45 | */
46 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
47 |
48 |
49 | /*
50 | * NAME curl_easy_duphandle()
51 | *
52 | * DESCRIPTION
53 | *
54 | * Creates a new curl session handle with the same options set for the handle
55 | * passed in. Duplicating a handle could only be a matter of cloning data and
56 | * options, internal state info and things like persistent connections cannot
57 | * be transferred. It is useful in multithreaded applications when you can run
58 | * curl_easy_duphandle() for each new thread to avoid a series of identical
59 | * curl_easy_setopt() invokes in every thread.
60 | */
61 | CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
62 |
63 | /*
64 | * NAME curl_easy_reset()
65 | *
66 | * DESCRIPTION
67 | *
68 | * Re-initializes a CURL handle to the default values. This puts back the
69 | * handle to the same state as it was in when it was just created.
70 | *
71 | * It does keep: live connections, the Session ID cache, the DNS cache and the
72 | * cookies.
73 | */
74 | CURL_EXTERN void curl_easy_reset(CURL *curl);
75 |
76 | /*
77 | * NAME curl_easy_recv()
78 | *
79 | * DESCRIPTION
80 | *
81 | * Receives data from the connected socket. Use after successful
82 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
83 | */
84 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
85 | size_t *n);
86 |
87 | /*
88 | * NAME curl_easy_send()
89 | *
90 | * DESCRIPTION
91 | *
92 | * Sends data over the connected socket. Use after successful
93 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
94 | */
95 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
96 | size_t buflen, size_t *n);
97 |
98 | #ifdef __cplusplus
99 | }
100 | #endif
101 |
102 | #endif
103 |
--------------------------------------------------------------------------------
/distribution/curl/include/curl/mprintf.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_MPRINTF_H
2 | #define __CURL_MPRINTF_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | #include
26 | #include /* needed for FILE */
27 | #include "curl.h" /* for CURL_EXTERN */
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 |
33 | CURL_EXTERN int curl_mprintf(const char *format, ...);
34 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
35 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
36 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
37 | const char *format, ...);
38 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
39 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
40 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
41 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
42 | const char *format, va_list args);
43 | CURL_EXTERN char *curl_maprintf(const char *format, ...);
44 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif /* __CURL_MPRINTF_H */
51 |
--------------------------------------------------------------------------------
/distribution/curl/include/curl/multi.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_MULTI_H
2 | #define __CURL_MULTI_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 | /*
25 | This is an "external" header file. Don't give away any internals here!
26 |
27 | GOALS
28 |
29 | o Enable a "pull" interface. The application that uses libcurl decides where
30 | and when to ask libcurl to get/send data.
31 |
32 | o Enable multiple simultaneous transfers in the same thread without making it
33 | complicated for the application.
34 |
35 | o Enable the application to select() on its own file descriptors and curl's
36 | file descriptors simultaneous easily.
37 |
38 | */
39 |
40 | /*
41 | * This header file should not really need to include "curl.h" since curl.h
42 | * itself includes this file and we expect user applications to do #include
43 | * without the need for especially including multi.h.
44 | *
45 | * For some reason we added this include here at one point, and rather than to
46 | * break existing (wrongly written) libcurl applications, we leave it as-is
47 | * but with this warning attached.
48 | */
49 | #include "curl.h"
50 |
51 | #ifdef __cplusplus
52 | extern "C" {
53 | #endif
54 |
55 | #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
56 | typedef struct Curl_multi CURLM;
57 | #else
58 | typedef void CURLM;
59 | #endif
60 |
61 | typedef enum {
62 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
63 | curl_multi_socket*() soon */
64 | CURLM_OK,
65 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
66 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
67 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
68 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
69 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
70 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
71 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
72 | attempted to get added - again */
73 | CURLM_LAST
74 | } CURLMcode;
75 |
76 | /* just to make code nicer when using curl_multi_socket() you can now check
77 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for
78 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
79 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
80 |
81 | /* bitmask bits for CURLMOPT_PIPELINING */
82 | #define CURLPIPE_NOTHING 0L
83 | #define CURLPIPE_HTTP1 1L
84 | #define CURLPIPE_MULTIPLEX 2L
85 |
86 | typedef enum {
87 | CURLMSG_NONE, /* first, not used */
88 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains
89 | the CURLcode of the transfer */
90 | CURLMSG_LAST /* last, not used */
91 | } CURLMSG;
92 |
93 | struct CURLMsg {
94 | CURLMSG msg; /* what this message means */
95 | CURL *easy_handle; /* the handle it concerns */
96 | union {
97 | void *whatever; /* message-specific data */
98 | CURLcode result; /* return code for transfer */
99 | } data;
100 | };
101 | typedef struct CURLMsg CURLMsg;
102 |
103 | /* Based on poll(2) structure and values.
104 | * We don't use pollfd and POLL* constants explicitly
105 | * to cover platforms without poll(). */
106 | #define CURL_WAIT_POLLIN 0x0001
107 | #define CURL_WAIT_POLLPRI 0x0002
108 | #define CURL_WAIT_POLLOUT 0x0004
109 |
110 | struct curl_waitfd {
111 | curl_socket_t fd;
112 | short events;
113 | short revents; /* not supported yet */
114 | };
115 |
116 | /*
117 | * Name: curl_multi_init()
118 | *
119 | * Desc: inititalize multi-style curl usage
120 | *
121 | * Returns: a new CURLM handle to use in all 'curl_multi' functions.
122 | */
123 | CURL_EXTERN CURLM *curl_multi_init(void);
124 |
125 | /*
126 | * Name: curl_multi_add_handle()
127 | *
128 | * Desc: add a standard curl handle to the multi stack
129 | *
130 | * Returns: CURLMcode type, general multi error code.
131 | */
132 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
133 | CURL *curl_handle);
134 |
135 | /*
136 | * Name: curl_multi_remove_handle()
137 | *
138 | * Desc: removes a curl handle from the multi stack again
139 | *
140 | * Returns: CURLMcode type, general multi error code.
141 | */
142 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
143 | CURL *curl_handle);
144 |
145 | /*
146 | * Name: curl_multi_fdset()
147 | *
148 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or
149 | * poll() on. We want curl_multi_perform() called as soon as one of
150 | * them are ready.
151 | *
152 | * Returns: CURLMcode type, general multi error code.
153 | */
154 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
155 | fd_set *read_fd_set,
156 | fd_set *write_fd_set,
157 | fd_set *exc_fd_set,
158 | int *max_fd);
159 |
160 | /*
161 | * Name: curl_multi_wait()
162 | *
163 | * Desc: Poll on all fds within a CURLM set as well as any
164 | * additional fds passed to the function.
165 | *
166 | * Returns: CURLMcode type, general multi error code.
167 | */
168 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
169 | struct curl_waitfd extra_fds[],
170 | unsigned int extra_nfds,
171 | int timeout_ms,
172 | int *ret);
173 |
174 | /*
175 | * Name: curl_multi_perform()
176 | *
177 | * Desc: When the app thinks there's data available for curl it calls this
178 | * function to read/write whatever there is right now. This returns
179 | * as soon as the reads and writes are done. This function does not
180 | * require that there actually is data available for reading or that
181 | * data can be written, it can be called just in case. It returns
182 | * the number of handles that still transfer data in the second
183 | * argument's integer-pointer.
184 | *
185 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only
186 | * returns errors etc regarding the whole multi stack. There might
187 | * still have occurred problems on invidual transfers even when this
188 | * returns OK.
189 | */
190 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
191 | int *running_handles);
192 |
193 | /*
194 | * Name: curl_multi_cleanup()
195 | *
196 | * Desc: Cleans up and removes a whole multi stack. It does not free or
197 | * touch any individual easy handles in any way. We need to define
198 | * in what state those handles will be if this function is called
199 | * in the middle of a transfer.
200 | *
201 | * Returns: CURLMcode type, general multi error code.
202 | */
203 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
204 |
205 | /*
206 | * Name: curl_multi_info_read()
207 | *
208 | * Desc: Ask the multi handle if there's any messages/informationals from
209 | * the individual transfers. Messages include informationals such as
210 | * error code from the transfer or just the fact that a transfer is
211 | * completed. More details on these should be written down as well.
212 | *
213 | * Repeated calls to this function will return a new struct each
214 | * time, until a special "end of msgs" struct is returned as a signal
215 | * that there is no more to get at this point.
216 | *
217 | * The data the returned pointer points to will not survive calling
218 | * curl_multi_cleanup().
219 | *
220 | * The 'CURLMsg' struct is meant to be very simple and only contain
221 | * very basic information. If more involved information is wanted,
222 | * we will provide the particular "transfer handle" in that struct
223 | * and that should/could/would be used in subsequent
224 | * curl_easy_getinfo() calls (or similar). The point being that we
225 | * must never expose complex structs to applications, as then we'll
226 | * undoubtably get backwards compatibility problems in the future.
227 | *
228 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
229 | * of structs. It also writes the number of messages left in the
230 | * queue (after this read) in the integer the second argument points
231 | * to.
232 | */
233 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
234 | int *msgs_in_queue);
235 |
236 | /*
237 | * Name: curl_multi_strerror()
238 | *
239 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode
240 | * value into the equivalent human readable error string. This is
241 | * useful for printing meaningful error messages.
242 | *
243 | * Returns: A pointer to a zero-terminated error message.
244 | */
245 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
246 |
247 | /*
248 | * Name: curl_multi_socket() and
249 | * curl_multi_socket_all()
250 | *
251 | * Desc: An alternative version of curl_multi_perform() that allows the
252 | * application to pass in one of the file descriptors that have been
253 | * detected to have "action" on them and let libcurl perform.
254 | * See man page for details.
255 | */
256 | #define CURL_POLL_NONE 0
257 | #define CURL_POLL_IN 1
258 | #define CURL_POLL_OUT 2
259 | #define CURL_POLL_INOUT 3
260 | #define CURL_POLL_REMOVE 4
261 |
262 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
263 |
264 | #define CURL_CSELECT_IN 0x01
265 | #define CURL_CSELECT_OUT 0x02
266 | #define CURL_CSELECT_ERR 0x04
267 |
268 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
269 | curl_socket_t s, /* socket */
270 | int what, /* see above */
271 | void *userp, /* private callback
272 | pointer */
273 | void *socketp); /* private socket
274 | pointer */
275 | /*
276 | * Name: curl_multi_timer_callback
277 | *
278 | * Desc: Called by libcurl whenever the library detects a change in the
279 | * maximum number of milliseconds the app is allowed to wait before
280 | * curl_multi_socket() or curl_multi_perform() must be called
281 | * (to allow libcurl's timed events to take place).
282 | *
283 | * Returns: The callback should return zero.
284 | */
285 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
286 | long timeout_ms, /* see above */
287 | void *userp); /* private callback
288 | pointer */
289 |
290 | CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
291 | int *running_handles);
292 |
293 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
294 | curl_socket_t s,
295 | int ev_bitmask,
296 | int *running_handles);
297 |
298 | CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
299 | int *running_handles);
300 |
301 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET
302 | /* This macro below was added in 7.16.3 to push users who recompile to use
303 | the new curl_multi_socket_action() instead of the old curl_multi_socket()
304 | */
305 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
306 | #endif
307 |
308 | /*
309 | * Name: curl_multi_timeout()
310 | *
311 | * Desc: Returns the maximum number of milliseconds the app is allowed to
312 | * wait before curl_multi_socket() or curl_multi_perform() must be
313 | * called (to allow libcurl's timed events to take place).
314 | *
315 | * Returns: CURLM error code.
316 | */
317 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
318 | long *milliseconds);
319 |
320 | #undef CINIT /* re-using the same name as in curl.h */
321 |
322 | #ifdef CURL_ISOCPP
323 | #define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
324 | #else
325 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
326 | #define LONG CURLOPTTYPE_LONG
327 | #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
328 | #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
329 | #define OFF_T CURLOPTTYPE_OFF_T
330 | #define CINIT(name,type,number) CURLMOPT_/**/name = type + number
331 | #endif
332 |
333 | typedef enum {
334 | /* This is the socket callback function pointer */
335 | CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
336 |
337 | /* This is the argument passed to the socket callback */
338 | CINIT(SOCKETDATA, OBJECTPOINT, 2),
339 |
340 | /* set to 1 to enable pipelining for this multi handle */
341 | CINIT(PIPELINING, LONG, 3),
342 |
343 | /* This is the timer callback function pointer */
344 | CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
345 |
346 | /* This is the argument passed to the timer callback */
347 | CINIT(TIMERDATA, OBJECTPOINT, 5),
348 |
349 | /* maximum number of entries in the connection cache */
350 | CINIT(MAXCONNECTS, LONG, 6),
351 |
352 | /* maximum number of (pipelining) connections to one host */
353 | CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
354 |
355 | /* maximum number of requests in a pipeline */
356 | CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
357 |
358 | /* a connection with a content-length longer than this
359 | will not be considered for pipelining */
360 | CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
361 |
362 | /* a connection with a chunk length longer than this
363 | will not be considered for pipelining */
364 | CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
365 |
366 | /* a list of site names(+port) that are blacklisted from
367 | pipelining */
368 | CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
369 |
370 | /* a list of server types that are blacklisted from
371 | pipelining */
372 | CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
373 |
374 | /* maximum number of open connections in total */
375 | CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
376 |
377 | /* This is the server push callback function pointer */
378 | CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
379 |
380 | /* This is the argument passed to the server push callback */
381 | CINIT(PUSHDATA, OBJECTPOINT, 15),
382 |
383 | CURLMOPT_LASTENTRY /* the last unused */
384 | } CURLMoption;
385 |
386 |
387 | /*
388 | * Name: curl_multi_setopt()
389 | *
390 | * Desc: Sets options for the multi handle.
391 | *
392 | * Returns: CURLM error code.
393 | */
394 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
395 | CURLMoption option, ...);
396 |
397 |
398 | /*
399 | * Name: curl_multi_assign()
400 | *
401 | * Desc: This function sets an association in the multi handle between the
402 | * given socket and a private pointer of the application. This is
403 | * (only) useful for curl_multi_socket uses.
404 | *
405 | * Returns: CURLM error code.
406 | */
407 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
408 | curl_socket_t sockfd, void *sockp);
409 |
410 |
411 | /*
412 | * Name: curl_push_callback
413 | *
414 | * Desc: This callback gets called when a new stream is being pushed by the
415 | * server. It approves or denies the new stream.
416 | *
417 | * Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
418 | */
419 | #define CURL_PUSH_OK 0
420 | #define CURL_PUSH_DENY 1
421 |
422 | struct curl_pushheaders; /* forward declaration only */
423 |
424 | CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
425 | size_t num);
426 | CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
427 | const char *name);
428 |
429 | typedef int (*curl_push_callback)(CURL *parent,
430 | CURL *easy,
431 | size_t num_headers,
432 | struct curl_pushheaders *headers,
433 | void *userp);
434 |
435 | #ifdef __cplusplus
436 | } /* end of extern "C" */
437 | #endif
438 |
439 | #endif
440 |
--------------------------------------------------------------------------------
/distribution/curl/include/curl/stdcheaders.h:
--------------------------------------------------------------------------------
1 | #ifndef __STDC_HEADERS_H
2 | #define __STDC_HEADERS_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | #include
26 |
27 | size_t fread(void *, size_t, size_t, FILE *);
28 | size_t fwrite(const void *, size_t, size_t, FILE *);
29 |
30 | int strcasecmp(const char *, const char *);
31 | int strncasecmp(const char *, const char *, size_t);
32 |
33 | #endif /* __STDC_HEADERS_H */
34 |
--------------------------------------------------------------------------------
/distribution/curl/include/curl/system.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_SYSTEM_H
2 | #define __CURL_SYSTEM_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /*
26 | * Try to keep one section per platform, compiler and architecture, otherwise,
27 | * if an existing section is reused for a different one and later on the
28 | * original is adjusted, probably the piggybacking one can be adversely
29 | * changed.
30 | *
31 | * In order to differentiate between platforms/compilers/architectures use
32 | * only compiler built in predefined preprocessor symbols.
33 | *
34 | * curl_off_t
35 | * ----------
36 | *
37 | * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
38 | * wide signed integral data type. The width of this data type must remain
39 | * constant and independent of any possible large file support settings.
40 | *
41 | * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
42 | * wide signed integral data type if there is no 64-bit type.
43 | *
44 | * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
45 | * only be violated if off_t is the only 64-bit data type available and the
46 | * size of off_t is independent of large file support settings. Keep your
47 | * build on the safe side avoiding an off_t gating. If you have a 64-bit
48 | * off_t then take for sure that another 64-bit data type exists, dig deeper
49 | * and you will find it.
50 | *
51 | */
52 |
53 | #if defined(__DJGPP__) || defined(__GO32__)
54 | # if defined(__DJGPP__) && (__DJGPP__ > 1)
55 | # define CURL_TYPEOF_CURL_OFF_T long long
56 | # define CURL_FORMAT_CURL_OFF_T "lld"
57 | # define CURL_FORMAT_CURL_OFF_TU "llu"
58 | # define CURL_SUFFIX_CURL_OFF_T LL
59 | # define CURL_SUFFIX_CURL_OFF_TU ULL
60 | # else
61 | # define CURL_TYPEOF_CURL_OFF_T long
62 | # define CURL_FORMAT_CURL_OFF_T "ld"
63 | # define CURL_FORMAT_CURL_OFF_TU "lu"
64 | # define CURL_SUFFIX_CURL_OFF_T L
65 | # define CURL_SUFFIX_CURL_OFF_TU UL
66 | # endif
67 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
68 |
69 | #elif defined(__SALFORDC__)
70 | # define CURL_TYPEOF_CURL_OFF_T long
71 | # define CURL_FORMAT_CURL_OFF_T "ld"
72 | # define CURL_FORMAT_CURL_OFF_TU "lu"
73 | # define CURL_SUFFIX_CURL_OFF_T L
74 | # define CURL_SUFFIX_CURL_OFF_TU UL
75 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
76 |
77 | #elif defined(__BORLANDC__)
78 | # if (__BORLANDC__ < 0x520)
79 | # define CURL_TYPEOF_CURL_OFF_T long
80 | # define CURL_FORMAT_CURL_OFF_T "ld"
81 | # define CURL_FORMAT_CURL_OFF_TU "lu"
82 | # define CURL_SUFFIX_CURL_OFF_T L
83 | # define CURL_SUFFIX_CURL_OFF_TU UL
84 | # else
85 | # define CURL_TYPEOF_CURL_OFF_T __int64
86 | # define CURL_FORMAT_CURL_OFF_T "I64d"
87 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
88 | # define CURL_SUFFIX_CURL_OFF_T i64
89 | # define CURL_SUFFIX_CURL_OFF_TU ui64
90 | # endif
91 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
92 |
93 | #elif defined(__TURBOC__)
94 | # define CURL_TYPEOF_CURL_OFF_T long
95 | # define CURL_FORMAT_CURL_OFF_T "ld"
96 | # define CURL_FORMAT_CURL_OFF_TU "lu"
97 | # define CURL_SUFFIX_CURL_OFF_T L
98 | # define CURL_SUFFIX_CURL_OFF_TU UL
99 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
100 |
101 | #elif defined(__WATCOMC__)
102 | # if defined(__386__)
103 | # define CURL_TYPEOF_CURL_OFF_T __int64
104 | # define CURL_FORMAT_CURL_OFF_T "I64d"
105 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
106 | # define CURL_SUFFIX_CURL_OFF_T i64
107 | # define CURL_SUFFIX_CURL_OFF_TU ui64
108 | # else
109 | # define CURL_TYPEOF_CURL_OFF_T long
110 | # define CURL_FORMAT_CURL_OFF_T "ld"
111 | # define CURL_FORMAT_CURL_OFF_TU "lu"
112 | # define CURL_SUFFIX_CURL_OFF_T L
113 | # define CURL_SUFFIX_CURL_OFF_TU UL
114 | # endif
115 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
116 |
117 | #elif defined(__POCC__)
118 | # if (__POCC__ < 280)
119 | # define CURL_TYPEOF_CURL_OFF_T long
120 | # define CURL_FORMAT_CURL_OFF_T "ld"
121 | # define CURL_FORMAT_CURL_OFF_TU "lu"
122 | # define CURL_SUFFIX_CURL_OFF_T L
123 | # define CURL_SUFFIX_CURL_OFF_TU UL
124 | # elif defined(_MSC_VER)
125 | # define CURL_TYPEOF_CURL_OFF_T __int64
126 | # define CURL_FORMAT_CURL_OFF_T "I64d"
127 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
128 | # define CURL_SUFFIX_CURL_OFF_T i64
129 | # define CURL_SUFFIX_CURL_OFF_TU ui64
130 | # else
131 | # define CURL_TYPEOF_CURL_OFF_T long long
132 | # define CURL_FORMAT_CURL_OFF_T "lld"
133 | # define CURL_FORMAT_CURL_OFF_TU "llu"
134 | # define CURL_SUFFIX_CURL_OFF_T LL
135 | # define CURL_SUFFIX_CURL_OFF_TU ULL
136 | # endif
137 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
138 |
139 | #elif defined(__LCC__)
140 | # define CURL_TYPEOF_CURL_OFF_T long
141 | # define CURL_FORMAT_CURL_OFF_T "ld"
142 | # define CURL_FORMAT_CURL_OFF_TU "lu"
143 | # define CURL_SUFFIX_CURL_OFF_T L
144 | # define CURL_SUFFIX_CURL_OFF_TU UL
145 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
146 |
147 | #elif defined(__SYMBIAN32__)
148 | # if defined(__EABI__) /* Treat all ARM compilers equally */
149 | # define CURL_TYPEOF_CURL_OFF_T long long
150 | # define CURL_FORMAT_CURL_OFF_T "lld"
151 | # define CURL_FORMAT_CURL_OFF_TU "llu"
152 | # define CURL_SUFFIX_CURL_OFF_T LL
153 | # define CURL_SUFFIX_CURL_OFF_TU ULL
154 | # elif defined(__CW32__)
155 | # pragma longlong on
156 | # define CURL_TYPEOF_CURL_OFF_T long long
157 | # define CURL_FORMAT_CURL_OFF_T "lld"
158 | # define CURL_FORMAT_CURL_OFF_TU "llu"
159 | # define CURL_SUFFIX_CURL_OFF_T LL
160 | # define CURL_SUFFIX_CURL_OFF_TU ULL
161 | # elif defined(__VC32__)
162 | # define CURL_TYPEOF_CURL_OFF_T __int64
163 | # define CURL_FORMAT_CURL_OFF_T "lld"
164 | # define CURL_FORMAT_CURL_OFF_TU "llu"
165 | # define CURL_SUFFIX_CURL_OFF_T LL
166 | # define CURL_SUFFIX_CURL_OFF_TU ULL
167 | # endif
168 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
169 |
170 | #elif defined(__MWERKS__)
171 | # define CURL_TYPEOF_CURL_OFF_T long long
172 | # define CURL_FORMAT_CURL_OFF_T "lld"
173 | # define CURL_FORMAT_CURL_OFF_TU "llu"
174 | # define CURL_SUFFIX_CURL_OFF_T LL
175 | # define CURL_SUFFIX_CURL_OFF_TU ULL
176 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
177 |
178 | #elif defined(_WIN32_WCE)
179 | # define CURL_TYPEOF_CURL_OFF_T __int64
180 | # define CURL_FORMAT_CURL_OFF_T "I64d"
181 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
182 | # define CURL_SUFFIX_CURL_OFF_T i64
183 | # define CURL_SUFFIX_CURL_OFF_TU ui64
184 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
185 |
186 | #elif defined(__MINGW32__)
187 | # define CURL_TYPEOF_CURL_OFF_T long long
188 | # define CURL_FORMAT_CURL_OFF_T "I64d"
189 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
190 | # define CURL_SUFFIX_CURL_OFF_T LL
191 | # define CURL_SUFFIX_CURL_OFF_TU ULL
192 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
193 | # define CURL_PULL_SYS_TYPES_H 1
194 | # define CURL_PULL_WS2TCPIP_H 1
195 |
196 | #elif defined(__VMS)
197 | # if defined(__VAX)
198 | # define CURL_TYPEOF_CURL_OFF_T long
199 | # define CURL_FORMAT_CURL_OFF_T "ld"
200 | # define CURL_FORMAT_CURL_OFF_TU "lu"
201 | # define CURL_SUFFIX_CURL_OFF_T L
202 | # define CURL_SUFFIX_CURL_OFF_TU UL
203 | # else
204 | # define CURL_TYPEOF_CURL_OFF_T long long
205 | # define CURL_FORMAT_CURL_OFF_T "lld"
206 | # define CURL_FORMAT_CURL_OFF_TU "llu"
207 | # define CURL_SUFFIX_CURL_OFF_T LL
208 | # define CURL_SUFFIX_CURL_OFF_TU ULL
209 | # endif
210 | # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
211 |
212 | #elif defined(__OS400__)
213 | # if defined(__ILEC400__)
214 | # define CURL_TYPEOF_CURL_OFF_T long long
215 | # define CURL_FORMAT_CURL_OFF_T "lld"
216 | # define CURL_FORMAT_CURL_OFF_TU "llu"
217 | # define CURL_SUFFIX_CURL_OFF_T LL
218 | # define CURL_SUFFIX_CURL_OFF_TU ULL
219 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
220 | # define CURL_PULL_SYS_TYPES_H 1
221 | # define CURL_PULL_SYS_SOCKET_H 1
222 | # endif
223 |
224 | #elif defined(__MVS__)
225 | # if defined(__IBMC__) || defined(__IBMCPP__)
226 | # if defined(_ILP32)
227 | # elif defined(_LP64)
228 | # endif
229 | # if defined(_LONG_LONG)
230 | # define CURL_TYPEOF_CURL_OFF_T long long
231 | # define CURL_FORMAT_CURL_OFF_T "lld"
232 | # define CURL_FORMAT_CURL_OFF_TU "llu"
233 | # define CURL_SUFFIX_CURL_OFF_T LL
234 | # define CURL_SUFFIX_CURL_OFF_TU ULL
235 | # elif defined(_LP64)
236 | # define CURL_TYPEOF_CURL_OFF_T long
237 | # define CURL_FORMAT_CURL_OFF_T "ld"
238 | # define CURL_FORMAT_CURL_OFF_TU "lu"
239 | # define CURL_SUFFIX_CURL_OFF_T L
240 | # define CURL_SUFFIX_CURL_OFF_TU UL
241 | # else
242 | # define CURL_TYPEOF_CURL_OFF_T long
243 | # define CURL_FORMAT_CURL_OFF_T "ld"
244 | # define CURL_FORMAT_CURL_OFF_TU "lu"
245 | # define CURL_SUFFIX_CURL_OFF_T L
246 | # define CURL_SUFFIX_CURL_OFF_TU UL
247 | # endif
248 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
249 | # define CURL_PULL_SYS_TYPES_H 1
250 | # define CURL_PULL_SYS_SOCKET_H 1
251 | # endif
252 |
253 | #elif defined(__370__)
254 | # if defined(__IBMC__) || defined(__IBMCPP__)
255 | # if defined(_ILP32)
256 | # elif defined(_LP64)
257 | # endif
258 | # if defined(_LONG_LONG)
259 | # define CURL_TYPEOF_CURL_OFF_T long long
260 | # define CURL_FORMAT_CURL_OFF_T "lld"
261 | # define CURL_FORMAT_CURL_OFF_TU "llu"
262 | # define CURL_SUFFIX_CURL_OFF_T LL
263 | # define CURL_SUFFIX_CURL_OFF_TU ULL
264 | # elif defined(_LP64)
265 | # define CURL_TYPEOF_CURL_OFF_T long
266 | # define CURL_FORMAT_CURL_OFF_T "ld"
267 | # define CURL_FORMAT_CURL_OFF_TU "lu"
268 | # define CURL_SUFFIX_CURL_OFF_T L
269 | # define CURL_SUFFIX_CURL_OFF_TU UL
270 | # else
271 | # define CURL_TYPEOF_CURL_OFF_T long
272 | # define CURL_FORMAT_CURL_OFF_T "ld"
273 | # define CURL_FORMAT_CURL_OFF_TU "lu"
274 | # define CURL_SUFFIX_CURL_OFF_T L
275 | # define CURL_SUFFIX_CURL_OFF_TU UL
276 | # endif
277 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
278 | # define CURL_PULL_SYS_TYPES_H 1
279 | # define CURL_PULL_SYS_SOCKET_H 1
280 | # endif
281 |
282 | #elif defined(TPF)
283 | # define CURL_TYPEOF_CURL_OFF_T long
284 | # define CURL_FORMAT_CURL_OFF_T "ld"
285 | # define CURL_FORMAT_CURL_OFF_TU "lu"
286 | # define CURL_SUFFIX_CURL_OFF_T L
287 | # define CURL_SUFFIX_CURL_OFF_TU UL
288 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
289 |
290 | #elif defined(__TINYC__) /* also known as tcc */
291 |
292 | # define CURL_TYPEOF_CURL_OFF_T long long
293 | # define CURL_FORMAT_CURL_OFF_T "lld"
294 | # define CURL_FORMAT_CURL_OFF_TU "llu"
295 | # define CURL_SUFFIX_CURL_OFF_T LL
296 | # define CURL_SUFFIX_CURL_OFF_TU ULL
297 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
298 | # define CURL_PULL_SYS_TYPES_H 1
299 | # define CURL_PULL_SYS_SOCKET_H 1
300 |
301 | #elif defined(__SUNPRO_C) /* Oracle Solaris Studio */
302 | # if !defined(__LP64) && (defined(__ILP32) || \
303 | defined(__i386) || defined(__sparcv8))
304 | # define CURL_TYPEOF_CURL_OFF_T long long
305 | # define CURL_FORMAT_CURL_OFF_T "lld"
306 | # define CURL_FORMAT_CURL_OFF_TU "llu"
307 | # define CURL_SUFFIX_CURL_OFF_T LL
308 | # define CURL_SUFFIX_CURL_OFF_TU ULL
309 | # elif defined(__LP64) || \
310 | defined(__amd64) || defined(__sparcv9)
311 | # define CURL_TYPEOF_CURL_OFF_T long
312 | # define CURL_FORMAT_CURL_OFF_T "ld"
313 | # define CURL_FORMAT_CURL_OFF_TU "lu"
314 | # define CURL_SUFFIX_CURL_OFF_T L
315 | # define CURL_SUFFIX_CURL_OFF_TU UL
316 | # endif
317 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
318 | # define CURL_PULL_SYS_TYPES_H 1
319 | # define CURL_PULL_SYS_SOCKET_H 1
320 |
321 | /* ===================================== */
322 | /* KEEP MSVC THE PENULTIMATE ENTRY */
323 | /* ===================================== */
324 |
325 | #elif defined(_MSC_VER)
326 | # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
327 | # define CURL_TYPEOF_CURL_OFF_T __int64
328 | # define CURL_FORMAT_CURL_OFF_T "I64d"
329 | # define CURL_FORMAT_CURL_OFF_TU "I64u"
330 | # define CURL_SUFFIX_CURL_OFF_T i64
331 | # define CURL_SUFFIX_CURL_OFF_TU ui64
332 | # else
333 | # define CURL_TYPEOF_CURL_OFF_T long
334 | # define CURL_FORMAT_CURL_OFF_T "ld"
335 | # define CURL_FORMAT_CURL_OFF_TU "lu"
336 | # define CURL_SUFFIX_CURL_OFF_T L
337 | # define CURL_SUFFIX_CURL_OFF_TU UL
338 | # endif
339 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
340 |
341 | /* ===================================== */
342 | /* KEEP GENERIC GCC THE LAST ENTRY */
343 | /* ===================================== */
344 |
345 | #elif defined(__GNUC__)
346 | # if !defined(__LP64__) && \
347 | (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \
348 | defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \
349 | defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
350 | defined(__XTENSA__) || \
351 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4))
352 | # define CURL_TYPEOF_CURL_OFF_T long long
353 | # define CURL_FORMAT_CURL_OFF_T "lld"
354 | # define CURL_FORMAT_CURL_OFF_TU "llu"
355 | # define CURL_SUFFIX_CURL_OFF_T LL
356 | # define CURL_SUFFIX_CURL_OFF_TU ULL
357 | # elif defined(__LP64__) || \
358 | defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
359 | (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8)
360 | # define CURL_TYPEOF_CURL_OFF_T long
361 | # define CURL_FORMAT_CURL_OFF_T "ld"
362 | # define CURL_FORMAT_CURL_OFF_TU "lu"
363 | # define CURL_SUFFIX_CURL_OFF_T L
364 | # define CURL_SUFFIX_CURL_OFF_TU UL
365 | # endif
366 | # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
367 | # define CURL_PULL_SYS_TYPES_H 1
368 | # define CURL_PULL_SYS_SOCKET_H 1
369 |
370 | #else
371 | /* generic "safe guess" on old 32 bit style */
372 | # define CURL_TYPEOF_CURL_OFF_T long
373 | # define CURL_FORMAT_CURL_OFF_T "ld"
374 | # define CURL_FORMAT_CURL_OFF_TU "lu"
375 | # define CURL_SUFFIX_CURL_OFF_T L
376 | # define CURL_SUFFIX_CURL_OFF_TU UL
377 | # define CURL_TYPEOF_CURL_SOCKLEN_T int
378 | #endif
379 |
380 | #ifdef _AIX
381 | /* AIX needs */
382 | #define CURL_PULL_SYS_POLL_H
383 | #endif
384 |
385 |
386 | /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
387 | /* ws2tcpip.h is required here to properly make type definitions below. */
388 | #ifdef CURL_PULL_WS2TCPIP_H
389 | # include
390 | # include
391 | # include
392 | #endif
393 |
394 | /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
395 | /* sys/types.h is required here to properly make type definitions below. */
396 | #ifdef CURL_PULL_SYS_TYPES_H
397 | # include
398 | #endif
399 |
400 | /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
401 | /* sys/socket.h is required here to properly make type definitions below. */
402 | #ifdef CURL_PULL_SYS_SOCKET_H
403 | # include
404 | #endif
405 |
406 | /* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
407 | /* sys/poll.h is required here to properly make type definitions below. */
408 | #ifdef CURL_PULL_SYS_POLL_H
409 | # include
410 | #endif
411 |
412 | /* Data type definition of curl_socklen_t. */
413 | #ifdef CURL_TYPEOF_CURL_SOCKLEN_T
414 | typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
415 | #endif
416 |
417 | /* Data type definition of curl_off_t. */
418 |
419 | #ifdef CURL_TYPEOF_CURL_OFF_T
420 | typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
421 | #endif
422 |
423 | /*
424 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
425 | * these to be visible and exported by the external libcurl interface API,
426 | * while also making them visible to the library internals, simply including
427 | * curl_setup.h, without actually needing to include curl.h internally.
428 | * If some day this section would grow big enough, all this should be moved
429 | * to its own header file.
430 | */
431 |
432 | /*
433 | * Figure out if we can use the ## preprocessor operator, which is supported
434 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
435 | * or __cplusplus so we need to carefully check for them too.
436 | */
437 |
438 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
439 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
440 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
441 | defined(__ILEC400__)
442 | /* This compiler is believed to have an ISO compatible preprocessor */
443 | #define CURL_ISOCPP
444 | #else
445 | /* This compiler is believed NOT to have an ISO compatible preprocessor */
446 | #undef CURL_ISOCPP
447 | #endif
448 |
449 | /*
450 | * Macros for minimum-width signed and unsigned curl_off_t integer constants.
451 | */
452 |
453 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
454 | # define __CURL_OFF_T_C_HLPR2(x) x
455 | # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
456 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
457 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
458 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
459 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
460 | #else
461 | # ifdef CURL_ISOCPP
462 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
463 | # else
464 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
465 | # endif
466 | # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
467 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
468 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
469 | #endif
470 |
471 | #endif /* __CURL_SYSTEM_H */
472 |
--------------------------------------------------------------------------------
/distribution/curl/include/curl/typecheck-gcc.h:
--------------------------------------------------------------------------------
1 | #ifndef __CURL_TYPECHECK_GCC_H
2 | #define __CURL_TYPECHECK_GCC_H
3 | /***************************************************************************
4 | * _ _ ____ _
5 | * Project ___| | | | _ \| |
6 | * / __| | | | |_) | |
7 | * | (__| |_| | _ <| |___
8 | * \___|\___/|_| \_\_____|
9 | *
10 | * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al.
11 | *
12 | * This software is licensed as described in the file COPYING, which
13 | * you should have received as part of this distribution. The terms
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
15 | *
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 | * copies of the Software, and permit persons to whom the Software is
18 | * furnished to do so, under the terms of the COPYING file.
19 | *
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 | * KIND, either express or implied.
22 | *
23 | ***************************************************************************/
24 |
25 | /* wraps curl_easy_setopt() with typechecking */
26 |
27 | /* To add a new kind of warning, add an
28 | * if(_curl_is_sometype_option(_curl_opt))
29 | * if(!_curl_is_sometype(value))
30 | * _curl_easy_setopt_err_sometype();
31 | * block and define _curl_is_sometype_option, _curl_is_sometype and
32 | * _curl_easy_setopt_err_sometype below
33 | *
34 | * NOTE: We use two nested 'if' statements here instead of the && operator, in
35 | * order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
36 | * when compiling with -Wlogical-op.
37 | *
38 | * To add an option that uses the same type as an existing option, you'll just
39 | * need to extend the appropriate _curl_*_option macro
40 | */
41 | #define curl_easy_setopt(handle, option, value) \
42 | __extension__ ({ \
43 | __typeof__(option) _curl_opt = option; \
44 | if(__builtin_constant_p(_curl_opt)) { \
45 | if(_curl_is_long_option(_curl_opt)) \
46 | if(!_curl_is_long(value)) \
47 | _curl_easy_setopt_err_long(); \
48 | if(_curl_is_off_t_option(_curl_opt)) \
49 | if(!_curl_is_off_t(value)) \
50 | _curl_easy_setopt_err_curl_off_t(); \
51 | if(_curl_is_string_option(_curl_opt)) \
52 | if(!_curl_is_string(value)) \
53 | _curl_easy_setopt_err_string(); \
54 | if(_curl_is_write_cb_option(_curl_opt)) \
55 | if(!_curl_is_write_cb(value)) \
56 | _curl_easy_setopt_err_write_callback(); \
57 | if((_curl_opt) == CURLOPT_READFUNCTION) \
58 | if(!_curl_is_read_cb(value)) \
59 | _curl_easy_setopt_err_read_cb(); \
60 | if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
61 | if(!_curl_is_ioctl_cb(value)) \
62 | _curl_easy_setopt_err_ioctl_cb(); \
63 | if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
64 | if(!_curl_is_sockopt_cb(value)) \
65 | _curl_easy_setopt_err_sockopt_cb(); \
66 | if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
67 | if(!_curl_is_opensocket_cb(value)) \
68 | _curl_easy_setopt_err_opensocket_cb(); \
69 | if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
70 | if(!_curl_is_progress_cb(value)) \
71 | _curl_easy_setopt_err_progress_cb(); \
72 | if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
73 | if(!_curl_is_debug_cb(value)) \
74 | _curl_easy_setopt_err_debug_cb(); \
75 | if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
76 | if(!_curl_is_ssl_ctx_cb(value)) \
77 | _curl_easy_setopt_err_ssl_ctx_cb(); \
78 | if(_curl_is_conv_cb_option(_curl_opt)) \
79 | if(!_curl_is_conv_cb(value)) \
80 | _curl_easy_setopt_err_conv_cb(); \
81 | if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
82 | if(!_curl_is_seek_cb(value)) \
83 | _curl_easy_setopt_err_seek_cb(); \
84 | if(_curl_is_cb_data_option(_curl_opt)) \
85 | if(!_curl_is_cb_data(value)) \
86 | _curl_easy_setopt_err_cb_data(); \
87 | if((_curl_opt) == CURLOPT_ERRORBUFFER) \
88 | if(!_curl_is_error_buffer(value)) \
89 | _curl_easy_setopt_err_error_buffer(); \
90 | if((_curl_opt) == CURLOPT_STDERR) \
91 | if(!_curl_is_FILE(value)) \
92 | _curl_easy_setopt_err_FILE(); \
93 | if(_curl_is_postfields_option(_curl_opt)) \
94 | if(!_curl_is_postfields(value)) \
95 | _curl_easy_setopt_err_postfields(); \
96 | if((_curl_opt) == CURLOPT_HTTPPOST) \
97 | if(!_curl_is_arr((value), struct curl_httppost)) \
98 | _curl_easy_setopt_err_curl_httpost(); \
99 | if((_curl_opt) == CURLOPT_MIMEPOST) \
100 | if(!_curl_is_ptr((value), curl_mime)) \
101 | _curl_easy_setopt_err_curl_mimepost(); \
102 | if(_curl_is_slist_option(_curl_opt)) \
103 | if(!_curl_is_arr((value), struct curl_slist)) \
104 | _curl_easy_setopt_err_curl_slist(); \
105 | if((_curl_opt) == CURLOPT_SHARE) \
106 | if(!_curl_is_ptr((value), CURLSH)) \
107 | _curl_easy_setopt_err_CURLSH(); \
108 | } \
109 | curl_easy_setopt(handle, _curl_opt, value); \
110 | })
111 |
112 | /* wraps curl_easy_getinfo() with typechecking */
113 | /* FIXME: don't allow const pointers */
114 | #define curl_easy_getinfo(handle, info, arg) \
115 | __extension__ ({ \
116 | __typeof__(info) _curl_info = info; \
117 | if(__builtin_constant_p(_curl_info)) { \
118 | if(_curl_is_string_info(_curl_info)) \
119 | if(!_curl_is_arr((arg), char *)) \
120 | _curl_easy_getinfo_err_string(); \
121 | if(_curl_is_long_info(_curl_info)) \
122 | if(!_curl_is_arr((arg), long)) \
123 | _curl_easy_getinfo_err_long(); \
124 | if(_curl_is_double_info(_curl_info)) \
125 | if(!_curl_is_arr((arg), double)) \
126 | _curl_easy_getinfo_err_double(); \
127 | if(_curl_is_slist_info(_curl_info)) \
128 | if(!_curl_is_arr((arg), struct curl_slist *)) \
129 | _curl_easy_getinfo_err_curl_slist(); \
130 | if(_curl_is_tlssessioninfo_info(_curl_info)) \
131 | if(!_curl_is_arr((arg), struct curl_tlssessioninfo *)) \
132 | _curl_easy_getinfo_err_curl_tlssesssioninfo(); \
133 | if(_curl_is_certinfo_info(_curl_info)) \
134 | if(!_curl_is_arr((arg), struct curl_certinfo *)) \
135 | _curl_easy_getinfo_err_curl_certinfo(); \
136 | if(_curl_is_socket_info(_curl_info)) \
137 | if(!_curl_is_arr((arg), curl_socket_t)) \
138 | _curl_easy_getinfo_err_curl_socket(); \
139 | if(_curl_is_off_t_info(_curl_info)) \
140 | if(!_curl_is_arr((arg), curl_off_t)) \
141 | _curl_easy_getinfo_err_curl_off_t(); \
142 | } \
143 | curl_easy_getinfo(handle, _curl_info, arg); \
144 | })
145 |
146 | /* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
147 | * for now just make sure that the functions are called with three
148 | * arguments
149 | */
150 | #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
151 | #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
152 |
153 |
154 | /* the actual warnings, triggered by calling the _curl_easy_setopt_err*
155 | * functions */
156 |
157 | /* To define a new warning, use _CURL_WARNING(identifier, "message") */
158 | #define _CURL_WARNING(id, message) \
159 | static void __attribute__((__warning__(message))) \
160 | __attribute__((__unused__)) __attribute__((__noinline__)) \
161 | id(void) { __asm__(""); }
162 |
163 | _CURL_WARNING(_curl_easy_setopt_err_long,
164 | "curl_easy_setopt expects a long argument for this option")
165 | _CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
166 | "curl_easy_setopt expects a curl_off_t argument for this option")
167 | _CURL_WARNING(_curl_easy_setopt_err_string,
168 | "curl_easy_setopt expects a "
169 | "string ('char *' or char[]) argument for this option"
170 | )
171 | _CURL_WARNING(_curl_easy_setopt_err_write_callback,
172 | "curl_easy_setopt expects a curl_write_callback argument for this option")
173 | _CURL_WARNING(_curl_easy_setopt_err_read_cb,
174 | "curl_easy_setopt expects a curl_read_callback argument for this option")
175 | _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
176 | "curl_easy_setopt expects a curl_ioctl_callback argument for this option")
177 | _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
178 | "curl_easy_setopt expects a curl_sockopt_callback argument for this option")
179 | _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
180 | "curl_easy_setopt expects a "
181 | "curl_opensocket_callback argument for this option"
182 | )
183 | _CURL_WARNING(_curl_easy_setopt_err_progress_cb,
184 | "curl_easy_setopt expects a curl_progress_callback argument for this option")
185 | _CURL_WARNING(_curl_easy_setopt_err_debug_cb,
186 | "curl_easy_setopt expects a curl_debug_callback argument for this option")
187 | _CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
188 | "curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
189 | _CURL_WARNING(_curl_easy_setopt_err_conv_cb,
190 | "curl_easy_setopt expects a curl_conv_callback argument for this option")
191 | _CURL_WARNING(_curl_easy_setopt_err_seek_cb,
192 | "curl_easy_setopt expects a curl_seek_callback argument for this option")
193 | _CURL_WARNING(_curl_easy_setopt_err_cb_data,
194 | "curl_easy_setopt expects a "
195 | "private data pointer as argument for this option")
196 | _CURL_WARNING(_curl_easy_setopt_err_error_buffer,
197 | "curl_easy_setopt expects a "
198 | "char buffer of CURL_ERROR_SIZE as argument for this option")
199 | _CURL_WARNING(_curl_easy_setopt_err_FILE,
200 | "curl_easy_setopt expects a 'FILE *' argument for this option")
201 | _CURL_WARNING(_curl_easy_setopt_err_postfields,
202 | "curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
203 | _CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
204 | "curl_easy_setopt expects a 'struct curl_httppost *' "
205 | "argument for this option")
206 | _CURL_WARNING(_curl_easy_setopt_err_curl_mimepost,
207 | "curl_easy_setopt expects a 'curl_mime *' "
208 | "argument for this option")
209 | _CURL_WARNING(_curl_easy_setopt_err_curl_slist,
210 | "curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
211 | _CURL_WARNING(_curl_easy_setopt_err_CURLSH,
212 | "curl_easy_setopt expects a CURLSH* argument for this option")
213 |
214 | _CURL_WARNING(_curl_easy_getinfo_err_string,
215 | "curl_easy_getinfo expects a pointer to 'char *' for this info")
216 | _CURL_WARNING(_curl_easy_getinfo_err_long,
217 | "curl_easy_getinfo expects a pointer to long for this info")
218 | _CURL_WARNING(_curl_easy_getinfo_err_double,
219 | "curl_easy_getinfo expects a pointer to double for this info")
220 | _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
221 | "curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
222 | _CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
223 | "curl_easy_getinfo expects a pointer to "
224 | "'struct curl_tlssessioninfo *' for this info")
225 | _CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo,
226 | "curl_easy_getinfo expects a pointer to "
227 | "'struct curl_certinfo *' for this info")
228 | _CURL_WARNING(_curl_easy_getinfo_err_curl_socket,
229 | "curl_easy_getinfo expects a pointer to curl_socket_t for this info")
230 | _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
231 | "curl_easy_getinfo expects a pointer to curl_off_t for this info")
232 |
233 | /* groups of curl_easy_setops options that take the same type of argument */
234 |
235 | /* To add a new option to one of the groups, just add
236 | * (option) == CURLOPT_SOMETHING
237 | * to the or-expression. If the option takes a long or curl_off_t, you don't
238 | * have to do anything
239 | */
240 |
241 | /* evaluates to true if option takes a long argument */
242 | #define _curl_is_long_option(option) \
243 | (0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
244 |
245 | #define _curl_is_off_t_option(option) \
246 | ((option) > CURLOPTTYPE_OFF_T)
247 |
248 | /* evaluates to true if option takes a char* argument */
249 | #define _curl_is_string_option(option) \
250 | ((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
251 | (option) == CURLOPT_ACCEPT_ENCODING || \
252 | (option) == CURLOPT_CAINFO || \
253 | (option) == CURLOPT_CAPATH || \
254 | (option) == CURLOPT_COOKIE || \
255 | (option) == CURLOPT_COOKIEFILE || \
256 | (option) == CURLOPT_COOKIEJAR || \
257 | (option) == CURLOPT_COOKIELIST || \
258 | (option) == CURLOPT_CRLFILE || \
259 | (option) == CURLOPT_CUSTOMREQUEST || \
260 | (option) == CURLOPT_DEFAULT_PROTOCOL || \
261 | (option) == CURLOPT_DNS_INTERFACE || \
262 | (option) == CURLOPT_DNS_LOCAL_IP4 || \
263 | (option) == CURLOPT_DNS_LOCAL_IP6 || \
264 | (option) == CURLOPT_DNS_SERVERS || \
265 | (option) == CURLOPT_EGDSOCKET || \
266 | (option) == CURLOPT_FTPPORT || \
267 | (option) == CURLOPT_FTP_ACCOUNT || \
268 | (option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
269 | (option) == CURLOPT_INTERFACE || \
270 | (option) == CURLOPT_ISSUERCERT || \
271 | (option) == CURLOPT_KEYPASSWD || \
272 | (option) == CURLOPT_KRBLEVEL || \
273 | (option) == CURLOPT_LOGIN_OPTIONS || \
274 | (option) == CURLOPT_MAIL_AUTH || \
275 | (option) == CURLOPT_MAIL_FROM || \
276 | (option) == CURLOPT_NETRC_FILE || \
277 | (option) == CURLOPT_NOPROXY || \
278 | (option) == CURLOPT_PASSWORD || \
279 | (option) == CURLOPT_PINNEDPUBLICKEY || \
280 | (option) == CURLOPT_PRE_PROXY || \
281 | (option) == CURLOPT_PROXY || \
282 | (option) == CURLOPT_PROXYPASSWORD || \
283 | (option) == CURLOPT_PROXYUSERNAME || \
284 | (option) == CURLOPT_PROXYUSERPWD || \
285 | (option) == CURLOPT_PROXY_CAINFO || \
286 | (option) == CURLOPT_PROXY_CAPATH || \
287 | (option) == CURLOPT_PROXY_CRLFILE || \
288 | (option) == CURLOPT_PROXY_KEYPASSWD || \
289 | (option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
290 | (option) == CURLOPT_PROXY_SERVICE_NAME || \
291 | (option) == CURLOPT_PROXY_SSLCERT || \
292 | (option) == CURLOPT_PROXY_SSLCERTTYPE || \
293 | (option) == CURLOPT_PROXY_SSLKEY || \
294 | (option) == CURLOPT_PROXY_SSLKEYTYPE || \
295 | (option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
296 | (option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
297 | (option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
298 | (option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
299 | (option) == CURLOPT_RANDOM_FILE || \
300 | (option) == CURLOPT_RANGE || \
301 | (option) == CURLOPT_REFERER || \
302 | (option) == CURLOPT_RTSP_SESSION_ID || \
303 | (option) == CURLOPT_RTSP_STREAM_URI || \
304 | (option) == CURLOPT_RTSP_TRANSPORT || \
305 | (option) == CURLOPT_SERVICE_NAME || \
306 | (option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
307 | (option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
308 | (option) == CURLOPT_SSH_KNOWNHOSTS || \
309 | (option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
310 | (option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
311 | (option) == CURLOPT_SSLCERT || \
312 | (option) == CURLOPT_SSLCERTTYPE || \
313 | (option) == CURLOPT_SSLENGINE || \
314 | (option) == CURLOPT_SSLKEY || \
315 | (option) == CURLOPT_SSLKEYTYPE || \
316 | (option) == CURLOPT_SSL_CIPHER_LIST || \
317 | (option) == CURLOPT_TLSAUTH_PASSWORD || \
318 | (option) == CURLOPT_TLSAUTH_TYPE || \
319 | (option) == CURLOPT_TLSAUTH_USERNAME || \
320 | (option) == CURLOPT_UNIX_SOCKET_PATH || \
321 | (option) == CURLOPT_URL || \
322 | (option) == CURLOPT_USERAGENT || \
323 | (option) == CURLOPT_USERNAME || \
324 | (option) == CURLOPT_USERPWD || \
325 | (option) == CURLOPT_XOAUTH2_BEARER || \
326 | 0)
327 |
328 | /* evaluates to true if option takes a curl_write_callback argument */
329 | #define _curl_is_write_cb_option(option) \
330 | ((option) == CURLOPT_HEADERFUNCTION || \
331 | (option) == CURLOPT_WRITEFUNCTION)
332 |
333 | /* evaluates to true if option takes a curl_conv_callback argument */
334 | #define _curl_is_conv_cb_option(option) \
335 | ((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
336 | (option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
337 | (option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
338 |
339 | /* evaluates to true if option takes a data argument to pass to a callback */
340 | #define _curl_is_cb_data_option(option) \
341 | ((option) == CURLOPT_CHUNK_DATA || \
342 | (option) == CURLOPT_CLOSESOCKETDATA || \
343 | (option) == CURLOPT_DEBUGDATA || \
344 | (option) == CURLOPT_FNMATCH_DATA || \
345 | (option) == CURLOPT_HEADERDATA || \
346 | (option) == CURLOPT_INTERLEAVEDATA || \
347 | (option) == CURLOPT_IOCTLDATA || \
348 | (option) == CURLOPT_OPENSOCKETDATA || \
349 | (option) == CURLOPT_PRIVATE || \
350 | (option) == CURLOPT_PROGRESSDATA || \
351 | (option) == CURLOPT_READDATA || \
352 | (option) == CURLOPT_SEEKDATA || \
353 | (option) == CURLOPT_SOCKOPTDATA || \
354 | (option) == CURLOPT_SSH_KEYDATA || \
355 | (option) == CURLOPT_SSL_CTX_DATA || \
356 | (option) == CURLOPT_WRITEDATA || \
357 | 0)
358 |
359 | /* evaluates to true if option takes a POST data argument (void* or char*) */
360 | #define _curl_is_postfields_option(option) \
361 | ((option) == CURLOPT_POSTFIELDS || \
362 | (option) == CURLOPT_COPYPOSTFIELDS || \
363 | 0)
364 |
365 | /* evaluates to true if option takes a struct curl_slist * argument */
366 | #define _curl_is_slist_option(option) \
367 | ((option) == CURLOPT_HTTP200ALIASES || \
368 | (option) == CURLOPT_HTTPHEADER || \
369 | (option) == CURLOPT_MAIL_RCPT || \
370 | (option) == CURLOPT_POSTQUOTE || \
371 | (option) == CURLOPT_PREQUOTE || \
372 | (option) == CURLOPT_PROXYHEADER || \
373 | (option) == CURLOPT_QUOTE || \
374 | (option) == CURLOPT_RESOLVE || \
375 | (option) == CURLOPT_TELNETOPTIONS || \
376 | 0)
377 |
378 | /* groups of curl_easy_getinfo infos that take the same type of argument */
379 |
380 | /* evaluates to true if info expects a pointer to char * argument */
381 | #define _curl_is_string_info(info) \
382 | (CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
383 |
384 | /* evaluates to true if info expects a pointer to long argument */
385 | #define _curl_is_long_info(info) \
386 | (CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
387 |
388 | /* evaluates to true if info expects a pointer to double argument */
389 | #define _curl_is_double_info(info) \
390 | (CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
391 |
392 | /* true if info expects a pointer to struct curl_slist * argument */
393 | #define _curl_is_slist_info(info) \
394 | (((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
395 |
396 | /* true if info expects a pointer to struct curl_tlssessioninfo * argument */
397 | #define _curl_is_tlssessioninfo_info(info) \
398 | (((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
399 |
400 | /* true if info expects a pointer to struct curl_certinfo * argument */
401 | #define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
402 |
403 | /* true if info expects a pointer to struct curl_socket_t argument */
404 | #define _curl_is_socket_info(info) \
405 | (CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
406 |
407 | /* true if info expects a pointer to curl_off_t argument */
408 | #define _curl_is_off_t_info(info) \
409 | (CURLINFO_OFF_T < (info))
410 |
411 |
412 | /* typecheck helpers -- check whether given expression has requested type*/
413 |
414 | /* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
415 | * otherwise define a new macro. Search for __builtin_types_compatible_p
416 | * in the GCC manual.
417 | * NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
418 | * the actual expression passed to the curl_easy_setopt macro. This
419 | * means that you can only apply the sizeof and __typeof__ operators, no
420 | * == or whatsoever.
421 | */
422 |
423 | /* XXX: should evaluate to true iff expr is a pointer */
424 | #define _curl_is_any_ptr(expr) \
425 | (sizeof(expr) == sizeof(void *))
426 |
427 | /* evaluates to true if expr is NULL */
428 | /* XXX: must not evaluate expr, so this check is not accurate */
429 | #define _curl_is_NULL(expr) \
430 | (__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
431 |
432 | /* evaluates to true if expr is type*, const type* or NULL */
433 | #define _curl_is_ptr(expr, type) \
434 | (_curl_is_NULL(expr) || \
435 | __builtin_types_compatible_p(__typeof__(expr), type *) || \
436 | __builtin_types_compatible_p(__typeof__(expr), const type *))
437 |
438 | /* evaluates to true if expr is one of type[], type*, NULL or const type* */
439 | #define _curl_is_arr(expr, type) \
440 | (_curl_is_ptr((expr), type) || \
441 | __builtin_types_compatible_p(__typeof__(expr), type []))
442 |
443 | /* evaluates to true if expr is a string */
444 | #define _curl_is_string(expr) \
445 | (_curl_is_arr((expr), char) || \
446 | _curl_is_arr((expr), signed char) || \
447 | _curl_is_arr((expr), unsigned char))
448 |
449 | /* evaluates to true if expr is a long (no matter the signedness)
450 | * XXX: for now, int is also accepted (and therefore short and char, which
451 | * are promoted to int when passed to a variadic function) */
452 | #define _curl_is_long(expr) \
453 | (__builtin_types_compatible_p(__typeof__(expr), long) || \
454 | __builtin_types_compatible_p(__typeof__(expr), signed long) || \
455 | __builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
456 | __builtin_types_compatible_p(__typeof__(expr), int) || \
457 | __builtin_types_compatible_p(__typeof__(expr), signed int) || \
458 | __builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
459 | __builtin_types_compatible_p(__typeof__(expr), short) || \
460 | __builtin_types_compatible_p(__typeof__(expr), signed short) || \
461 | __builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
462 | __builtin_types_compatible_p(__typeof__(expr), char) || \
463 | __builtin_types_compatible_p(__typeof__(expr), signed char) || \
464 | __builtin_types_compatible_p(__typeof__(expr), unsigned char))
465 |
466 | /* evaluates to true if expr is of type curl_off_t */
467 | #define _curl_is_off_t(expr) \
468 | (__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
469 |
470 | /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
471 | /* XXX: also check size of an char[] array? */
472 | #define _curl_is_error_buffer(expr) \
473 | (_curl_is_NULL(expr) || \
474 | __builtin_types_compatible_p(__typeof__(expr), char *) || \
475 | __builtin_types_compatible_p(__typeof__(expr), char[]))
476 |
477 | /* evaluates to true if expr is of type (const) void* or (const) FILE* */
478 | #if 0
479 | #define _curl_is_cb_data(expr) \
480 | (_curl_is_ptr((expr), void) || \
481 | _curl_is_ptr((expr), FILE))
482 | #else /* be less strict */
483 | #define _curl_is_cb_data(expr) \
484 | _curl_is_any_ptr(expr)
485 | #endif
486 |
487 | /* evaluates to true if expr is of type FILE* */
488 | #define _curl_is_FILE(expr) \
489 | (_curl_is_NULL(expr) || \
490 | (__builtin_types_compatible_p(__typeof__(expr), FILE *)))
491 |
492 | /* evaluates to true if expr can be passed as POST data (void* or char*) */
493 | #define _curl_is_postfields(expr) \
494 | (_curl_is_ptr((expr), void) || \
495 | _curl_is_arr((expr), char))
496 |
497 | /* FIXME: the whole callback checking is messy...
498 | * The idea is to tolerate char vs. void and const vs. not const
499 | * pointers in arguments at least
500 | */
501 | /* helper: __builtin_types_compatible_p distinguishes between functions and
502 | * function pointers, hide it */
503 | #define _curl_callback_compatible(func, type) \
504 | (__builtin_types_compatible_p(__typeof__(func), type) || \
505 | __builtin_types_compatible_p(__typeof__(func) *, type))
506 |
507 | /* evaluates to true if expr is of type curl_read_callback or "similar" */
508 | #define _curl_is_read_cb(expr) \
509 | (_curl_is_NULL(expr) || \
510 | _curl_callback_compatible((expr), __typeof__(fread) *) || \
511 | _curl_callback_compatible((expr), curl_read_callback) || \
512 | _curl_callback_compatible((expr), _curl_read_callback1) || \
513 | _curl_callback_compatible((expr), _curl_read_callback2) || \
514 | _curl_callback_compatible((expr), _curl_read_callback3) || \
515 | _curl_callback_compatible((expr), _curl_read_callback4) || \
516 | _curl_callback_compatible((expr), _curl_read_callback5) || \
517 | _curl_callback_compatible((expr), _curl_read_callback6))
518 | typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
519 | typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
520 | typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
521 | typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
522 | typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
523 | typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
524 |
525 | /* evaluates to true if expr is of type curl_write_callback or "similar" */
526 | #define _curl_is_write_cb(expr) \
527 | (_curl_is_read_cb(expr) || \
528 | _curl_callback_compatible((expr), __typeof__(fwrite) *) || \
529 | _curl_callback_compatible((expr), curl_write_callback) || \
530 | _curl_callback_compatible((expr), _curl_write_callback1) || \
531 | _curl_callback_compatible((expr), _curl_write_callback2) || \
532 | _curl_callback_compatible((expr), _curl_write_callback3) || \
533 | _curl_callback_compatible((expr), _curl_write_callback4) || \
534 | _curl_callback_compatible((expr), _curl_write_callback5) || \
535 | _curl_callback_compatible((expr), _curl_write_callback6))
536 | typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
537 | typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
538 | const void *);
539 | typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
540 | typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
541 | typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
542 | const void *);
543 | typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
544 |
545 | /* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
546 | #define _curl_is_ioctl_cb(expr) \
547 | (_curl_is_NULL(expr) || \
548 | _curl_callback_compatible((expr), curl_ioctl_callback) || \
549 | _curl_callback_compatible((expr), _curl_ioctl_callback1) || \
550 | _curl_callback_compatible((expr), _curl_ioctl_callback2) || \
551 | _curl_callback_compatible((expr), _curl_ioctl_callback3) || \
552 | _curl_callback_compatible((expr), _curl_ioctl_callback4))
553 | typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
554 | typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
555 | typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
556 | typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
557 |
558 | /* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
559 | #define _curl_is_sockopt_cb(expr) \
560 | (_curl_is_NULL(expr) || \
561 | _curl_callback_compatible((expr), curl_sockopt_callback) || \
562 | _curl_callback_compatible((expr), _curl_sockopt_callback1) || \
563 | _curl_callback_compatible((expr), _curl_sockopt_callback2))
564 | typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
565 | typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
566 | curlsocktype);
567 |
568 | /* evaluates to true if expr is of type curl_opensocket_callback or
569 | "similar" */
570 | #define _curl_is_opensocket_cb(expr) \
571 | (_curl_is_NULL(expr) || \
572 | _curl_callback_compatible((expr), curl_opensocket_callback) || \
573 | _curl_callback_compatible((expr), _curl_opensocket_callback1) || \
574 | _curl_callback_compatible((expr), _curl_opensocket_callback2) || \
575 | _curl_callback_compatible((expr), _curl_opensocket_callback3) || \
576 | _curl_callback_compatible((expr), _curl_opensocket_callback4))
577 | typedef curl_socket_t (*_curl_opensocket_callback1)
578 | (void *, curlsocktype, struct curl_sockaddr *);
579 | typedef curl_socket_t (*_curl_opensocket_callback2)
580 | (void *, curlsocktype, const struct curl_sockaddr *);
581 | typedef curl_socket_t (*_curl_opensocket_callback3)
582 | (const void *, curlsocktype, struct curl_sockaddr *);
583 | typedef curl_socket_t (*_curl_opensocket_callback4)
584 | (const void *, curlsocktype, const struct curl_sockaddr *);
585 |
586 | /* evaluates to true if expr is of type curl_progress_callback or "similar" */
587 | #define _curl_is_progress_cb(expr) \
588 | (_curl_is_NULL(expr) || \
589 | _curl_callback_compatible((expr), curl_progress_callback) || \
590 | _curl_callback_compatible((expr), _curl_progress_callback1) || \
591 | _curl_callback_compatible((expr), _curl_progress_callback2))
592 | typedef int (*_curl_progress_callback1)(void *,
593 | double, double, double, double);
594 | typedef int (*_curl_progress_callback2)(const void *,
595 | double, double, double, double);
596 |
597 | /* evaluates to true if expr is of type curl_debug_callback or "similar" */
598 | #define _curl_is_debug_cb(expr) \
599 | (_curl_is_NULL(expr) || \
600 | _curl_callback_compatible((expr), curl_debug_callback) || \
601 | _curl_callback_compatible((expr), _curl_debug_callback1) || \
602 | _curl_callback_compatible((expr), _curl_debug_callback2) || \
603 | _curl_callback_compatible((expr), _curl_debug_callback3) || \
604 | _curl_callback_compatible((expr), _curl_debug_callback4) || \
605 | _curl_callback_compatible((expr), _curl_debug_callback5) || \
606 | _curl_callback_compatible((expr), _curl_debug_callback6) || \
607 | _curl_callback_compatible((expr), _curl_debug_callback7) || \
608 | _curl_callback_compatible((expr), _curl_debug_callback8))
609 | typedef int (*_curl_debug_callback1) (CURL *,
610 | curl_infotype, char *, size_t, void *);
611 | typedef int (*_curl_debug_callback2) (CURL *,
612 | curl_infotype, char *, size_t, const void *);
613 | typedef int (*_curl_debug_callback3) (CURL *,
614 | curl_infotype, const char *, size_t, void *);
615 | typedef int (*_curl_debug_callback4) (CURL *,
616 | curl_infotype, const char *, size_t, const void *);
617 | typedef int (*_curl_debug_callback5) (CURL *,
618 | curl_infotype, unsigned char *, size_t, void *);
619 | typedef int (*_curl_debug_callback6) (CURL *,
620 | curl_infotype, unsigned char *, size_t, const void *);
621 | typedef int (*_curl_debug_callback7) (CURL *,
622 | curl_infotype, const unsigned char *, size_t, void *);
623 | typedef int (*_curl_debug_callback8) (CURL *,
624 | curl_infotype, const unsigned char *, size_t, const void *);
625 |
626 | /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
627 | /* this is getting even messier... */
628 | #define _curl_is_ssl_ctx_cb(expr) \
629 | (_curl_is_NULL(expr) || \
630 | _curl_callback_compatible((expr), curl_ssl_ctx_callback) || \
631 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \
632 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \
633 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \
634 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \
635 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \
636 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \
637 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \
638 | _curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
639 | typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
640 | typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
641 | typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
642 | typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
643 | const void *);
644 | #ifdef HEADER_SSL_H
645 | /* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
646 | * this will of course break if we're included before OpenSSL headers...
647 | */
648 | typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
649 | typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
650 | typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
651 | typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
652 | const void *);
653 | #else
654 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
655 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
656 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
657 | typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
658 | #endif
659 |
660 | /* evaluates to true if expr is of type curl_conv_callback or "similar" */
661 | #define _curl_is_conv_cb(expr) \
662 | (_curl_is_NULL(expr) || \
663 | _curl_callback_compatible((expr), curl_conv_callback) || \
664 | _curl_callback_compatible((expr), _curl_conv_callback1) || \
665 | _curl_callback_compatible((expr), _curl_conv_callback2) || \
666 | _curl_callback_compatible((expr), _curl_conv_callback3) || \
667 | _curl_callback_compatible((expr), _curl_conv_callback4))
668 | typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
669 | typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
670 | typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
671 | typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
672 |
673 | /* evaluates to true if expr is of type curl_seek_callback or "similar" */
674 | #define _curl_is_seek_cb(expr) \
675 | (_curl_is_NULL(expr) || \
676 | _curl_callback_compatible((expr), curl_seek_callback) || \
677 | _curl_callback_compatible((expr), _curl_seek_callback1) || \
678 | _curl_callback_compatible((expr), _curl_seek_callback2))
679 | typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
680 | typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
681 |
682 |
683 | #endif /* __CURL_TYPECHECK_GCC_H */
684 |
--------------------------------------------------------------------------------
/distribution/curl/lib/arm64-v8a/libcurl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/curl/lib/arm64-v8a/libcurl.a
--------------------------------------------------------------------------------
/distribution/curl/lib/armeabi-v7a/libcurl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/curl/lib/armeabi-v7a/libcurl.a
--------------------------------------------------------------------------------
/distribution/curl/lib/x86/libcurl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/curl/lib/x86/libcurl.a
--------------------------------------------------------------------------------
/distribution/curl/lib/x86_64/libcurl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/curl/lib/x86_64/libcurl.a
--------------------------------------------------------------------------------
/distribution/curl/lib19/armeabi-v7a/libcurl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/curl/lib19/armeabi-v7a/libcurl.a
--------------------------------------------------------------------------------
/distribution/curl/lib19/x86/libcurl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/curl/lib19/x86/libcurl.a
--------------------------------------------------------------------------------
/distribution/jansson/include/jansson.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Petri Lehtinen
3 | *
4 | * Jansson is free software; you can redistribute it and/or modify
5 | * it under the terms of the MIT license. See LICENSE for details.
6 | */
7 |
8 | #ifndef JANSSON_H
9 | #define JANSSON_H
10 |
11 | #include
12 | #include /* for size_t */
13 | #include
14 |
15 | #include "jansson_config.h"
16 |
17 | #ifdef __cplusplus
18 | extern "C" {
19 | #endif
20 |
21 | /* version */
22 |
23 | #define JANSSON_MAJOR_VERSION 2
24 | #define JANSSON_MINOR_VERSION 10
25 | #define JANSSON_MICRO_VERSION 0
26 |
27 | /* Micro version is omitted if it's 0 */
28 | #define JANSSON_VERSION "2.10"
29 |
30 | /* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this
31 | for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */
32 | #define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \
33 | (JANSSON_MINOR_VERSION << 8) | \
34 | (JANSSON_MICRO_VERSION << 0))
35 |
36 |
37 | /* types */
38 |
39 | typedef enum {
40 | JSON_OBJECT,
41 | JSON_ARRAY,
42 | JSON_STRING,
43 | JSON_INTEGER,
44 | JSON_REAL,
45 | JSON_TRUE,
46 | JSON_FALSE,
47 | JSON_NULL
48 | } json_type;
49 |
50 | typedef struct json_t {
51 | json_type type;
52 | size_t refcount;
53 | } json_t;
54 |
55 | #ifndef JANSSON_USING_CMAKE /* disabled if using cmake */
56 | #if JSON_INTEGER_IS_LONG_LONG
57 | #ifdef _WIN32
58 | #define JSON_INTEGER_FORMAT "I64d"
59 | #else
60 | #define JSON_INTEGER_FORMAT "lld"
61 | #endif
62 | typedef long long json_int_t;
63 | #else
64 | #define JSON_INTEGER_FORMAT "ld"
65 | typedef long json_int_t;
66 | #endif /* JSON_INTEGER_IS_LONG_LONG */
67 | #endif
68 |
69 | #define json_typeof(json) ((json)->type)
70 | #define json_is_object(json) ((json) && json_typeof(json) == JSON_OBJECT)
71 | #define json_is_array(json) ((json) && json_typeof(json) == JSON_ARRAY)
72 | #define json_is_string(json) ((json) && json_typeof(json) == JSON_STRING)
73 | #define json_is_integer(json) ((json) && json_typeof(json) == JSON_INTEGER)
74 | #define json_is_real(json) ((json) && json_typeof(json) == JSON_REAL)
75 | #define json_is_number(json) (json_is_integer(json) || json_is_real(json))
76 | #define json_is_true(json) ((json) && json_typeof(json) == JSON_TRUE)
77 | #define json_is_false(json) ((json) && json_typeof(json) == JSON_FALSE)
78 | #define json_boolean_value json_is_true
79 | #define json_is_boolean(json) (json_is_true(json) || json_is_false(json))
80 | #define json_is_null(json) ((json) && json_typeof(json) == JSON_NULL)
81 |
82 | /* construction, destruction, reference counting */
83 |
84 | json_t *json_object(void);
85 | json_t *json_array(void);
86 | json_t *json_string(const char *value);
87 | json_t *json_stringn(const char *value, size_t len);
88 | json_t *json_string_nocheck(const char *value);
89 | json_t *json_stringn_nocheck(const char *value, size_t len);
90 | json_t *json_integer(json_int_t value);
91 | json_t *json_real(double value);
92 | json_t *json_true(void);
93 | json_t *json_false(void);
94 | #define json_boolean(val) ((val) ? json_true() : json_false())
95 | json_t *json_null(void);
96 |
97 | static JSON_INLINE
98 | json_t *json_incref(json_t *json)
99 | {
100 | if(json && json->refcount != (size_t)-1)
101 | ++json->refcount;
102 | return json;
103 | }
104 |
105 | /* do not call json_delete directly */
106 | void json_delete(json_t *json);
107 |
108 | static JSON_INLINE
109 | void json_decref(json_t *json)
110 | {
111 | if(json && json->refcount != (size_t)-1 && --json->refcount == 0)
112 | json_delete(json);
113 | }
114 |
115 | #if defined(__GNUC__) || defined(__clang__)
116 | static JSON_INLINE
117 | void json_decrefp(json_t **json)
118 | {
119 | if(json) {
120 | json_decref(*json);
121 | *json = NULL;
122 | }
123 | }
124 |
125 | #define json_auto_t json_t __attribute__((cleanup(json_decrefp)))
126 | #endif
127 |
128 |
129 | /* error reporting */
130 |
131 | #define JSON_ERROR_TEXT_LENGTH 160
132 | #define JSON_ERROR_SOURCE_LENGTH 80
133 |
134 | typedef struct {
135 | int line;
136 | int column;
137 | int position;
138 | char source[JSON_ERROR_SOURCE_LENGTH];
139 | char text[JSON_ERROR_TEXT_LENGTH];
140 | } json_error_t;
141 |
142 |
143 | /* getters, setters, manipulation */
144 |
145 | void json_object_seed(size_t seed);
146 | size_t json_object_size(const json_t *object);
147 | json_t *json_object_get(const json_t *object, const char *key);
148 | int json_object_set_new(json_t *object, const char *key, json_t *value);
149 | int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value);
150 | int json_object_del(json_t *object, const char *key);
151 | int json_object_clear(json_t *object);
152 | int json_object_update(json_t *object, json_t *other);
153 | int json_object_update_existing(json_t *object, json_t *other);
154 | int json_object_update_missing(json_t *object, json_t *other);
155 | void *json_object_iter(json_t *object);
156 | void *json_object_iter_at(json_t *object, const char *key);
157 | void *json_object_key_to_iter(const char *key);
158 | void *json_object_iter_next(json_t *object, void *iter);
159 | const char *json_object_iter_key(void *iter);
160 | json_t *json_object_iter_value(void *iter);
161 | int json_object_iter_set_new(json_t *object, void *iter, json_t *value);
162 |
163 | #define json_object_foreach(object, key, value) \
164 | for(key = json_object_iter_key(json_object_iter(object)); \
165 | key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
166 | key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key))))
167 |
168 | #define json_object_foreach_safe(object, n, key, value) \
169 | for(key = json_object_iter_key(json_object_iter(object)), \
170 | n = json_object_iter_next(object, json_object_key_to_iter(key)); \
171 | key && (value = json_object_iter_value(json_object_key_to_iter(key))); \
172 | key = json_object_iter_key(n), \
173 | n = json_object_iter_next(object, json_object_key_to_iter(key)))
174 |
175 | #define json_array_foreach(array, index, value) \
176 | for(index = 0; \
177 | index < json_array_size(array) && (value = json_array_get(array, index)); \
178 | index++)
179 |
180 | static JSON_INLINE
181 | int json_object_set(json_t *object, const char *key, json_t *value)
182 | {
183 | return json_object_set_new(object, key, json_incref(value));
184 | }
185 |
186 | static JSON_INLINE
187 | int json_object_set_nocheck(json_t *object, const char *key, json_t *value)
188 | {
189 | return json_object_set_new_nocheck(object, key, json_incref(value));
190 | }
191 |
192 | static JSON_INLINE
193 | int json_object_iter_set(json_t *object, void *iter, json_t *value)
194 | {
195 | return json_object_iter_set_new(object, iter, json_incref(value));
196 | }
197 |
198 | size_t json_array_size(const json_t *array);
199 | json_t *json_array_get(const json_t *array, size_t index);
200 | int json_array_set_new(json_t *array, size_t index, json_t *value);
201 | int json_array_append_new(json_t *array, json_t *value);
202 | int json_array_insert_new(json_t *array, size_t index, json_t *value);
203 | int json_array_remove(json_t *array, size_t index);
204 | int json_array_clear(json_t *array);
205 | int json_array_extend(json_t *array, json_t *other);
206 |
207 | static JSON_INLINE
208 | int json_array_set(json_t *array, size_t ind, json_t *value)
209 | {
210 | return json_array_set_new(array, ind, json_incref(value));
211 | }
212 |
213 | static JSON_INLINE
214 | int json_array_append(json_t *array, json_t *value)
215 | {
216 | return json_array_append_new(array, json_incref(value));
217 | }
218 |
219 | static JSON_INLINE
220 | int json_array_insert(json_t *array, size_t ind, json_t *value)
221 | {
222 | return json_array_insert_new(array, ind, json_incref(value));
223 | }
224 |
225 | const char *json_string_value(const json_t *string);
226 | size_t json_string_length(const json_t *string);
227 | json_int_t json_integer_value(const json_t *integer);
228 | double json_real_value(const json_t *real);
229 | double json_number_value(const json_t *json);
230 |
231 | int json_string_set(json_t *string, const char *value);
232 | int json_string_setn(json_t *string, const char *value, size_t len);
233 | int json_string_set_nocheck(json_t *string, const char *value);
234 | int json_string_setn_nocheck(json_t *string, const char *value, size_t len);
235 | int json_integer_set(json_t *integer, json_int_t value);
236 | int json_real_set(json_t *real, double value);
237 |
238 | /* pack, unpack */
239 |
240 | json_t *json_pack(const char *fmt, ...);
241 | json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...);
242 | json_t *json_vpack_ex(json_error_t *error, size_t flags, const char *fmt, va_list ap);
243 |
244 | #define JSON_VALIDATE_ONLY 0x1
245 | #define JSON_STRICT 0x2
246 |
247 | int json_unpack(json_t *root, const char *fmt, ...);
248 | int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...);
249 | int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, va_list ap);
250 |
251 |
252 | /* equality */
253 |
254 | int json_equal(json_t *value1, json_t *value2);
255 |
256 |
257 | /* copying */
258 |
259 | json_t *json_copy(json_t *value);
260 | json_t *json_deep_copy(const json_t *value);
261 |
262 |
263 | /* decoding */
264 |
265 | #define JSON_REJECT_DUPLICATES 0x1
266 | #define JSON_DISABLE_EOF_CHECK 0x2
267 | #define JSON_DECODE_ANY 0x4
268 | #define JSON_DECODE_INT_AS_REAL 0x8
269 | #define JSON_ALLOW_NUL 0x10
270 |
271 | typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data);
272 |
273 | json_t *json_loads(const char *input, size_t flags, json_error_t *error);
274 | json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error);
275 | json_t *json_loadf(FILE *input, size_t flags, json_error_t *error);
276 | json_t *json_loadfd(int input, size_t flags, json_error_t *error);
277 | json_t *json_load_file(const char *path, size_t flags, json_error_t *error);
278 | json_t *json_load_callback(json_load_callback_t callback, void *data, size_t flags, json_error_t *error);
279 |
280 |
281 | /* encoding */
282 |
283 | #define JSON_MAX_INDENT 0x1F
284 | #define JSON_INDENT(n) ((n) & JSON_MAX_INDENT)
285 | #define JSON_COMPACT 0x20
286 | #define JSON_ENSURE_ASCII 0x40
287 | #define JSON_SORT_KEYS 0x80
288 | #define JSON_PRESERVE_ORDER 0x100
289 | #define JSON_ENCODE_ANY 0x200
290 | #define JSON_ESCAPE_SLASH 0x400
291 | #define JSON_REAL_PRECISION(n) (((n) & 0x1F) << 11)
292 | #define JSON_EMBED 0x10000
293 |
294 | typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data);
295 |
296 | char *json_dumps(const json_t *json, size_t flags);
297 | size_t json_dumpb(const json_t *json, char *buffer, size_t size, size_t flags);
298 | int json_dumpf(const json_t *json, FILE *output, size_t flags);
299 | int json_dumpfd(const json_t *json, int output, size_t flags);
300 | int json_dump_file(const json_t *json, const char *path, size_t flags);
301 | int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags);
302 |
303 | /* custom memory allocation */
304 |
305 | typedef void *(*json_malloc_t)(size_t);
306 | typedef void (*json_free_t)(void *);
307 |
308 | void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn);
309 | void json_get_alloc_funcs(json_malloc_t *malloc_fn, json_free_t *free_fn);
310 |
311 | #ifdef __cplusplus
312 | }
313 | #endif
314 |
315 | #endif
316 |
--------------------------------------------------------------------------------
/distribution/jansson/include/jansson_config.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2016 Petri Lehtinen
3 | *
4 | * Jansson is free software; you can redistribute it and/or modify
5 | * it under the terms of the MIT license. See LICENSE for details.
6 | *
7 | *
8 | * This file specifies a part of the site-specific configuration for
9 | * Jansson, namely those things that affect the public API in
10 | * jansson.h.
11 | *
12 | * The configure script copies this file to jansson_config.h and
13 | * replaces @var@ substitutions by values that fit your system. If you
14 | * cannot run the configure script, you can do the value substitution
15 | * by hand.
16 | */
17 |
18 | #ifndef JANSSON_CONFIG_H
19 | #define JANSSON_CONFIG_H
20 |
21 | /* If your compiler supports the inline keyword in C, JSON_INLINE is
22 | defined to `inline', otherwise empty. In C++, the inline is always
23 | supported. */
24 | #ifdef __cplusplus
25 | #define JSON_INLINE inline
26 | #else
27 | #define JSON_INLINE inline
28 | #endif
29 |
30 | /* If your compiler supports the `long long` type and the strtoll()
31 | library function, JSON_INTEGER_IS_LONG_LONG is defined to 1,
32 | otherwise to 0. */
33 | #define JSON_INTEGER_IS_LONG_LONG 1
34 |
35 | /* If locale.h and localeconv() are available, define to 1,
36 | otherwise to 0. */
37 | #define JSON_HAVE_LOCALECONV 1
38 |
39 | /* Maximum recursion depth for parsing JSON input.
40 | This limits the depth of e.g. array-within-array constructions. */
41 | #define JSON_PARSER_MAX_DEPTH 2048
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/distribution/jansson/lib/arm64-v8a/libjansson.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/jansson/lib/arm64-v8a/libjansson.a
--------------------------------------------------------------------------------
/distribution/jansson/lib/armeabi-v7a/libjansson.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/jansson/lib/armeabi-v7a/libjansson.a
--------------------------------------------------------------------------------
/distribution/jansson/lib/x86/libjansson.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/jansson/lib/x86/libjansson.a
--------------------------------------------------------------------------------
/distribution/jansson/lib/x86_64/libjansson.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/jansson/lib/x86_64/libjansson.a
--------------------------------------------------------------------------------
/distribution/jansson/lib19/armeabi-v7a/libjansson.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/jansson/lib19/armeabi-v7a/libjansson.a
--------------------------------------------------------------------------------
/distribution/jansson/lib19/x86/libjansson.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/jansson/lib19/x86/libjansson.a
--------------------------------------------------------------------------------
/distribution/zlib/include/zconf.h:
--------------------------------------------------------------------------------
1 | /* zconf.h -- configuration of the zlib compression library
2 | * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
3 | * For conditions of distribution and use, see copyright notice in zlib.h
4 | */
5 |
6 | /* @(#) $Id$ */
7 |
8 | #ifndef ZCONF_H
9 | #define ZCONF_H
10 |
11 | /*
12 | * If you *really* need a unique prefix for all types and library functions,
13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
14 | * Even better than compiling with -DZ_PREFIX would be to use configure to set
15 | * this permanently in zconf.h using "./configure --zprefix".
16 | */
17 | #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
18 | # define Z_PREFIX_SET
19 |
20 | /* all linked symbols and init macros */
21 | # define _dist_code z__dist_code
22 | # define _length_code z__length_code
23 | # define _tr_align z__tr_align
24 | # define _tr_flush_bits z__tr_flush_bits
25 | # define _tr_flush_block z__tr_flush_block
26 | # define _tr_init z__tr_init
27 | # define _tr_stored_block z__tr_stored_block
28 | # define _tr_tally z__tr_tally
29 | # define adler32 z_adler32
30 | # define adler32_combine z_adler32_combine
31 | # define adler32_combine64 z_adler32_combine64
32 | # define adler32_z z_adler32_z
33 | # ifndef Z_SOLO
34 | # define compress z_compress
35 | # define compress2 z_compress2
36 | # define compressBound z_compressBound
37 | # endif
38 | # define crc32 z_crc32
39 | # define crc32_combine z_crc32_combine
40 | # define crc32_combine64 z_crc32_combine64
41 | # define crc32_z z_crc32_z
42 | # define deflate z_deflate
43 | # define deflateBound z_deflateBound
44 | # define deflateCopy z_deflateCopy
45 | # define deflateEnd z_deflateEnd
46 | # define deflateGetDictionary z_deflateGetDictionary
47 | # define deflateInit z_deflateInit
48 | # define deflateInit2 z_deflateInit2
49 | # define deflateInit2_ z_deflateInit2_
50 | # define deflateInit_ z_deflateInit_
51 | # define deflateParams z_deflateParams
52 | # define deflatePending z_deflatePending
53 | # define deflatePrime z_deflatePrime
54 | # define deflateReset z_deflateReset
55 | # define deflateResetKeep z_deflateResetKeep
56 | # define deflateSetDictionary z_deflateSetDictionary
57 | # define deflateSetHeader z_deflateSetHeader
58 | # define deflateTune z_deflateTune
59 | # define deflate_copyright z_deflate_copyright
60 | # define get_crc_table z_get_crc_table
61 | # ifndef Z_SOLO
62 | # define gz_error z_gz_error
63 | # define gz_intmax z_gz_intmax
64 | # define gz_strwinerror z_gz_strwinerror
65 | # define gzbuffer z_gzbuffer
66 | # define gzclearerr z_gzclearerr
67 | # define gzclose z_gzclose
68 | # define gzclose_r z_gzclose_r
69 | # define gzclose_w z_gzclose_w
70 | # define gzdirect z_gzdirect
71 | # define gzdopen z_gzdopen
72 | # define gzeof z_gzeof
73 | # define gzerror z_gzerror
74 | # define gzflush z_gzflush
75 | # define gzfread z_gzfread
76 | # define gzfwrite z_gzfwrite
77 | # define gzgetc z_gzgetc
78 | # define gzgetc_ z_gzgetc_
79 | # define gzgets z_gzgets
80 | # define gzoffset z_gzoffset
81 | # define gzoffset64 z_gzoffset64
82 | # define gzopen z_gzopen
83 | # define gzopen64 z_gzopen64
84 | # ifdef _WIN32
85 | # define gzopen_w z_gzopen_w
86 | # endif
87 | # define gzprintf z_gzprintf
88 | # define gzputc z_gzputc
89 | # define gzputs z_gzputs
90 | # define gzread z_gzread
91 | # define gzrewind z_gzrewind
92 | # define gzseek z_gzseek
93 | # define gzseek64 z_gzseek64
94 | # define gzsetparams z_gzsetparams
95 | # define gztell z_gztell
96 | # define gztell64 z_gztell64
97 | # define gzungetc z_gzungetc
98 | # define gzvprintf z_gzvprintf
99 | # define gzwrite z_gzwrite
100 | # endif
101 | # define inflate z_inflate
102 | # define inflateBack z_inflateBack
103 | # define inflateBackEnd z_inflateBackEnd
104 | # define inflateBackInit z_inflateBackInit
105 | # define inflateBackInit_ z_inflateBackInit_
106 | # define inflateCodesUsed z_inflateCodesUsed
107 | # define inflateCopy z_inflateCopy
108 | # define inflateEnd z_inflateEnd
109 | # define inflateGetDictionary z_inflateGetDictionary
110 | # define inflateGetHeader z_inflateGetHeader
111 | # define inflateInit z_inflateInit
112 | # define inflateInit2 z_inflateInit2
113 | # define inflateInit2_ z_inflateInit2_
114 | # define inflateInit_ z_inflateInit_
115 | # define inflateMark z_inflateMark
116 | # define inflatePrime z_inflatePrime
117 | # define inflateReset z_inflateReset
118 | # define inflateReset2 z_inflateReset2
119 | # define inflateResetKeep z_inflateResetKeep
120 | # define inflateSetDictionary z_inflateSetDictionary
121 | # define inflateSync z_inflateSync
122 | # define inflateSyncPoint z_inflateSyncPoint
123 | # define inflateUndermine z_inflateUndermine
124 | # define inflateValidate z_inflateValidate
125 | # define inflate_copyright z_inflate_copyright
126 | # define inflate_fast z_inflate_fast
127 | # define inflate_table z_inflate_table
128 | # ifndef Z_SOLO
129 | # define uncompress z_uncompress
130 | # define uncompress2 z_uncompress2
131 | # endif
132 | # define zError z_zError
133 | # ifndef Z_SOLO
134 | # define zcalloc z_zcalloc
135 | # define zcfree z_zcfree
136 | # endif
137 | # define zlibCompileFlags z_zlibCompileFlags
138 | # define zlibVersion z_zlibVersion
139 |
140 | /* all zlib typedefs in zlib.h and zconf.h */
141 | # define Byte z_Byte
142 | # define Bytef z_Bytef
143 | # define alloc_func z_alloc_func
144 | # define charf z_charf
145 | # define free_func z_free_func
146 | # ifndef Z_SOLO
147 | # define gzFile z_gzFile
148 | # endif
149 | # define gz_header z_gz_header
150 | # define gz_headerp z_gz_headerp
151 | # define in_func z_in_func
152 | # define intf z_intf
153 | # define out_func z_out_func
154 | # define uInt z_uInt
155 | # define uIntf z_uIntf
156 | # define uLong z_uLong
157 | # define uLongf z_uLongf
158 | # define voidp z_voidp
159 | # define voidpc z_voidpc
160 | # define voidpf z_voidpf
161 |
162 | /* all zlib structs in zlib.h and zconf.h */
163 | # define gz_header_s z_gz_header_s
164 | # define internal_state z_internal_state
165 |
166 | #endif
167 |
168 | #if defined(__MSDOS__) && !defined(MSDOS)
169 | # define MSDOS
170 | #endif
171 | #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
172 | # define OS2
173 | #endif
174 | #if defined(_WINDOWS) && !defined(WINDOWS)
175 | # define WINDOWS
176 | #endif
177 | #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
178 | # ifndef WIN32
179 | # define WIN32
180 | # endif
181 | #endif
182 | #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
183 | # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
184 | # ifndef SYS16BIT
185 | # define SYS16BIT
186 | # endif
187 | # endif
188 | #endif
189 |
190 | /*
191 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
192 | * than 64k bytes at a time (needed on systems with 16-bit int).
193 | */
194 | #ifdef SYS16BIT
195 | # define MAXSEG_64K
196 | #endif
197 | #ifdef MSDOS
198 | # define UNALIGNED_OK
199 | #endif
200 |
201 | #ifdef __STDC_VERSION__
202 | # ifndef STDC
203 | # define STDC
204 | # endif
205 | # if __STDC_VERSION__ >= 199901L
206 | # ifndef STDC99
207 | # define STDC99
208 | # endif
209 | # endif
210 | #endif
211 | #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
212 | # define STDC
213 | #endif
214 | #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
215 | # define STDC
216 | #endif
217 | #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
218 | # define STDC
219 | #endif
220 | #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
221 | # define STDC
222 | #endif
223 |
224 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
225 | # define STDC
226 | #endif
227 |
228 | #ifndef STDC
229 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
230 | # define const /* note: need a more gentle solution here */
231 | # endif
232 | #endif
233 |
234 | #if defined(ZLIB_CONST) && !defined(z_const)
235 | # define z_const const
236 | #else
237 | # define z_const
238 | #endif
239 |
240 | #ifdef Z_SOLO
241 | typedef unsigned long z_size_t;
242 | #else
243 | # define z_longlong long long
244 | # if defined(NO_SIZE_T)
245 | typedef unsigned NO_SIZE_T z_size_t;
246 | # elif defined(STDC)
247 | # include
248 | typedef size_t z_size_t;
249 | # else
250 | typedef unsigned long z_size_t;
251 | # endif
252 | # undef z_longlong
253 | #endif
254 |
255 | /* Maximum value for memLevel in deflateInit2 */
256 | #ifndef MAX_MEM_LEVEL
257 | # ifdef MAXSEG_64K
258 | # define MAX_MEM_LEVEL 8
259 | # else
260 | # define MAX_MEM_LEVEL 9
261 | # endif
262 | #endif
263 |
264 | /* Maximum value for windowBits in deflateInit2 and inflateInit2.
265 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
266 | * created by gzip. (Files created by minigzip can still be extracted by
267 | * gzip.)
268 | */
269 | #ifndef MAX_WBITS
270 | # define MAX_WBITS 15 /* 32K LZ77 window */
271 | #endif
272 |
273 | /* The memory requirements for deflate are (in bytes):
274 | (1 << (windowBits+2)) + (1 << (memLevel+9))
275 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
276 | plus a few kilobytes for small objects. For example, if you want to reduce
277 | the default memory requirements from 256K to 128K, compile with
278 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
279 | Of course this will generally degrade compression (there's no free lunch).
280 |
281 | The memory requirements for inflate are (in bytes) 1 << windowBits
282 | that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
283 | for small objects.
284 | */
285 |
286 | /* Type declarations */
287 |
288 | #ifndef OF /* function prototypes */
289 | # ifdef STDC
290 | # define OF(args) args
291 | # else
292 | # define OF(args) ()
293 | # endif
294 | #endif
295 |
296 | #ifndef Z_ARG /* function prototypes for stdarg */
297 | # if defined(STDC) || defined(Z_HAVE_STDARG_H)
298 | # define Z_ARG(args) args
299 | # else
300 | # define Z_ARG(args) ()
301 | # endif
302 | #endif
303 |
304 | /* The following definitions for FAR are needed only for MSDOS mixed
305 | * model programming (small or medium model with some far allocations).
306 | * This was tested only with MSC; for other MSDOS compilers you may have
307 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
308 | * just define FAR to be empty.
309 | */
310 | #ifdef SYS16BIT
311 | # if defined(M_I86SM) || defined(M_I86MM)
312 | /* MSC small or medium model */
313 | # define SMALL_MEDIUM
314 | # ifdef _MSC_VER
315 | # define FAR _far
316 | # else
317 | # define FAR far
318 | # endif
319 | # endif
320 | # if (defined(__SMALL__) || defined(__MEDIUM__))
321 | /* Turbo C small or medium model */
322 | # define SMALL_MEDIUM
323 | # ifdef __BORLANDC__
324 | # define FAR _far
325 | # else
326 | # define FAR far
327 | # endif
328 | # endif
329 | #endif
330 |
331 | #if defined(WINDOWS) || defined(WIN32)
332 | /* If building or using zlib as a DLL, define ZLIB_DLL.
333 | * This is not mandatory, but it offers a little performance increase.
334 | */
335 | # ifdef ZLIB_DLL
336 | # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
337 | # ifdef ZLIB_INTERNAL
338 | # define ZEXTERN extern __declspec(dllexport)
339 | # else
340 | # define ZEXTERN extern __declspec(dllimport)
341 | # endif
342 | # endif
343 | # endif /* ZLIB_DLL */
344 | /* If building or using zlib with the WINAPI/WINAPIV calling convention,
345 | * define ZLIB_WINAPI.
346 | * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
347 | */
348 | # ifdef ZLIB_WINAPI
349 | # ifdef FAR
350 | # undef FAR
351 | # endif
352 | # include
353 | /* No need for _export, use ZLIB.DEF instead. */
354 | /* For complete Windows compatibility, use WINAPI, not __stdcall. */
355 | # define ZEXPORT WINAPI
356 | # ifdef WIN32
357 | # define ZEXPORTVA WINAPIV
358 | # else
359 | # define ZEXPORTVA FAR CDECL
360 | # endif
361 | # endif
362 | #endif
363 |
364 | #if defined (__BEOS__)
365 | # ifdef ZLIB_DLL
366 | # ifdef ZLIB_INTERNAL
367 | # define ZEXPORT __declspec(dllexport)
368 | # define ZEXPORTVA __declspec(dllexport)
369 | # else
370 | # define ZEXPORT __declspec(dllimport)
371 | # define ZEXPORTVA __declspec(dllimport)
372 | # endif
373 | # endif
374 | #endif
375 |
376 | #ifndef ZEXTERN
377 | # define ZEXTERN extern
378 | #endif
379 | #ifndef ZEXPORT
380 | # define ZEXPORT
381 | #endif
382 | #ifndef ZEXPORTVA
383 | # define ZEXPORTVA
384 | #endif
385 |
386 | #ifndef FAR
387 | # define FAR
388 | #endif
389 |
390 | #if !defined(__MACTYPES__)
391 | typedef unsigned char Byte; /* 8 bits */
392 | #endif
393 | typedef unsigned int uInt; /* 16 bits or more */
394 | typedef unsigned long uLong; /* 32 bits or more */
395 |
396 | #ifdef SMALL_MEDIUM
397 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
398 | # define Bytef Byte FAR
399 | #else
400 | typedef Byte FAR Bytef;
401 | #endif
402 | typedef char FAR charf;
403 | typedef int FAR intf;
404 | typedef uInt FAR uIntf;
405 | typedef uLong FAR uLongf;
406 |
407 | #ifdef STDC
408 | typedef void const *voidpc;
409 | typedef void FAR *voidpf;
410 | typedef void *voidp;
411 | #else
412 | typedef Byte const *voidpc;
413 | typedef Byte FAR *voidpf;
414 | typedef Byte *voidp;
415 | #endif
416 |
417 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
418 | # include
419 | # if (UINT_MAX == 0xffffffffUL)
420 | # define Z_U4 unsigned
421 | # elif (ULONG_MAX == 0xffffffffUL)
422 | # define Z_U4 unsigned long
423 | # elif (USHRT_MAX == 0xffffffffUL)
424 | # define Z_U4 unsigned short
425 | # endif
426 | #endif
427 |
428 | #ifdef Z_U4
429 | typedef Z_U4 z_crc_t;
430 | #else
431 | typedef unsigned long z_crc_t;
432 | #endif
433 |
434 | #if 1 /* was set to #if 1 by ./configure */
435 | # define Z_HAVE_UNISTD_H
436 | #endif
437 |
438 | #if 1 /* was set to #if 1 by ./configure */
439 | # define Z_HAVE_STDARG_H
440 | #endif
441 |
442 | #ifdef STDC
443 | # ifndef Z_SOLO
444 | # include /* for off_t */
445 | # endif
446 | #endif
447 |
448 | #if defined(STDC) || defined(Z_HAVE_STDARG_H)
449 | # ifndef Z_SOLO
450 | # include /* for va_list */
451 | # endif
452 | #endif
453 |
454 | #ifdef _WIN32
455 | # ifndef Z_SOLO
456 | # include /* for wchar_t */
457 | # endif
458 | #endif
459 |
460 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
461 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
462 | * though the former does not conform to the LFS document), but considering
463 | * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
464 | * equivalently requesting no 64-bit operations
465 | */
466 | #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
467 | # undef _LARGEFILE64_SOURCE
468 | #endif
469 |
470 | #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
471 | # define Z_HAVE_UNISTD_H
472 | #endif
473 | #ifndef Z_SOLO
474 | # if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
475 | # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
476 | # ifdef VMS
477 | # include /* for off_t */
478 | # endif
479 | # ifndef z_off_t
480 | # define z_off_t off_t
481 | # endif
482 | # endif
483 | #endif
484 |
485 | #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
486 | # define Z_LFS64
487 | #endif
488 |
489 | #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
490 | # define Z_LARGE64
491 | #endif
492 |
493 | #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
494 | # define Z_WANT64
495 | #endif
496 |
497 | #if !defined(SEEK_SET) && !defined(Z_SOLO)
498 | # define SEEK_SET 0 /* Seek from beginning of file. */
499 | # define SEEK_CUR 1 /* Seek from current position. */
500 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
501 | #endif
502 |
503 | #ifndef z_off_t
504 | # define z_off_t long
505 | #endif
506 |
507 | #if !defined(_WIN32) && defined(Z_LARGE64)
508 | # define z_off64_t off64_t
509 | #else
510 | # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
511 | # define z_off64_t __int64
512 | # else
513 | # define z_off64_t z_off_t
514 | # endif
515 | #endif
516 |
517 | /* MVS linker does not support external names larger than 8 bytes */
518 | #if defined(__MVS__)
519 | #pragma map(deflateInit_,"DEIN")
520 | #pragma map(deflateInit2_,"DEIN2")
521 | #pragma map(deflateEnd,"DEEND")
522 | #pragma map(deflateBound,"DEBND")
523 | #pragma map(inflateInit_,"ININ")
524 | #pragma map(inflateInit2_,"ININ2")
525 | #pragma map(inflateEnd,"INEND")
526 | #pragma map(inflateSync,"INSY")
527 | #pragma map(inflateSetDictionary,"INSEDI")
528 | #pragma map(compressBound,"CMBND")
529 | #pragma map(inflate_table,"INTABL")
530 | #pragma map(inflate_fast,"INFA")
531 | #pragma map(inflate_copyright,"INCOPY")
532 | #endif
533 |
534 | #endif /* ZCONF_H */
535 |
--------------------------------------------------------------------------------
/distribution/zlib/lib/arm64-v8a/libz.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/zlib/lib/arm64-v8a/libz.a
--------------------------------------------------------------------------------
/distribution/zlib/lib/armeabi-v7a/libz.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/zlib/lib/armeabi-v7a/libz.a
--------------------------------------------------------------------------------
/distribution/zlib/lib/x86/libz.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/zlib/lib/x86/libz.a
--------------------------------------------------------------------------------
/distribution/zlib/lib/x86_64/libz.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/zlib/lib/x86_64/libz.a
--------------------------------------------------------------------------------
/distribution/zlib/lib19/armeabi-v7a/libz.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/zlib/lib19/armeabi-v7a/libz.a
--------------------------------------------------------------------------------
/distribution/zlib/lib19/x86/libz.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/distribution/zlib/lib19/x86/libz.a
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OttyLab/BitZenyAndroidMiningLibrary/38afa0a108332c3f4d9a858f3831458adb6b207d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jul 27 23:25:27 JST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':bitzenymininglibrary'
2 |
--------------------------------------------------------------------------------