mirror of
https://github.com/Meituan-Dianping/Logan.git
synced 2025-12-08 19:25:57 +00:00
init open source
This commit is contained in:
parent
fc8028ad85
commit
a541f04c86
49
CONTRIBUTING.md
Normal file
49
CONTRIBUTING.md
Normal file
@ -0,0 +1,49 @@
|
||||
# Contributing to Logan
|
||||
|
||||
Logan is a lightweight case logging system based on mobile platform developed by Meituan-Dianping
|
||||
|
||||
## Development Process
|
||||
|
||||
### Pull Requests
|
||||
|
||||
Please submit your pull request on the *master* branch.
|
||||
|
||||
*Before* submitting a pull request, please make sure the following is done…
|
||||
|
||||
1. Fork the repo and create your branch from `master`.
|
||||
2. Add the copyright notice to the top of any new files you've added.
|
||||
3. **Format your code**.
|
||||
4. **Make sure your code can compile**.
|
||||
5. Squash your commits (`git rebase -i`).
|
||||
|
||||
#### Copyright Notice for files
|
||||
|
||||
Copy and paste this to the top of your new file(s):
|
||||
|
||||
```
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
By contributing to Logan, you agree that your contributions will be licensed under its MIT License.
|
||||
9
Example/Logan-Android/.gitignore
vendored
Normal file
9
Example/Logan-Android/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
1
Example/Logan-Android/app/.gitignore
vendored
Normal file
1
Example/Logan-Android/app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
31
Example/Logan-Android/app/build.gradle
Normal file
31
Example/Logan-Android/app/build.gradle
Normal file
@ -0,0 +1,31 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "25.0.2"
|
||||
defaultConfig {
|
||||
applicationId "test.logan.dianping.com.logan"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile project(':logan')
|
||||
// releaseCompile project(path: ':logan', configuration: 'release')
|
||||
// debugCompile project(path: ':logan', configuration: 'debug')
|
||||
}
|
||||
25
Example/Logan-Android/app/proguard-rules.pro
vendored
Normal file
25
Example/Logan-Android/app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/baitian0521/Library/Android/sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,26 @@
|
||||
package test.logan.dianping.com.logan;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Instrumentation test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("test.logan.dianping.com.logan", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
19
Example/Logan-Android/app/src/main/AndroidManifest.xml
Normal file
19
Example/Logan-Android/app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="test.logan.dianping.com.logan">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package test.logan.dianping.com.logan;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.dianping.logan.Logan;
|
||||
import com.dianping.logan.LoganConfig;
|
||||
import com.dianping.logan.OnLoganProtocolStatus;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private static final String FILE_NAME = "logan_v1";
|
||||
private static final String TAG = MainActivity.class.getName();
|
||||
|
||||
private TextView mTvInfo;
|
||||
private EditText mEditIp;
|
||||
private RealSendLogRunnable mSendLogRunnable;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
LoganConfig config = new LoganConfig.Builder()
|
||||
.setCachePath(getApplicationContext().getFilesDir().getAbsolutePath())
|
||||
.setPath(getApplicationContext().getExternalFilesDir(null).getAbsolutePath()
|
||||
+ File.separator + FILE_NAME)
|
||||
.setEncryptKey16("0123456789012345".getBytes())
|
||||
.setEncryptIV16("0123456789012345".getBytes())
|
||||
.build();
|
||||
Logan.init(config);
|
||||
Logan.setDebug(true);
|
||||
Logan.setOnLoganProtocolStatus(new OnLoganProtocolStatus() {
|
||||
@Override
|
||||
public void loganProtocolStatus(String cmd, int code) {
|
||||
Log.d(TAG, "clogan > cmd : " + cmd + " | " + "code : " + code);
|
||||
}
|
||||
});
|
||||
mSendLogRunnable = new RealSendLogRunnable();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
Button button = (Button) findViewById(R.id.write_btn);
|
||||
Button sendBtn = (Button) findViewById(R.id.send_btn);
|
||||
Button logFileBtn = (Button) findViewById(R.id.show_log_file_btn);
|
||||
mTvInfo = (TextView) findViewById(R.id.info);
|
||||
mEditIp = (EditText) findViewById(R.id.send_ip);
|
||||
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loganTest();
|
||||
}
|
||||
});
|
||||
sendBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loganSend();
|
||||
}
|
||||
});
|
||||
logFileBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loganFilesInfo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loganTest() {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
try {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
Log.d(TAG, "times : " + i);
|
||||
Logan.w(String.valueOf(i), 1);
|
||||
Thread.sleep(5);
|
||||
}
|
||||
Log.d(TAG, "write log end");
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
private void loganSend() {
|
||||
SimpleDateFormat dataFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String d = dataFormat.format(new Date(System.currentTimeMillis()));
|
||||
String[] temp = new String[1];
|
||||
temp[0] = d;
|
||||
String ip = mEditIp.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(ip)) {
|
||||
mSendLogRunnable.setIp(ip);
|
||||
}
|
||||
Logan.s(temp, mSendLogRunnable);
|
||||
}
|
||||
|
||||
private void loganFilesInfo() {
|
||||
Map<String, Long> map = Logan.getAllFilesInfo();
|
||||
if (map != null) {
|
||||
StringBuilder info = new StringBuilder();
|
||||
for (Map.Entry<String, Long> entry : map.entrySet()) {
|
||||
info.append("文件日期:").append(entry.getKey()).append(" 文件大小(bytes):").append(
|
||||
entry.getValue()).append("\n");
|
||||
}
|
||||
mTvInfo.setText(info.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package test.logan.dianping.com.logan;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.dianping.logan.SendLogRunnable;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
public class RealSendLogRunnable extends SendLogRunnable {
|
||||
private String mUploadLogUrl = "http://localhost:3000/logupload";
|
||||
|
||||
@Override
|
||||
public void sendLog(File logFile) {
|
||||
boolean success = doSendFileByAction(logFile);
|
||||
Log.d("上传日志测试", "日志上传测试结果:" + success);
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
mUploadLogUrl = "http://" + ip + ":3000/logupload";
|
||||
}
|
||||
|
||||
private HashMap<String, String> getActionHeader() {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("Content-Type", "binary/octet-stream"); //二进制上传
|
||||
map.put("client", "android");
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主动上报
|
||||
*/
|
||||
private boolean doSendFileByAction(File logFile) {
|
||||
boolean isSuccess = false;
|
||||
try {
|
||||
FileInputStream fileStream = new FileInputStream(logFile);
|
||||
byte[] backData = doPostRequest(mUploadLogUrl, fileStream, getActionHeader());
|
||||
isSuccess = handleSendLogBackData(backData);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
private byte[] doPostRequest(String url, InputStream inputData, Map<String, String> headerMap) {
|
||||
byte[] data = null;
|
||||
OutputStream outputStream = null;
|
||||
InputStream inputStream = null;
|
||||
HttpURLConnection c = null;
|
||||
ByteArrayOutputStream back;
|
||||
byte[] Buffer = new byte[2048];
|
||||
try {
|
||||
java.net.URL u = new URL(url);
|
||||
c = (HttpURLConnection) u.openConnection();
|
||||
if (c instanceof HttpsURLConnection) {
|
||||
((HttpsURLConnection) c).setHostnameVerifier(new HostnameVerifier() {
|
||||
@Override
|
||||
public boolean verify(String hostname, SSLSession session) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
Set<Map.Entry<String, String>> entrySet = headerMap.entrySet();
|
||||
for (Map.Entry<String, String> tempEntry : entrySet) {
|
||||
c.addRequestProperty(tempEntry.getKey(), tempEntry.getValue());
|
||||
}
|
||||
c.setReadTimeout(15000);
|
||||
c.setConnectTimeout(15000);
|
||||
c.setDoInput(true);
|
||||
c.setDoOutput(true);
|
||||
c.setRequestMethod("POST");
|
||||
outputStream = c.getOutputStream();
|
||||
int i;
|
||||
while ((i = inputData.read(Buffer)) != -1) {
|
||||
outputStream.write(Buffer, 0, i);
|
||||
}
|
||||
outputStream.flush();
|
||||
int res = c.getResponseCode();
|
||||
if (res == 200) {
|
||||
back = new ByteArrayOutputStream();
|
||||
inputStream = c.getInputStream();
|
||||
while ((i = inputStream.read(Buffer)) != -1) {
|
||||
back.write(Buffer, 0, i);
|
||||
}
|
||||
data = back.toByteArray();
|
||||
}
|
||||
} catch (ProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (outputStream != null) {
|
||||
try {
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (inputData != null) {
|
||||
try {
|
||||
inputData.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (c != null) {
|
||||
c.disconnect();
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理上传日志接口返回的数据
|
||||
*/
|
||||
private boolean handleSendLogBackData(byte[] backData) throws JSONException {
|
||||
boolean isSuccess = false;
|
||||
if (backData != null) {
|
||||
String data = new String(backData);
|
||||
if (!TextUtils.isEmpty(data)) {
|
||||
JSONObject jsonObj = new JSONObject(data);
|
||||
if (jsonObj.optBoolean("success", false)) {
|
||||
isSuccess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/write_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="测试Logan写入"
|
||||
android:textColor="@android:color/black"/>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/send_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="测试Logan上报"
|
||||
android:textColor="@android:color/black"/>
|
||||
<EditText
|
||||
android:id="@+id/send_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="请输入server的ip地址"
|
||||
android:textColor="@android:color/black"/>
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/show_log_file_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="查看所有日志文件信息"
|
||||
android:textColor="@android:color/black"/>
|
||||
<TextView
|
||||
android:id="@+id/info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/black"/>
|
||||
</LinearLayout>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Logan Demo</string>
|
||||
</resources>
|
||||
@ -0,0 +1,17 @@
|
||||
package test.logan.dianping.com.logan;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
32
Example/Logan-Android/build.gradle
Normal file
32
Example/Logan-Android/build.gradle
Normal file
@ -0,0 +1,32 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
url 'https://maven.google.com/'
|
||||
name 'Google'
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
url 'https://maven.google.com/'
|
||||
name 'Google'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
17
Example/Logan-Android/gradle.properties
Normal file
17
Example/Logan-Android/gradle.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
BIN
Example/Logan-Android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
Example/Logan-Android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
Example/Logan-Android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
Example/Logan-Android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Thu Aug 10 17:35:04 CST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
160
Example/Logan-Android/gradlew
vendored
Executable file
160
Example/Logan-Android/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
90
Example/Logan-Android/gradlew.bat
vendored
Normal file
90
Example/Logan-Android/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
1
Example/Logan-Android/logan/.gitignore
vendored
Normal file
1
Example/Logan-Android/logan/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
27
Example/Logan-Android/logan/CMakeLists.txt
Normal file
27
Example/Logan-Android/logan/CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
SET (CMAKE_C_FLAGS_DEBUG "-g")
|
||||
SET (CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
|
||||
set(EXTERN_DIR ../../../Logan/Clogan)
|
||||
|
||||
add_subdirectory(${EXTERN_DIR} clogan.out)
|
||||
|
||||
include_directories(${EXTERN_DIR})
|
||||
|
||||
link_directories(clogan.out)
|
||||
|
||||
|
||||
find_library( # Sets the name of the path variable.
|
||||
log-lib
|
||||
|
||||
# Specifies the name of the NDK library that
|
||||
# you want CMake to locate.
|
||||
log )
|
||||
|
||||
# Specifies libraries CMake should link to your target library. You
|
||||
# can link multiple libraries, such as libraries you define in this
|
||||
# build script, prebuilt third-party libraries, or system libraries.
|
||||
|
||||
add_library(logan SHARED src/main/jni/clogan_protocol.c)
|
||||
target_link_libraries(logan ${log-lib} z clogan)
|
||||
51
Example/Logan-Android/logan/build.gradle
Normal file
51
Example/Logan-Android/logan/build.gradle
Normal file
@ -0,0 +1,51 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
// publishNonDefault true
|
||||
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "25.0.2"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DBUILD_TESTING=OFF', '-DANDROID_TOOLCHAIN=gcc'
|
||||
cFlags "-std=c11"
|
||||
}
|
||||
}
|
||||
|
||||
ndk {
|
||||
abiFilters 'armeabi', 'x86'
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
jniDebuggable true
|
||||
testCoverageEnabled true
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
33
Example/Logan-Android/logan/proguard-rules.pro
vendored
Normal file
33
Example/Logan-Android/logan/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/baitian0521/Library/Android/sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
-keep public class com.dianping.logan.CLoganProtocol{ *; }
|
||||
-keep public class com.dianping.logan.Logan{ *; }
|
||||
-keep public class com.dianping.logan.LoganConfig{ *; }
|
||||
-keep public class com.dianping.logan.LoganConfig$Builder{ *; }
|
||||
-keep public class com.dianping.logan.SendLogRunnable{ *; }
|
||||
-keep public interface com.dianping.logan.LoganProtocolHandler{ *; }
|
||||
-keep public interface com.dianping.logan.OnLoganProtocolStatus{ *; }
|
||||
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.util.Log;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Instrumentation test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class LoganTest {
|
||||
private static final String TAG = LoganTest.class.getName();
|
||||
private static final String FILE_NAME = "logan" + "_vtest";
|
||||
|
||||
private SimpleDateFormat mDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private CountDownLatch mLatch;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mLatch = new CountDownLatch(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test001Init() {
|
||||
Context applicationContext = InstrumentationRegistry.getTargetContext();
|
||||
LoganConfig config = new LoganConfig.Builder()
|
||||
.setCachePath(applicationContext.getFilesDir().getAbsolutePath())
|
||||
.setPath(applicationContext.getExternalFilesDir(null).getAbsolutePath()
|
||||
+ File.separator + FILE_NAME)
|
||||
.setEncryptKey16("0123456789012345".getBytes())
|
||||
.setEncryptIV16("0123456789012345".getBytes())
|
||||
.build();
|
||||
Logan.init(config);
|
||||
Logan.setDebug(true);
|
||||
Logan.setOnLoganProtocolStatus(new OnLoganProtocolStatus() {
|
||||
@Override
|
||||
public void loganProtocolStatus(String cmd, int code) {
|
||||
Log.d(TAG, "clogan > cmd : " + cmd + " | " + "code : " + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test002LoganW() throws InterruptedException {
|
||||
Logan.w("Logan junit test write function", 1);
|
||||
assertWriteLog();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test003LoganF() {
|
||||
Logan.f();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test004LoganS() {
|
||||
SendLogRunnable sendLogRunnable = new SendLogRunnable() {
|
||||
@Override
|
||||
public void sendLog(File logFile) {
|
||||
|
||||
}
|
||||
};
|
||||
Logan.s(getTodayDate(), sendLogRunnable);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test005LoganFilesInfo() {
|
||||
Map<String, Long> map = Logan.getAllFilesInfo();
|
||||
if (map != null) {
|
||||
StringBuilder info = new StringBuilder();
|
||||
for (Map.Entry<String, Long> entry : map.entrySet()) {
|
||||
info.append("文件日期:").append(entry.getKey()).append(" 文件大小(bytes):").append(
|
||||
entry.getValue()).append("\n");
|
||||
}
|
||||
Log.d(TAG, info.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
private String[] getTodayDate() {
|
||||
String d = mDateFormat.format(new Date(System.currentTimeMillis()));
|
||||
String[] temp = new String[1];
|
||||
temp[0] = d;
|
||||
return temp;
|
||||
}
|
||||
|
||||
private void assertWriteLog() throws InterruptedException {
|
||||
final int[] statusCode = new int[1];
|
||||
Logan.setOnLoganProtocolStatus(new OnLoganProtocolStatus() {
|
||||
@Override
|
||||
public void loganProtocolStatus(String cmd, int code) {
|
||||
statusCode[0] = code;
|
||||
if (cmd.equals(ConstantCode.CloganStatus.CLOGAN_WRITE_STATUS)) {
|
||||
mLatch.countDown();
|
||||
assertEquals(ConstantCode.CloganStatus.CLOGAN_WRITE_SUCCESS, code);
|
||||
}
|
||||
}
|
||||
});
|
||||
mLatch.await(2333, TimeUnit.MILLISECONDS);
|
||||
assertEquals("write状态码", ConstantCode.CloganStatus.CLOGAN_WRITE_SUCCESS, statusCode[0]);
|
||||
}
|
||||
}
|
||||
13
Example/Logan-Android/logan/src/main/AndroidManifest.xml
Normal file
13
Example/Logan-Android/logan/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.dianping.logan">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
|
||||
<application android:allowBackup="true" android:label="@string/app_name"
|
||||
android:supportsRtl="true">
|
||||
</application>
|
||||
</manifest>
|
||||
@ -0,0 +1,198 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
class CLoganProtocol implements LoganProtocolHandler {
|
||||
|
||||
private static final String LIBRARY_NAME = "logan";
|
||||
|
||||
private static CLoganProtocol sCLoganProtocol;
|
||||
private static boolean sIsCloganOk;
|
||||
|
||||
private boolean mIsLoganInit;
|
||||
private boolean mIsLoganOpen;
|
||||
private OnLoganProtocolStatus mLoganProtocolStatus;
|
||||
private Set<Integer> mArraySet = Collections.synchronizedSet(new HashSet<Integer>());
|
||||
|
||||
static {
|
||||
try {
|
||||
if (!Util.loadLibrary(LIBRARY_NAME, CLoganProtocol.class)) {
|
||||
System.loadLibrary(LIBRARY_NAME);
|
||||
}
|
||||
sIsCloganOk = true;
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
sIsCloganOk = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCloganSuccess() {
|
||||
return sIsCloganOk;
|
||||
}
|
||||
|
||||
public static CLoganProtocol newInstance() {
|
||||
if (sCLoganProtocol == null) {
|
||||
synchronized (CLoganProtocol.class) {
|
||||
if (sCLoganProtocol == null) {
|
||||
sCLoganProtocol = new CLoganProtocol();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sCLoganProtocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化Clogan
|
||||
*
|
||||
* @param dir_path 目录路径
|
||||
* @param max_file 最大文件值
|
||||
*/
|
||||
private native int clogan_init(String cache_path, String dir_path, int max_file,
|
||||
String encrypt_key_16, String encrypt_iv_16);
|
||||
|
||||
private native int clogan_open(String file_name);
|
||||
|
||||
private native void clogan_debug(boolean is_debug);
|
||||
|
||||
/**
|
||||
* @param flag 日志类型
|
||||
* @param log 日志内容
|
||||
* @param local_time 本地时间
|
||||
* @param thread_name 线程名称
|
||||
* @param thread_id 线程ID
|
||||
* @param is_main 是否主线程
|
||||
*/
|
||||
private native int clogan_write(int flag, String log, long local_time, String thread_name,
|
||||
long thread_id, int is_main);
|
||||
|
||||
private native void clogan_flush();
|
||||
|
||||
@Override
|
||||
public void logan_init(String cache_path, String dir_path, int max_file, String encrypt_key_16,
|
||||
String encrypt_iv_16) {
|
||||
if (mIsLoganInit) {
|
||||
return;
|
||||
}
|
||||
if (!sIsCloganOk) {
|
||||
loganStatusCode(ConstantCode.CloganStatus.CLOGAN_LOAD_SO,
|
||||
ConstantCode.CloganStatus.CLOGAN_LOAD_SO_FAIL);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
int code = clogan_init(cache_path, dir_path, max_file, encrypt_key_16, encrypt_iv_16);
|
||||
mIsLoganInit = true;
|
||||
loganStatusCode(ConstantCode.CloganStatus.CLGOAN_INIT_STATUS, code);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
e.printStackTrace();
|
||||
loganStatusCode(ConstantCode.CloganStatus.CLGOAN_INIT_STATUS,
|
||||
ConstantCode.CloganStatus.CLOGAN_INIT_FAIL_JNI);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_debug(boolean debug) {
|
||||
if (!mIsLoganInit || !sIsCloganOk) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
clogan_debug(debug);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnLoganProtocolStatus(OnLoganProtocolStatus listener) {
|
||||
mLoganProtocolStatus = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_open(String file_name) {
|
||||
if (!mIsLoganInit || !sIsCloganOk) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
int code = clogan_open(file_name);
|
||||
mIsLoganOpen = true;
|
||||
loganStatusCode(ConstantCode.CloganStatus.CLOGAN_OPEN_STATUS, code);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
e.printStackTrace();
|
||||
loganStatusCode(ConstantCode.CloganStatus.CLOGAN_OPEN_STATUS,
|
||||
ConstantCode.CloganStatus.CLOGAN_OPEN_FAIL_JNI);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_flush() {
|
||||
if (!mIsLoganOpen || !sIsCloganOk) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
clogan_flush();
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_write(int flag, String log, long local_time, String thread_name,
|
||||
long thread_id, boolean is_main) {
|
||||
if (!mIsLoganOpen || !sIsCloganOk) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
int isMain = is_main ? 1 : 0;
|
||||
int code = clogan_write(flag, log, local_time, thread_name, thread_id,
|
||||
isMain);
|
||||
if (code != ConstantCode.CloganStatus.CLOGAN_WRITE_SUCCESS || Logan.sDebug) {
|
||||
loganStatusCode(ConstantCode.CloganStatus.CLOGAN_WRITE_STATUS, code);
|
||||
}
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
e.printStackTrace();
|
||||
loganStatusCode(ConstantCode.CloganStatus.CLOGAN_WRITE_STATUS,
|
||||
ConstantCode.CloganStatus.CLOGAN_WRITE_FAIL_JNI);
|
||||
}
|
||||
}
|
||||
|
||||
private void loganStatusCode(String cmd, int code) {
|
||||
if (code < 0) {
|
||||
if (ConstantCode.CloganStatus.CLOGAN_WRITE_STATUS.endsWith(cmd)
|
||||
&& code != ConstantCode.CloganStatus.CLOGAN_WRITE_FAIL_JNI) {
|
||||
if (mArraySet.contains(code)) {
|
||||
return;
|
||||
} else {
|
||||
mArraySet.add(code);
|
||||
}
|
||||
}
|
||||
if (mLoganProtocolStatus != null) {
|
||||
mLoganProtocolStatus.loganProtocolStatus(cmd, code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
public class ConstantCode {
|
||||
|
||||
public static class CloganStatus {
|
||||
public static final String CLGOAN_INIT_STATUS = "clogan_init"; //初始化函数
|
||||
public static final int CLOGAN_INIT_SUCCESS_MMAP = -1010; //初始化成功, mmap内存
|
||||
public static final int CLOGAN_INIT_SUCCESS_MEMORY = -1020; //初始化成功, 堆内存
|
||||
public static final int CLOGAN_INIT_FAIL_NOCACHE = -1030; //初始化失败 , 没有缓存
|
||||
public static final int CLOGAN_INIT_FAIL_NOMALLOC = -1040; //初始化失败 , malloc失败
|
||||
public static final int CLOGAN_INIT_FAIL_HEADER = -1050; //初始化头失败
|
||||
public static final int CLOGAN_INIT_FAIL_JNI = -1060; //jni找不到对应C函数
|
||||
|
||||
public static final String CLOGAN_OPEN_STATUS = "clogan_open"; //打开文件函数
|
||||
public static final int CLOGAN_OPEN_SUCCESS = -2010; //打开文件成功
|
||||
public static final int CLOGAN_OPEN_FAIL_IO = -2020; //打开文件IO失败
|
||||
public static final int CLOGAN_OPEN_FAIL_ZLIB = -2030; //打开文件zlib失败
|
||||
public static final int CLOGAN_OPEN_FAIL_MALLOC = -2040; //打开文件malloc失败
|
||||
public static final int CLOGAN_OPEN_FAIL_NOINIT = -2050; //打开文件没有初始化失败
|
||||
public static final int CLOGAN_OPEN_FAIL_HEADER = -2060; //打开文件头失败
|
||||
public static final int CLOGAN_OPEN_FAIL_JNI = -2070; //jni找不到对应C函数
|
||||
|
||||
public static final String CLOGAN_WRITE_STATUS = "clogan_write"; //写入函数
|
||||
public static final int CLOGAN_WRITE_SUCCESS = -4010; //写入日志成功
|
||||
public static final int CLOGAN_WRITE_FAIL_PARAM = -4020; //写入失败, 可变参数错误
|
||||
public static final int CLOAGN_WRITE_FAIL_MAXFILE = -4030; //写入失败,超过文件最大值
|
||||
public static final int CLOGAN_WRITE_FAIL_MALLOC = -4040; //写入失败,malloc失败
|
||||
public static final int CLOGAN_WRITE_FAIL_HEADER = -4050; //写入头失败
|
||||
public static final int CLOGAN_WRITE_FAIL_JNI = -4060; //jni找不到对应C函数
|
||||
|
||||
public static final String CLOGAN_LOAD_SO = "logan_loadso"; //Logan装载So;
|
||||
public static final int CLOGAN_LOAD_SO_FAIL = -5020; //加载的SO失败
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Logan {
|
||||
|
||||
private static OnLoganProtocolStatus sLoganProtocolStatus;
|
||||
private static LoganControlCenter sLoganControlCenter;
|
||||
static boolean sDebug = false;
|
||||
|
||||
/**
|
||||
* @brief Logan初始化
|
||||
*/
|
||||
public static void init(LoganConfig loganConfig) {
|
||||
sLoganControlCenter = LoganControlCenter.instance(loganConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param log 表示日志内容
|
||||
* @param type 表示日志类型
|
||||
* @brief Logan写入日志
|
||||
*/
|
||||
public static void w(String log, int type) {
|
||||
sLoganControlCenter.write(log, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 立即写入日志文件
|
||||
*/
|
||||
public static void f() {
|
||||
sLoganControlCenter.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dates 日期数组,格式:“2018-07-27”
|
||||
* @param runnable 发送操作
|
||||
* @brief 发送日志
|
||||
*/
|
||||
public static void s(String dates[], SendLogRunnable runnable) {
|
||||
sLoganControlCenter.send(dates, runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 返回所有日志文件信息
|
||||
*/
|
||||
public static Map<String, Long> getAllFilesInfo() {
|
||||
File dir = sLoganControlCenter.getDir();
|
||||
if (!dir.exists()) {
|
||||
return null;
|
||||
}
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Long> allFilesInfo = new HashMap<>();
|
||||
for (File file : files) {
|
||||
try {
|
||||
allFilesInfo.put(Util.getDateStr(Long.parseLong(file.getName())), file.length());
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return allFilesInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Logan Debug开关
|
||||
*/
|
||||
public static void setDebug(boolean debug) {
|
||||
Logan.sDebug = debug;
|
||||
}
|
||||
|
||||
static void onListenerLogWriteStatus(String name, int status) {
|
||||
if (sLoganProtocolStatus != null) {
|
||||
sLoganProtocolStatus.loganProtocolStatus(name, status);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setOnLoganProtocolStatus(OnLoganProtocolStatus listener) {
|
||||
sLoganProtocolStatus = listener;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class LoganConfig {
|
||||
|
||||
private static final long DAYS = 24 * 60 * 60 * 1000; //天
|
||||
private static final long M = 1024 * 1024; //M
|
||||
private static final long DEFAULT_DAY = 7 * DAYS; //默认删除天数
|
||||
private static final long DEFAULT_FILE_SIZE = 10 * M;
|
||||
private static final long DEFAULT_MIN_SDCARD_SIZE = 50 * M; //最小的SD卡小于这个大小不写入
|
||||
private static final int DEFAULT_QUEUE = 500;
|
||||
|
||||
String mCachePath; //mmap缓存路径
|
||||
String mPathPath; //file文件路径
|
||||
|
||||
long mMaxFile = DEFAULT_FILE_SIZE; //删除文件最大值
|
||||
long mDay = DEFAULT_DAY; //删除天数
|
||||
long mMaxQueue = DEFAULT_QUEUE;
|
||||
long mMinSDCard = DEFAULT_MIN_SDCARD_SIZE; //最小sdk卡大小
|
||||
|
||||
byte[] mEncryptKey16; //16位ase加密Key
|
||||
byte[] mEncryptIv16; //16位aes加密IV
|
||||
|
||||
boolean isValid() {
|
||||
boolean valid = false;
|
||||
if (!TextUtils.isEmpty(mCachePath) && !TextUtils.isEmpty(mPathPath) && mEncryptKey16 != null
|
||||
&& mEncryptIv16 != null) {
|
||||
valid = true;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
LoganConfig() {
|
||||
|
||||
}
|
||||
|
||||
void setCachePath(String cachePath) {
|
||||
mCachePath = cachePath;
|
||||
}
|
||||
|
||||
void setPathPath(String pathPath) {
|
||||
mPathPath = pathPath;
|
||||
}
|
||||
|
||||
void setMaxFile(long maxFile) {
|
||||
mMaxFile = maxFile;
|
||||
}
|
||||
|
||||
void setDay(long day) {
|
||||
mDay = day;
|
||||
}
|
||||
|
||||
void setMinSDCard(long minSDCard) {
|
||||
mMinSDCard = minSDCard;
|
||||
}
|
||||
|
||||
void setEncryptKey16(byte[] encryptKey16) {
|
||||
mEncryptKey16 = encryptKey16;
|
||||
}
|
||||
|
||||
void setEncryptIV16(byte[] encryptIv16) {
|
||||
mEncryptIv16 = encryptIv16;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
String mCachePath; //mmap缓存路径
|
||||
String mPath; //file文件路径
|
||||
long mMaxFile = DEFAULT_FILE_SIZE; //删除文件最大值
|
||||
long mDay = DEFAULT_DAY; //删除天数
|
||||
byte[] mEncryptKey16; //16位ase加密Key
|
||||
byte[] mEncryptIv16; //16位aes加密IV
|
||||
long mMinSDCard = DEFAULT_MIN_SDCARD_SIZE;
|
||||
|
||||
public Builder setCachePath(String cachePath) {
|
||||
mCachePath = cachePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setPath(String path) {
|
||||
mPath = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMaxFile(long maxFile) {
|
||||
mMaxFile = maxFile * M;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDay(long day) {
|
||||
mDay = day * DAYS;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setEncryptKey16(byte[] encryptKey16) {
|
||||
mEncryptKey16 = encryptKey16;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setEncryptIV16(byte[] encryptIv16) {
|
||||
mEncryptIv16 = encryptIv16;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMinSDCard(long minSDCard) {
|
||||
this.mMinSDCard = minSDCard;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LoganConfig build() {
|
||||
LoganConfig config = new LoganConfig();
|
||||
config.setCachePath(mCachePath);
|
||||
config.setPathPath(mPath);
|
||||
config.setMaxFile(mMaxFile);
|
||||
config.setMinSDCard(mMinSDCard);
|
||||
config.setDay(mDay);
|
||||
config.setEncryptKey16(mEncryptKey16);
|
||||
config.setEncryptIV16(mEncryptIv16);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
class LoganControlCenter {
|
||||
|
||||
private static LoganControlCenter sLoganControlCenter;
|
||||
|
||||
private ConcurrentLinkedQueue<LoganModel> mCacheLogQueue = new ConcurrentLinkedQueue<>();
|
||||
private String mCachePath; // 缓存文件路径
|
||||
private String mPath; //文件路径
|
||||
private long mSaveTime; //存储时间
|
||||
private long mMaxLogFile;//最大文件大小
|
||||
private long mMinSDCard;
|
||||
private long mMaxQueue; //最大队列数
|
||||
private String mEncryptKey16;
|
||||
private String mEncryptIv16;
|
||||
private LoganThread mLoganThread;
|
||||
private SimpleDateFormat dataFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
private LoganControlCenter(LoganConfig config) {
|
||||
mPath = config.mPathPath;
|
||||
mCachePath = config.mCachePath;
|
||||
mSaveTime = config.mDay;
|
||||
mMinSDCard = config.mMinSDCard;
|
||||
mMaxLogFile = config.mMaxFile;
|
||||
mMaxQueue = config.mMaxQueue;
|
||||
mEncryptKey16 = new String(config.mEncryptKey16);
|
||||
mEncryptIv16 = new String(config.mEncryptIv16);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if (mLoganThread == null) {
|
||||
mLoganThread = new LoganThread(mCacheLogQueue, mCachePath, mPath, mSaveTime,
|
||||
mMaxLogFile, mMinSDCard, mEncryptKey16, mEncryptIv16);
|
||||
mLoganThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
static LoganControlCenter instance(LoganConfig config) {
|
||||
if (sLoganControlCenter == null) {
|
||||
synchronized (LoganControlCenter.class) {
|
||||
if (sLoganControlCenter == null) {
|
||||
sLoganControlCenter = new LoganControlCenter(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sLoganControlCenter;
|
||||
}
|
||||
|
||||
void write(String log, int flag) {
|
||||
if (TextUtils.isEmpty(log)) {
|
||||
return;
|
||||
}
|
||||
LoganModel model = new LoganModel();
|
||||
model.action = LoganModel.Action.WRITE;
|
||||
WriteAction action = new WriteAction();
|
||||
String threadName = Thread.currentThread().getName();
|
||||
long threadLog = Thread.currentThread().getId();
|
||||
boolean isMain = false;
|
||||
if (Looper.getMainLooper() == Looper.myLooper()) {
|
||||
isMain = true;
|
||||
}
|
||||
action.log = log;
|
||||
action.localTime = System.currentTimeMillis();
|
||||
action.flag = flag;
|
||||
action.isMainThread = isMain;
|
||||
action.threadId = threadLog;
|
||||
action.threadName = threadName;
|
||||
model.writeAction = action;
|
||||
if (mCacheLogQueue.size() < mMaxQueue) {
|
||||
mCacheLogQueue.add(model);
|
||||
if (mLoganThread != null) {
|
||||
mLoganThread.notifyRun();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void send(String dates[], SendLogRunnable runnable) {
|
||||
if (TextUtils.isEmpty(mPath) || dates == null || dates.length == 0) {
|
||||
return;
|
||||
}
|
||||
for (String date : dates) {
|
||||
if (TextUtils.isEmpty(date)) {
|
||||
continue;
|
||||
}
|
||||
long time = getDateTime(date);
|
||||
if (time > 0) {
|
||||
LoganModel model = new LoganModel();
|
||||
SendAction action = new SendAction();
|
||||
model.action = LoganModel.Action.SEND;
|
||||
action.date = String.valueOf(time);
|
||||
action.sendLogRunnable = runnable;
|
||||
model.sendAction = action;
|
||||
mCacheLogQueue.add(model);
|
||||
if (mLoganThread != null) {
|
||||
mLoganThread.notifyRun();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void flush() {
|
||||
if (TextUtils.isEmpty(mPath)) {
|
||||
return;
|
||||
}
|
||||
LoganModel model = new LoganModel();
|
||||
model.action = LoganModel.Action.FLUSH;
|
||||
mCacheLogQueue.add(model);
|
||||
if (mLoganThread != null) {
|
||||
mLoganThread.notifyRun();
|
||||
}
|
||||
}
|
||||
|
||||
File getDir() {
|
||||
return new File(mPath);
|
||||
}
|
||||
|
||||
private long getDateTime(String time) {
|
||||
long tempTime = 0;
|
||||
try {
|
||||
tempTime = dataFormat.parse(time).getTime();
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return tempTime;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
class LoganModel {
|
||||
|
||||
enum Action {
|
||||
WRITE, SEND, FLUSH
|
||||
}
|
||||
|
||||
Action action;
|
||||
|
||||
WriteAction writeAction;
|
||||
|
||||
SendAction sendAction;
|
||||
|
||||
boolean isValid() {
|
||||
boolean valid = false;
|
||||
if (action != null) {
|
||||
if (action == Action.SEND && sendAction != null && sendAction.isValid()) {
|
||||
valid = true;
|
||||
} else if (action == Action.WRITE && writeAction != null && writeAction.isValid()) {
|
||||
valid = true;
|
||||
} else if (action == Action.FLUSH) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
class LoganProtocol implements LoganProtocolHandler {
|
||||
|
||||
private static LoganProtocol sLoganProtocol;
|
||||
|
||||
private LoganProtocolHandler mCurProtocol;
|
||||
private boolean mIsInit;
|
||||
private OnLoganProtocolStatus mLoganProtocolStatus;
|
||||
|
||||
private LoganProtocol() {
|
||||
|
||||
}
|
||||
|
||||
public static LoganProtocol newInstance() {
|
||||
if (sLoganProtocol == null) {
|
||||
synchronized (LoganProtocol.class) {
|
||||
sLoganProtocol = new LoganProtocol();
|
||||
}
|
||||
}
|
||||
return sLoganProtocol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_flush() {
|
||||
if (mCurProtocol != null) {
|
||||
mCurProtocol.logan_flush();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_write(int flag, String log, long local_time, String thread_name,
|
||||
long thread_id, boolean is_main) {
|
||||
if (mCurProtocol != null) {
|
||||
mCurProtocol.logan_write(flag, log, local_time, thread_name, thread_id,
|
||||
is_main);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_open(String file_name) {
|
||||
if (mCurProtocol != null) {
|
||||
mCurProtocol.logan_open(file_name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_init(String cache_path, String dir_path, int max_file, String encrypt_key_16,
|
||||
String encrypt_iv_16) {
|
||||
if (mIsInit) {
|
||||
return;
|
||||
}
|
||||
if (CLoganProtocol.isCloganSuccess()) {
|
||||
mCurProtocol = CLoganProtocol.newInstance();
|
||||
mCurProtocol.setOnLoganProtocolStatus(mLoganProtocolStatus);
|
||||
mCurProtocol.logan_init(cache_path, dir_path, max_file, encrypt_key_16, encrypt_iv_16);
|
||||
mIsInit = true;
|
||||
} else {
|
||||
mCurProtocol = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logan_debug(boolean debug) {
|
||||
if (mCurProtocol != null) {
|
||||
mCurProtocol.logan_debug(debug);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnLoganProtocolStatus(OnLoganProtocolStatus listener) {
|
||||
mLoganProtocolStatus = listener;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
public interface LoganProtocolHandler {
|
||||
|
||||
void logan_flush();
|
||||
|
||||
void logan_write(int flag, String log, long local_time, String thread_name,
|
||||
long thread_id, boolean is_main);
|
||||
|
||||
void logan_open(String file_name);
|
||||
|
||||
void logan_init(String cache_path, String dir_path, int max_file, String encrypt_key_16,
|
||||
String encrypt_iv_16);
|
||||
|
||||
void logan_debug(boolean debug);
|
||||
|
||||
void setOnLoganProtocolStatus(OnLoganProtocolStatus listener);
|
||||
}
|
||||
@ -0,0 +1,350 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import android.os.StatFs;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
class LoganThread extends Thread {
|
||||
|
||||
private static final String TAG = "LoganThread";
|
||||
private static final int MINUTE = 60 * 1000;
|
||||
private static final long LONG = 24 * 60 * 60 * 1000;
|
||||
private static final int CACHE_SIZE = 1024;
|
||||
|
||||
private final Object sync = new Object();
|
||||
private final Object sendSync = new Object();
|
||||
private volatile boolean mIsRun = true;
|
||||
|
||||
private long mCurrentDay;
|
||||
private boolean mIsWorking;
|
||||
private File mFileDirectory;
|
||||
private boolean mIsSDCard;
|
||||
private long mLastTime;
|
||||
private LoganProtocol mLoganProtocol;
|
||||
private ConcurrentLinkedQueue<LoganModel> mCacheLogQueue;
|
||||
private String mCachePath; // 缓存文件路径
|
||||
private String mPath; //文件路径
|
||||
private long mSaveTime; //存储时间
|
||||
private long mMaxLogFile;//最大文件大小
|
||||
private long mMinSDCard;
|
||||
private String mEncryptKey16;
|
||||
private String mEncryptIv16;
|
||||
private int mSendLogStatusCode;
|
||||
// 发送缓存队列
|
||||
private ConcurrentLinkedQueue<LoganModel> mCacheSendQueue = new ConcurrentLinkedQueue<>();
|
||||
private ExecutorService mSingleThreadExecutor = Executors.newSingleThreadExecutor();
|
||||
|
||||
public LoganThread(
|
||||
ConcurrentLinkedQueue<LoganModel> cacheLogQueue, String cachePath,
|
||||
String path, long saveTime, long maxLogFile, long minSDCard, String encryptKey16,
|
||||
String encryptIv16) {
|
||||
mCacheLogQueue = cacheLogQueue;
|
||||
mCachePath = cachePath;
|
||||
mPath = path;
|
||||
mSaveTime = saveTime;
|
||||
mMaxLogFile = maxLogFile;
|
||||
mMinSDCard = minSDCard;
|
||||
mEncryptKey16 = encryptKey16;
|
||||
mEncryptIv16 = encryptIv16;
|
||||
}
|
||||
|
||||
public void notifyRun() {
|
||||
if (!mIsWorking) {
|
||||
synchronized (sync) {
|
||||
sync.notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void quit() {
|
||||
mIsRun = false;
|
||||
if (!mIsWorking) {
|
||||
synchronized (sync) {
|
||||
sync.notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
while (mIsRun) {
|
||||
synchronized (sync) {
|
||||
mIsWorking = true;
|
||||
try {
|
||||
LoganModel model = mCacheLogQueue.poll();
|
||||
if (model == null) {
|
||||
mIsWorking = false;
|
||||
sync.wait();
|
||||
mIsWorking = true;
|
||||
} else {
|
||||
doNetworkLog(model);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
mIsWorking = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doNetworkLog(LoganModel model) {
|
||||
if (mLoganProtocol == null) {
|
||||
mLoganProtocol = LoganProtocol.newInstance();
|
||||
mLoganProtocol.setOnLoganProtocolStatus(new OnLoganProtocolStatus() {
|
||||
@Override
|
||||
public void loganProtocolStatus(String cmd, int code) {
|
||||
Logan.onListenerLogWriteStatus(cmd, code);
|
||||
}
|
||||
});
|
||||
mLoganProtocol.logan_init(mCachePath, mPath, (int) mMaxLogFile, mEncryptKey16,
|
||||
mEncryptIv16);
|
||||
mLoganProtocol.logan_debug(Logan.sDebug);
|
||||
}
|
||||
|
||||
if (model == null || !model.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (model.action == LoganModel.Action.WRITE) {
|
||||
doWriteLog2File(model.writeAction);
|
||||
} else if (model.action == LoganModel.Action.SEND) {
|
||||
if (model.sendAction.sendLogRunnable != null) {
|
||||
// 是否正在发送
|
||||
synchronized (sendSync) {
|
||||
if (mSendLogStatusCode == SendLogRunnable.SENDING) {
|
||||
mCacheSendQueue.add(model);
|
||||
} else {
|
||||
doSendLog2Net(model.sendAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (model.action == LoganModel.Action.FLUSH) {
|
||||
doFlushLog2File();
|
||||
}
|
||||
}
|
||||
|
||||
private void doFlushLog2File() {
|
||||
if (Logan.sDebug) {
|
||||
Log.d(TAG, "Logan flush start");
|
||||
}
|
||||
if (mLoganProtocol != null) {
|
||||
mLoganProtocol.logan_flush();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDay() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
return mCurrentDay < currentTime && mCurrentDay + LONG > currentTime;
|
||||
}
|
||||
|
||||
private void deleteExpiredFile(long deleteTime) {
|
||||
File dir = new File(mPath);
|
||||
if (dir.isDirectory()) {
|
||||
String[] files = dir.list();
|
||||
if (files != null) {
|
||||
for (String item : files) {
|
||||
try {
|
||||
if (TextUtils.isEmpty(item)) {
|
||||
continue;
|
||||
}
|
||||
String[] longStrArray = item.split("\\.");
|
||||
if (longStrArray.length > 0) { //小于时间就删除
|
||||
long longItem = Long.valueOf(longStrArray[0]);
|
||||
if (longItem <= deleteTime && longStrArray.length == 1) {
|
||||
new File(mPath, item).delete(); //删除文件
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doWriteLog2File(WriteAction action) {
|
||||
if (Logan.sDebug) {
|
||||
Log.d(TAG, "Logan write start");
|
||||
}
|
||||
if (mFileDirectory == null) {
|
||||
mFileDirectory = new File(mPath);
|
||||
}
|
||||
|
||||
if (!isDay()) {
|
||||
long tempCurrentDay = Util.getCurrentTime();
|
||||
//save时间
|
||||
long deleteTime = tempCurrentDay - mSaveTime;
|
||||
deleteExpiredFile(deleteTime);
|
||||
mCurrentDay = tempCurrentDay;
|
||||
mLoganProtocol.logan_open(String.valueOf(mCurrentDay));
|
||||
}
|
||||
|
||||
long currentTime = System.currentTimeMillis(); //每隔1分钟判断一次
|
||||
if (currentTime - mLastTime > MINUTE) {
|
||||
mIsSDCard = isCanWriteSDCard();
|
||||
}
|
||||
mLastTime = System.currentTimeMillis();
|
||||
|
||||
if (!mIsSDCard) { //如果大于50M 不让再次写入
|
||||
return;
|
||||
}
|
||||
mLoganProtocol.logan_write(action.flag, action.log, action.localTime, action.threadName,
|
||||
action.threadId, action.isMainThread);
|
||||
}
|
||||
|
||||
private void doSendLog2Net(SendAction action) {
|
||||
if (Logan.sDebug) {
|
||||
Log.d(TAG, "Logan send start");
|
||||
}
|
||||
if (TextUtils.isEmpty(mPath) || action == null || !action.isValid()) {
|
||||
return;
|
||||
}
|
||||
boolean success = prepareLogFile(action);
|
||||
if (!success) {
|
||||
if (Logan.sDebug) {
|
||||
Log.d(TAG, "Logan prepare log file failed, can't find log file");
|
||||
}
|
||||
return;
|
||||
}
|
||||
action.sendLogRunnable.setSendAction(action);
|
||||
action.sendLogRunnable.setCallBackListener(
|
||||
new SendLogRunnable.OnSendLogCallBackListener() {
|
||||
@Override
|
||||
public void onCallBack(int statusCode) {
|
||||
synchronized (sendSync) {
|
||||
mSendLogStatusCode = statusCode;
|
||||
if (statusCode == SendLogRunnable.FINISH) {
|
||||
mCacheLogQueue.addAll(mCacheSendQueue);
|
||||
mCacheSendQueue.clear();
|
||||
notifyRun();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
mSendLogStatusCode = SendLogRunnable.SENDING;
|
||||
mSingleThreadExecutor.execute(action.sendLogRunnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送日志前的预处理操作
|
||||
*/
|
||||
private boolean prepareLogFile(SendAction action) {
|
||||
if (Logan.sDebug) {
|
||||
Log.d(TAG, "prepare log file");
|
||||
}
|
||||
if (isFile(action.date)) { //是否有日期文件
|
||||
String src = mPath + File.separator + action.date;
|
||||
if (action.date.equals(String.valueOf(Util.getCurrentTime()))) {
|
||||
doFlushLog2File();
|
||||
String des = mPath + File.separator + action.date + ".copy";
|
||||
if (copyFile(src, des)) {
|
||||
action.uploadPath = des;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
action.uploadPath = src;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
action.uploadPath = "";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean copyFile(String src, String des) {
|
||||
boolean back = false;
|
||||
FileInputStream inputStream = null;
|
||||
FileOutputStream outputStream = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(new File(src));
|
||||
outputStream = new FileOutputStream(new File(des));
|
||||
byte[] buffer = new byte[CACHE_SIZE];
|
||||
int i;
|
||||
while ((i = inputStream.read(buffer)) >= 0) {
|
||||
outputStream.write(buffer, 0, i);
|
||||
outputStream.flush();
|
||||
}
|
||||
back = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return back;
|
||||
}
|
||||
|
||||
private boolean isCanWriteSDCard() {
|
||||
boolean item = false;
|
||||
try {
|
||||
StatFs stat = new StatFs(mPath);
|
||||
long blockSize = stat.getBlockSize();
|
||||
long availableBlocks = stat.getAvailableBlocks();
|
||||
long total = availableBlocks * blockSize;
|
||||
if (total > mMinSDCard) { //判断SDK卡
|
||||
item = true;
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private boolean isFile(String name) {
|
||||
boolean isExist = false;
|
||||
if (TextUtils.isEmpty(mPath)) {
|
||||
return false;
|
||||
}
|
||||
File file = new File(mPath + File.separator + name);
|
||||
if (file.exists() && file.isFile()) {
|
||||
isExist = true;
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
public interface OnLoganProtocolStatus {
|
||||
void loganProtocolStatus(String cmd, int code);
|
||||
}
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
class SendAction {
|
||||
|
||||
long fileSize; //文件大小
|
||||
|
||||
String date; //日期
|
||||
|
||||
String uploadPath;
|
||||
|
||||
SendLogRunnable sendLogRunnable;
|
||||
|
||||
boolean isValid() {
|
||||
boolean valid = false;
|
||||
if (sendLogRunnable != null) {
|
||||
valid = true;
|
||||
} else if (fileSize > 0) {
|
||||
valid = true;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public abstract class SendLogRunnable implements Runnable {
|
||||
public static final int SENDING = 10001;
|
||||
public static final int FINISH = 10002;
|
||||
|
||||
private SendAction mSendAction;
|
||||
private OnSendLogCallBackListener mCallBackListener;
|
||||
|
||||
/**
|
||||
* 真正发送上传日志文件的方法,留给外部实现
|
||||
*
|
||||
* @param logFile 日志文件
|
||||
*/
|
||||
public abstract void sendLog(File logFile);
|
||||
|
||||
public void setSendAction(SendAction action) {
|
||||
mSendAction = action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (mSendAction == null || TextUtils.isEmpty(mSendAction.date)) {
|
||||
if (mCallBackListener != null) {
|
||||
mCallBackListener.onCallBack(FINISH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(mSendAction.uploadPath)) {
|
||||
if (mCallBackListener != null) {
|
||||
mCallBackListener.onCallBack(FINISH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
File file = new File(mSendAction.uploadPath);
|
||||
sendLog(file);
|
||||
if (mSendAction.date.equals(String.valueOf(Util.getCurrentTime()))) {
|
||||
file.delete();
|
||||
}
|
||||
if (mCallBackListener != null) {
|
||||
mCallBackListener.onCallBack(FINISH);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCallBackListener(OnSendLogCallBackListener callBackListener) {
|
||||
mCallBackListener = callBackListener;
|
||||
}
|
||||
|
||||
interface OnSendLogCallBackListener {
|
||||
void onCallBack(int statusCode);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class Util {
|
||||
|
||||
private static SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
public static boolean loadLibrary(String loadName, Class className) {
|
||||
boolean isLoad = false;
|
||||
try {
|
||||
ClassLoader classLoader = className.getClassLoader();
|
||||
Class runtime = Runtime.getRuntime().getClass();
|
||||
Class[] args = new Class[2];
|
||||
int version = android.os.Build.VERSION.SDK_INT;
|
||||
String functionName = "loadLibrary";
|
||||
if (version > 24) {
|
||||
args[0] = ClassLoader.class;
|
||||
args[1] = String.class;
|
||||
functionName = "loadLibrary0";
|
||||
Method loadMethod = runtime.getDeclaredMethod(functionName, args);
|
||||
loadMethod.setAccessible(true);
|
||||
loadMethod.invoke(Runtime.getRuntime(), classLoader, loadName);
|
||||
} else {
|
||||
args[0] = String.class;
|
||||
args[1] = ClassLoader.class;
|
||||
Method loadMethod = runtime.getDeclaredMethod(functionName, args);
|
||||
loadMethod.setAccessible(true);
|
||||
loadMethod.invoke(Runtime.getRuntime(), loadName, classLoader);
|
||||
}
|
||||
isLoad = true;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return isLoad;
|
||||
}
|
||||
|
||||
public static long getCurrentTime() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long tempTime = 0;
|
||||
try {
|
||||
String dataStr = sDateFormat.format(new Date(currentTime));
|
||||
tempTime = sDateFormat.parse(dataStr).getTime();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return tempTime;
|
||||
}
|
||||
|
||||
public static String getDateStr(long time) {
|
||||
return sDateFormat.format(new Date(time));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.dianping.logan;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
class WriteAction {
|
||||
|
||||
String log; //日志
|
||||
|
||||
boolean isMainThread;
|
||||
|
||||
long threadId;
|
||||
|
||||
String threadName = "";
|
||||
|
||||
long localTime;
|
||||
|
||||
int flag;
|
||||
|
||||
boolean isValid() {
|
||||
boolean valid = false;
|
||||
if (!TextUtils.isEmpty(log)) {
|
||||
valid = true;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
84
Example/Logan-Android/logan/src/main/jni/clogan_protocol.c
Normal file
84
Example/Logan-Android/logan/src/main/jni/clogan_protocol.c
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "clogan_protocol.h"
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_dianping_logan_CLoganProtocol_clogan_1write(JNIEnv *env, jobject instance, jint flag,
|
||||
jstring log_, jlong local_time,
|
||||
jstring thread_name_, jlong thread_id,
|
||||
jint is_main) {
|
||||
const char *log = (*env)->GetStringUTFChars(env, log_, 0);
|
||||
const char *thread_name = (*env)->GetStringUTFChars(env, thread_name_, 0);
|
||||
|
||||
jint code = (jint) clogan_write(flag, log, local_time, thread_name, thread_id, is_main);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, log_, log);
|
||||
(*env)->ReleaseStringUTFChars(env, thread_name_, thread_name);
|
||||
return code;
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_dianping_logan_CLoganProtocol_clogan_1init(JNIEnv *env, jobject instance,
|
||||
jstring cache_path_,
|
||||
jstring dir_path_, jint max_file,
|
||||
jstring encrypt_key16_, jstring encrypt_iv16_) {
|
||||
const char *dir_path = (*env)->GetStringUTFChars(env, dir_path_, 0);
|
||||
const char *cache_path = (*env)->GetStringUTFChars(env, cache_path_, 0);
|
||||
const char *encrypt_key16 = (*env)->GetStringUTFChars(env, encrypt_key16_, 0);
|
||||
const char *encrypt_iv16 = (*env)->GetStringUTFChars(env, encrypt_iv16_, 0);
|
||||
|
||||
jint code = (jint) clogan_init(cache_path, dir_path, max_file, encrypt_key16, encrypt_iv16);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, dir_path_, dir_path);
|
||||
(*env)->ReleaseStringUTFChars(env, cache_path_, cache_path);
|
||||
(*env)->ReleaseStringUTFChars(env, encrypt_key16_, encrypt_key16);
|
||||
(*env)->ReleaseStringUTFChars(env, encrypt_iv16_, encrypt_iv16);
|
||||
return code;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_dianping_logan_CLoganProtocol_clogan_1open(JNIEnv *env, jobject instance,
|
||||
jstring file_name_) {
|
||||
const char *file_name = (*env)->GetStringUTFChars(env, file_name_, 0);
|
||||
|
||||
jint code = (jint) clogan_open(file_name);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, file_name_, file_name);
|
||||
return code;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_dianping_logan_CLoganProtocol_clogan_1flush(JNIEnv *env, jobject instance) {
|
||||
clogan_flush();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_dianping_logan_CLoganProtocol_clogan_1debug(JNIEnv *env, jobject instance,
|
||||
jboolean is_debug) {
|
||||
int i = 1;
|
||||
if (!is_debug) {
|
||||
i = 0;
|
||||
}
|
||||
clogan_debug(i);
|
||||
}
|
||||
79
Example/Logan-Android/logan/src/main/jni/clogan_protocol.h
Normal file
79
Example/Logan-Android/logan/src/main/jni/clogan_protocol.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_NOVA_LOGAN_CLOGAN_PROTOCOL_H_H
|
||||
#define ANDROID_NOVA_LOGAN_CLOGAN_PROTOCOL_H_H
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <jni.h>
|
||||
#include <clogan_core.h>
|
||||
|
||||
/**
|
||||
* JNI write interface
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_dianping_networklog_CLoganProtocol_clogan_1write(JNIEnv *env, jobject instance,
|
||||
jint flag, jstring log_,
|
||||
jlong local_time, jstring thread_name_,
|
||||
jlong thread_id, jint ismain);
|
||||
/**
|
||||
* JNI init interface
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_dianping_networklog_CLoganProtocol_clogan_1init(JNIEnv *env, jobject instance,
|
||||
jstring cache_path_,
|
||||
jstring dir_path_, jint max_file,
|
||||
jstring encrypt_key16_,
|
||||
jstring encrypt_iv16_);
|
||||
|
||||
/**
|
||||
* JNI open interface
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_dianping_networklog_CLoganProtocol_clogan_1open(JNIEnv *env, jobject instance,
|
||||
jstring file_name_);
|
||||
|
||||
/**
|
||||
* JNI flush interface
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_dianping_networklog_CLoganProtocol_clogan_1flush(JNIEnv *env, jobject instance);
|
||||
|
||||
/**
|
||||
* JNI debug interface
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_dianping_networklog_CLoganProtocol_clogan_1debug(JNIEnv *env, jobject instance,
|
||||
jboolean is_debug);
|
||||
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_dianping_networklog_CLoganProtocol_clogan_1getUplaodKey(JNIEnv *env, jobject instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //ANDROID_NOVA_LOGAN_CLOGAN_PROTOCOL_H_H
|
||||
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">logan</string>
|
||||
</resources>
|
||||
@ -0,0 +1,17 @@
|
||||
package com.dianping.logan;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
1
Example/Logan-Android/settings.gradle
Normal file
1
Example/Logan-Android/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
include ':app', ':logan'
|
||||
423
Example/Logan-Server/package-lock.json
generated
Normal file
423
Example/Logan-Server/package-lock.json
generated
Normal file
@ -0,0 +1,423 @@
|
||||
{
|
||||
"name": "logan-server",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"accepts": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
|
||||
"integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
|
||||
"requires": {
|
||||
"mime-types": "2.1.19",
|
||||
"negotiator": "0.6.1"
|
||||
}
|
||||
},
|
||||
"array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.18.3",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
|
||||
"integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
|
||||
"requires": {
|
||||
"bytes": "3.0.0",
|
||||
"content-type": "1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "1.1.2",
|
||||
"http-errors": "1.6.3",
|
||||
"iconv-lite": "0.4.23",
|
||||
"on-finished": "2.3.0",
|
||||
"qs": "6.5.2",
|
||||
"raw-body": "2.3.3",
|
||||
"type-is": "1.6.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"qs": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
|
||||
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"bytes": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
|
||||
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
|
||||
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
|
||||
},
|
||||
"content-type": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
|
||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
||||
},
|
||||
"cookie": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
|
||||
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
|
||||
},
|
||||
"cookie-signature": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
||||
},
|
||||
"destroy": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"encodeurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
|
||||
},
|
||||
"escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
||||
},
|
||||
"etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
||||
},
|
||||
"express": {
|
||||
"version": "4.16.3",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz",
|
||||
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
|
||||
"requires": {
|
||||
"accepts": "1.3.5",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "1.18.2",
|
||||
"content-disposition": "0.5.2",
|
||||
"content-type": "1.0.4",
|
||||
"cookie": "0.3.1",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "1.1.2",
|
||||
"encodeurl": "1.0.2",
|
||||
"escape-html": "1.0.3",
|
||||
"etag": "1.8.1",
|
||||
"finalhandler": "1.1.1",
|
||||
"fresh": "0.5.2",
|
||||
"merge-descriptors": "1.0.1",
|
||||
"methods": "1.1.2",
|
||||
"on-finished": "2.3.0",
|
||||
"parseurl": "1.3.2",
|
||||
"path-to-regexp": "0.1.7",
|
||||
"proxy-addr": "2.0.4",
|
||||
"qs": "6.5.1",
|
||||
"range-parser": "1.2.0",
|
||||
"safe-buffer": "5.1.1",
|
||||
"send": "0.16.2",
|
||||
"serve-static": "1.13.2",
|
||||
"setprototypeof": "1.1.0",
|
||||
"statuses": "1.4.0",
|
||||
"type-is": "1.6.16",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "1.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": {
|
||||
"version": "1.18.2",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz",
|
||||
"integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=",
|
||||
"requires": {
|
||||
"bytes": "3.0.0",
|
||||
"content-type": "1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "1.1.2",
|
||||
"http-errors": "1.6.3",
|
||||
"iconv-lite": "0.4.19",
|
||||
"on-finished": "2.3.0",
|
||||
"qs": "6.5.1",
|
||||
"raw-body": "2.3.2",
|
||||
"type-is": "1.6.16"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.19",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
|
||||
"integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ=="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz",
|
||||
"integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=",
|
||||
"requires": {
|
||||
"bytes": "3.0.0",
|
||||
"http-errors": "1.6.2",
|
||||
"iconv-lite": "0.4.19",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"depd": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz",
|
||||
"integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k="
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz",
|
||||
"integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=",
|
||||
"requires": {
|
||||
"depd": "1.1.1",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.0.3",
|
||||
"statuses": "1.4.0"
|
||||
}
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz",
|
||||
"integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
|
||||
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "1.0.2",
|
||||
"escape-html": "1.0.3",
|
||||
"on-finished": "2.3.0",
|
||||
"parseurl": "1.3.2",
|
||||
"statuses": "1.4.0",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
|
||||
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
|
||||
},
|
||||
"fresh": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.6.3",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
||||
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
|
||||
"requires": {
|
||||
"depd": "1.1.2",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.1.0",
|
||||
"statuses": "1.4.0"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.23",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
|
||||
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
|
||||
"requires": {
|
||||
"safer-buffer": "2.1.2"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ipaddr.js": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz",
|
||||
"integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4="
|
||||
},
|
||||
"media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
||||
},
|
||||
"merge-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
|
||||
},
|
||||
"methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
|
||||
"integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.35.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz",
|
||||
"integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.19",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz",
|
||||
"integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==",
|
||||
"requires": {
|
||||
"mime-db": "1.35.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"negotiator": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
|
||||
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
|
||||
},
|
||||
"on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
||||
"requires": {
|
||||
"ee-first": "1.1.1"
|
||||
}
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
|
||||
"integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz",
|
||||
"integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==",
|
||||
"requires": {
|
||||
"forwarded": "0.1.2",
|
||||
"ipaddr.js": "1.8.0"
|
||||
}
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.5.1",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
|
||||
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="
|
||||
},
|
||||
"range-parser": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
|
||||
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
|
||||
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
|
||||
"requires": {
|
||||
"bytes": "3.0.0",
|
||||
"http-errors": "1.6.3",
|
||||
"iconv-lite": "0.4.23",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
|
||||
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"send": {
|
||||
"version": "0.16.2",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
|
||||
"integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "1.1.2",
|
||||
"destroy": "1.0.4",
|
||||
"encodeurl": "1.0.2",
|
||||
"escape-html": "1.0.3",
|
||||
"etag": "1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"http-errors": "1.6.3",
|
||||
"mime": "1.4.1",
|
||||
"ms": "2.0.0",
|
||||
"on-finished": "2.3.0",
|
||||
"range-parser": "1.2.0",
|
||||
"statuses": "1.4.0"
|
||||
}
|
||||
},
|
||||
"serve-static": {
|
||||
"version": "1.13.2",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
|
||||
"integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
|
||||
"requires": {
|
||||
"encodeurl": "1.0.2",
|
||||
"escape-html": "1.0.3",
|
||||
"parseurl": "1.3.2",
|
||||
"send": "0.16.2"
|
||||
}
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
|
||||
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
|
||||
},
|
||||
"statuses": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
|
||||
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
|
||||
},
|
||||
"type-is": {
|
||||
"version": "1.6.16",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
|
||||
"integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
|
||||
"requires": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "2.1.19"
|
||||
}
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
|
||||
},
|
||||
"utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
||||
},
|
||||
"vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Example/Logan-Server/package.json
Normal file
18
Example/Logan-Server/package.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "logan-server",
|
||||
"version": "1.0.0",
|
||||
"description": "logan server demo",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"logan"
|
||||
],
|
||||
"author": "caolicheng",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.18.3",
|
||||
"express": "^4.16.3"
|
||||
}
|
||||
}
|
||||
125
Example/Logan-Server/server.js
Normal file
125
Example/Logan-Server/server.js
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const fs = require('fs');
|
||||
const crypto = require('crypto');
|
||||
const zlib = require('zlib');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(bodyParser.raw({
|
||||
type: 'binary/octet-stream',
|
||||
limit: '10mb'
|
||||
}));
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World!');
|
||||
});
|
||||
|
||||
app.post('/logupload', (req, res) => {
|
||||
console.log('Logan client upload log file');
|
||||
if (!req.body) {
|
||||
return res.sendStatus(400);
|
||||
}
|
||||
if (fs.existsSync('./log-demo.txt')) {
|
||||
fs.unlinkSync('./log-demo.txt');
|
||||
}
|
||||
// decode log
|
||||
decodeLog(req.body, 0);
|
||||
// haha
|
||||
console.log('decode log file complete');
|
||||
res.json({ success: true });
|
||||
});
|
||||
|
||||
const decodeLog = (buf, skips) => {
|
||||
if (skips < buf.length) {
|
||||
const start = buf.readUInt8(skips);
|
||||
skips++;
|
||||
if (start == '1') {
|
||||
console.log('\nstart decode log file');
|
||||
const contentLen = (((buf.readUInt8(skips) & 0xFF) << 24) |
|
||||
((buf.readUInt8(skips + 1) & 0xFF) << 16) |
|
||||
((buf.readUInt8(skips + 2) & 0xFF) << 8) |
|
||||
(buf.readUInt8(skips + 3) & 0xFF));
|
||||
skips += 4;
|
||||
if (skips + contentLen > buf.length) {
|
||||
skips -= 4;
|
||||
decodeLog(buf, skips);
|
||||
return;
|
||||
}
|
||||
const content = buf.slice(skips, skips + contentLen);
|
||||
skips += contentLen;
|
||||
// decipher
|
||||
const decipher = crypto.createDecipheriv('aes-128-cbc', '0123456789012345', '0123456789012345');
|
||||
decipher.setAutoPadding(false);
|
||||
const decodedBuf = decipher.update(content);
|
||||
const finalBuf = decipher.final();
|
||||
const decoded = Buffer.concat([decodedBuf, finalBuf]);
|
||||
console.log('decrypt complete');
|
||||
// padding
|
||||
const padding1 = decoded.readUInt8(decoded.length - 1);
|
||||
const padding2 = decoded.readUInt8(decoded.length - 2);
|
||||
let padding = 0;
|
||||
if (padding1 > 1 && padding1 === padding2) {
|
||||
padding = padding1;
|
||||
} else if (padding === 1) {
|
||||
padding = padding1;
|
||||
}
|
||||
const realContent = decoded.slice(0, decoded.length - padding);
|
||||
console.log('remove padding complete');
|
||||
// end
|
||||
if (skips + contentLen < buf.length && buf.readUInt8(skips) == '0') {
|
||||
skips++;
|
||||
}
|
||||
|
||||
// flush
|
||||
let wstream = fs.createWriteStream('./log-demo.gz');
|
||||
wstream.write(realContent);
|
||||
wstream.end();
|
||||
wstream.on('finish', () => {
|
||||
// unzip
|
||||
const unzip = zlib.createGunzip();
|
||||
const inp = fs.createReadStream('./log-demo.gz');
|
||||
const gout = fs.createWriteStream('./log-demo.txt', { flags: 'a' });
|
||||
inp.pipe(unzip).on('error', (err) => {
|
||||
console.log(err);
|
||||
// unzip error, continue recursion
|
||||
fs.unlinkSync('./log-demo.gz')
|
||||
decodeLog(buf, skips);
|
||||
}).pipe(gout).on('finish', (src) => {
|
||||
console.log('write finish');
|
||||
// write complete, continue recursion
|
||||
fs.unlinkSync('./log-demo.gz')
|
||||
decodeLog(buf, skips);
|
||||
}).on('error', (err) => {
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
decodeLog(buf, skips);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
app.listen(3000, () => console.log('Logan demo server listening on port 3000!'));
|
||||
596
Example/Logan-iOS/Logan-iOS.xcodeproj/project.pbxproj
Normal file
596
Example/Logan-iOS/Logan-iOS.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,596 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
|
||||
6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; };
|
||||
6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
|
||||
6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; };
|
||||
6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; };
|
||||
6003F59E195388D20070C39A /* LGAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* LGAppDelegate.m */; };
|
||||
6003F5A7195388D20070C39A /* LGViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* LGViewController.m */; };
|
||||
6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; };
|
||||
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; };
|
||||
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
|
||||
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
|
||||
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
|
||||
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
|
||||
71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; };
|
||||
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
|
||||
A706F9E521145B9D00F819F4 /* LoganTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A706F9E421145B9D00F819F4 /* LoganTests.m */; };
|
||||
A706FA55212AAE3200F819F4 /* Logan.m in Sources */ = {isa = PBXBuildFile; fileRef = A706FA54212AAE3200F819F4 /* Logan.m */; };
|
||||
A74F422F20D0FEAB0008E4F8 /* Logan.podspec in Resources */ = {isa = PBXBuildFile; fileRef = A74F422E20D0FEAB0008E4F8 /* Logan.podspec */; };
|
||||
A7C489B920F7512C001F74C0 /* libclogan.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A7C489B320F750A1001F74C0 /* libclogan.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 6003F582195388D10070C39A /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 6003F589195388D20070C39A;
|
||||
remoteInfo = "Logan-iOS";
|
||||
};
|
||||
A7C489B220F750A1001F74C0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A7C489AD20F750A1001F74C0 /* clogan.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = A7C4885B20F74AC5001F74C0;
|
||||
remoteInfo = clogan;
|
||||
};
|
||||
A7C489B420F750BF001F74C0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A7C489AD20F750A1001F74C0 /* clogan.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = A7C4885A20F74AC5001F74C0;
|
||||
remoteInfo = clogan;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
6003F58A195388D20070C39A /* Logan-iOS_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Logan-iOS_Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
6003F595195388D20070C39A /* Logan-iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Logan-iOS-Info.plist"; sourceTree = "<group>"; };
|
||||
6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
6003F59B195388D20070C39A /* Logan-iOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Logan-iOS-Prefix.pch"; sourceTree = "<group>"; };
|
||||
6003F59C195388D20070C39A /* LGAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LGAppDelegate.h; sourceTree = "<group>"; };
|
||||
6003F59D195388D20070C39A /* LGAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LGAppDelegate.m; sourceTree = "<group>"; };
|
||||
6003F5A5195388D20070C39A /* LGViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LGViewController.h; sourceTree = "<group>"; };
|
||||
6003F5A6195388D20070C39A /* LGViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LGViewController.m; sourceTree = "<group>"; };
|
||||
6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
6003F5AE195388D20070C39A /* Logan-iOS_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Logan-iOS_Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
|
||||
6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; };
|
||||
6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
|
||||
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
|
||||
71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
A67F38E0FC0E4DD9FE651A11 /* Pods_Logan_iOS_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Logan_iOS_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A706F9E421145B9D00F819F4 /* LoganTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoganTests.m; sourceTree = "<group>"; };
|
||||
A706FA53212AAE3200F819F4 /* Logan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Logan.h; sourceTree = "<group>"; };
|
||||
A706FA54212AAE3200F819F4 /* Logan.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Logan.m; sourceTree = "<group>"; };
|
||||
A74516AB20EF2EE200D2B849 /* libz.1.2.5.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.1.2.5.tbd; path = usr/lib/libz.1.2.5.tbd; sourceTree = SDKROOT; };
|
||||
A74F422E20D0FEAB0008E4F8 /* Logan.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Logan.podspec; path = ../../Logan.podspec; sourceTree = "<group>"; };
|
||||
A7C489AD20F750A1001F74C0 /* clogan.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = clogan.xcodeproj; path = ../../../Logan/clogan.xcodeproj; sourceTree = "<group>"; };
|
||||
DF957FBE944AABF7798BD54E /* Pods_Logan_iOS_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Logan_iOS_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
6003F587195388D20070C39A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A7C489B920F7512C001F74C0 /* libclogan.a in Frameworks */,
|
||||
6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */,
|
||||
6003F592195388D20070C39A /* UIKit.framework in Frameworks */,
|
||||
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6003F5AB195388D20070C39A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */,
|
||||
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */,
|
||||
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
6003F581195388D10070C39A = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A74F422E20D0FEAB0008E4F8 /* Logan.podspec */,
|
||||
6003F593195388D20070C39A /* Example for Logan-iOS */,
|
||||
6003F5B5195388D20070C39A /* Tests */,
|
||||
6003F58C195388D20070C39A /* Frameworks */,
|
||||
6003F58B195388D20070C39A /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6003F58B195388D20070C39A /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6003F58A195388D20070C39A /* Logan-iOS_Example.app */,
|
||||
6003F5AE195388D20070C39A /* Logan-iOS_Tests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6003F58C195388D20070C39A /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A74516AB20EF2EE200D2B849 /* libz.1.2.5.tbd */,
|
||||
6003F58D195388D20070C39A /* Foundation.framework */,
|
||||
6003F58F195388D20070C39A /* CoreGraphics.framework */,
|
||||
6003F591195388D20070C39A /* UIKit.framework */,
|
||||
6003F5AF195388D20070C39A /* XCTest.framework */,
|
||||
DF957FBE944AABF7798BD54E /* Pods_Logan_iOS_Example.framework */,
|
||||
A67F38E0FC0E4DD9FE651A11 /* Pods_Logan_iOS_Tests.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6003F593195388D20070C39A /* Example for Logan-iOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6003F59C195388D20070C39A /* LGAppDelegate.h */,
|
||||
6003F59D195388D20070C39A /* LGAppDelegate.m */,
|
||||
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
|
||||
6003F5A5195388D20070C39A /* LGViewController.h */,
|
||||
6003F5A6195388D20070C39A /* LGViewController.m */,
|
||||
A7C489BA20F7516F001F74C0 /* iOS */,
|
||||
A7C489AD20F750A1001F74C0 /* clogan.xcodeproj */,
|
||||
71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */,
|
||||
6003F5A8195388D20070C39A /* Images.xcassets */,
|
||||
6003F594195388D20070C39A /* Supporting Files */,
|
||||
);
|
||||
name = "Example for Logan-iOS";
|
||||
path = "Logan-iOS";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6003F594195388D20070C39A /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6003F595195388D20070C39A /* Logan-iOS-Info.plist */,
|
||||
6003F596195388D20070C39A /* InfoPlist.strings */,
|
||||
6003F599195388D20070C39A /* main.m */,
|
||||
6003F59B195388D20070C39A /* Logan-iOS-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6003F5B5195388D20070C39A /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A706F9E421145B9D00F819F4 /* LoganTests.m */,
|
||||
6003F5BB195388D20070C39A /* Tests.m */,
|
||||
6003F5B6195388D20070C39A /* Supporting Files */,
|
||||
);
|
||||
path = Tests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6003F5B6195388D20070C39A /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6003F5B7195388D20070C39A /* Tests-Info.plist */,
|
||||
6003F5B8195388D20070C39A /* InfoPlist.strings */,
|
||||
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A7C489AE20F750A1001F74C0 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7C489B320F750A1001F74C0 /* libclogan.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A7C489BA20F7516F001F74C0 /* iOS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A706FA53212AAE3200F819F4 /* Logan.h */,
|
||||
A706FA54212AAE3200F819F4 /* Logan.m */,
|
||||
);
|
||||
name = iOS;
|
||||
path = ../../../Logan/iOS;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
6003F589195388D20070C39A /* Logan-iOS_Example */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "Logan-iOS_Example" */;
|
||||
buildPhases = (
|
||||
6003F586195388D20070C39A /* Sources */,
|
||||
6003F587195388D20070C39A /* Frameworks */,
|
||||
6003F588195388D20070C39A /* Resources */,
|
||||
A8B5E1EF13BDD1A4E5DA02A5 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
A7C489B520F750BF001F74C0 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "Logan-iOS_Example";
|
||||
productName = "Logan-iOS";
|
||||
productReference = 6003F58A195388D20070C39A /* Logan-iOS_Example.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
6003F5AD195388D20070C39A /* Logan-iOS_Tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "Logan-iOS_Tests" */;
|
||||
buildPhases = (
|
||||
6003F5AA195388D20070C39A /* Sources */,
|
||||
6003F5AB195388D20070C39A /* Frameworks */,
|
||||
6003F5AC195388D20070C39A /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
6003F5B4195388D20070C39A /* PBXTargetDependency */,
|
||||
);
|
||||
name = "Logan-iOS_Tests";
|
||||
productName = "Logan-iOSTests";
|
||||
productReference = 6003F5AE195388D20070C39A /* Logan-iOS_Tests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
6003F582195388D10070C39A /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
CLASSPREFIX = LG;
|
||||
LastUpgradeCheck = 0720;
|
||||
ORGANIZATIONNAME = jiangteng;
|
||||
TargetAttributes = {
|
||||
6003F5AD195388D20070C39A = {
|
||||
TestTargetID = 6003F589195388D20070C39A;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "Logan-iOS" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 6003F581195388D10070C39A;
|
||||
productRefGroup = 6003F58B195388D20070C39A /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = A7C489AE20F750A1001F74C0 /* Products */;
|
||||
ProjectRef = A7C489AD20F750A1001F74C0 /* clogan.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
6003F589195388D20070C39A /* Logan-iOS_Example */,
|
||||
6003F5AD195388D20070C39A /* Logan-iOS_Tests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
A7C489B320F750A1001F74C0 /* libclogan.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libclogan.a;
|
||||
remoteRef = A7C489B220F750A1001F74C0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
6003F588195388D20070C39A /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */,
|
||||
A74F422F20D0FEAB0008E4F8 /* Logan.podspec in Resources */,
|
||||
71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */,
|
||||
6003F5A9195388D20070C39A /* Images.xcassets in Resources */,
|
||||
6003F598195388D20070C39A /* InfoPlist.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6003F5AC195388D20070C39A /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
A8B5E1EF13BDD1A4E5DA02A5 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
6003F586195388D20070C39A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6003F59E195388D20070C39A /* LGAppDelegate.m in Sources */,
|
||||
6003F5A7195388D20070C39A /* LGViewController.m in Sources */,
|
||||
6003F59A195388D20070C39A /* main.m in Sources */,
|
||||
A706FA55212AAE3200F819F4 /* Logan.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6003F5AA195388D20070C39A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6003F5BC195388D20070C39A /* Tests.m in Sources */,
|
||||
A706F9E521145B9D00F819F4 /* LoganTests.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
6003F5B4195388D20070C39A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 6003F589195388D20070C39A /* Logan-iOS_Example */;
|
||||
targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */;
|
||||
};
|
||||
A7C489B520F750BF001F74C0 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = clogan;
|
||||
targetProxy = A7C489B420F750BF001F74C0 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
6003F596195388D20070C39A /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
6003F597195388D20070C39A /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6003F5B8195388D20070C39A /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
6003F5B9195388D20070C39A /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
71719F9E1E33DC2100824A3D /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
6003F5BD195388D20070C39A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6003F5BE195388D20070C39A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
6003F5C0195388D20070C39A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Logan-iOS/Logan-iOS-Prefix.pch";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"../../Logan/Clogan/**",
|
||||
"../../Logan/mbedtls/include/**",
|
||||
);
|
||||
INFOPLIST_FILE = "Logan-iOS/Logan-iOS-Info.plist";
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6003F5C1195388D20070C39A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Logan-iOS/Logan-iOS-Prefix.pch";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"../../Logan/Clogan/**",
|
||||
"../../Logan/mbedtls/include/**",
|
||||
);
|
||||
INFOPLIST_FILE = "Logan-iOS/Logan-iOS-Info.plist";
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
6003F5C3195388D20070C39A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
);
|
||||
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
|
||||
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = "Tests/Tests-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Logan-iOS_Example.app/Logan-iOS_Example";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6003F5C4195388D20070C39A /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
);
|
||||
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
|
||||
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch";
|
||||
INFOPLIST_FILE = "Tests/Tests-Info.plist";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Logan-iOS_Example.app/Logan-iOS_Example";
|
||||
WRAPPER_EXTENSION = xctest;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
6003F585195388D10070C39A /* Build configuration list for PBXProject "Logan-iOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
6003F5BD195388D20070C39A /* Debug */,
|
||||
6003F5BE195388D20070C39A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "Logan-iOS_Example" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
6003F5C0195388D20070C39A /* Debug */,
|
||||
6003F5C1195388D20070C39A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "Logan-iOS_Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
6003F5C3195388D20070C39A /* Debug */,
|
||||
6003F5C4195388D20070C39A /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 6003F582195388D10070C39A /* Project object */;
|
||||
}
|
||||
7
Example/Logan-iOS/Logan-iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
Example/Logan-iOS/Logan-iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:Logan-iOS.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0720"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6003F589195388D20070C39A"
|
||||
BuildableName = "Logan-iOS_Example.app"
|
||||
BlueprintName = "Logan-iOS_Example"
|
||||
ReferencedContainer = "container:Logan-iOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
codeCoverageEnabled = "YES"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "YES"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<PostActions>
|
||||
<ExecutionAction
|
||||
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
|
||||
<ActionContent
|
||||
title = "Run Script"
|
||||
scriptText = "${SRCROOT}/XcodeCoverage/run_code_coverage_post.sh/"
|
||||
shellToInvoke = "/bin/bash">
|
||||
<EnvironmentBuildable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6003F589195388D20070C39A"
|
||||
BuildableName = "Logan-iOS_Example.app"
|
||||
BlueprintName = "Logan-iOS_Example"
|
||||
ReferencedContainer = "container:Logan-iOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</EnvironmentBuildable>
|
||||
</ActionContent>
|
||||
</ExecutionAction>
|
||||
<ExecutionAction
|
||||
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
|
||||
<ActionContent
|
||||
title = "Run Script"
|
||||
scriptText = "${SRCROOT}/Coverage/get_coverage_report.sh "
|
||||
shellToInvoke = "/bin/bash">
|
||||
<EnvironmentBuildable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6003F589195388D20070C39A"
|
||||
BuildableName = "Logan-iOS_Example.app"
|
||||
BlueprintName = "Logan-iOS_Example"
|
||||
ReferencedContainer = "container:Logan-iOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</EnvironmentBuildable>
|
||||
</ActionContent>
|
||||
</ExecutionAction>
|
||||
</PostActions>
|
||||
<CodeCoverageTargets>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6003F589195388D20070C39A"
|
||||
BuildableName = "Logan-iOS_Example.app"
|
||||
BlueprintName = "Logan-iOS_Example"
|
||||
ReferencedContainer = "container:Logan-iOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</CodeCoverageTargets>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6003F5AD195388D20070C39A"
|
||||
BuildableName = "Logan-iOS_Tests.xctest"
|
||||
BlueprintName = "Logan-iOS_Tests"
|
||||
ReferencedContainer = "container:Logan-iOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6003F589195388D20070C39A"
|
||||
BuildableName = "Logan-iOS_Example.app"
|
||||
BlueprintName = "Logan-iOS_Example"
|
||||
ReferencedContainer = "container:Logan-iOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6003F589195388D20070C39A"
|
||||
BuildableName = "Logan-iOS_Example.app"
|
||||
BlueprintName = "Logan-iOS_Example"
|
||||
ReferencedContainer = "container:Logan-iOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6003F589195388D20070C39A"
|
||||
BuildableName = "Logan-iOS_Example.app"
|
||||
BlueprintName = "Logan-iOS_Example"
|
||||
ReferencedContainer = "container:Logan-iOS.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
82
Example/Logan-iOS/Logan-iOS/Base.lproj/Main.storyboard
Normal file
82
Example/Logan-iOS/Logan-iOS/Base.lproj/Main.storyboard
Normal file
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="whP-gf-Uak">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="wQg-tq-qST">
|
||||
<objects>
|
||||
<viewController id="whP-gf-Uak" customClass="LGViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="uEw-UM-LJ8"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="Mvr-aV-6Um"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="TpU-gO-2f1">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BpX-3e-jvr">
|
||||
<rect key="frame" x="36" y="69" width="92" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="测试日志写入"/>
|
||||
<connections>
|
||||
<action selector="lllog:" destination="whP-gf-Uak" eventType="touchUpInside" id="n50-Xx-Bh5"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="b97-TW-WSZ">
|
||||
<rect key="frame" x="39" y="163" width="153" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="查看所有日志文件信息"/>
|
||||
<connections>
|
||||
<action selector="allFilesInfo:" destination="whP-gf-Uak" eventType="touchUpInside" id="w4H-gm-KO0"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kos-QU-zrA">
|
||||
<rect key="frame" x="39" y="115" width="92" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="测试日志上报"/>
|
||||
<connections>
|
||||
<action selector="uploadFile:" destination="whP-gf-Uak" eventType="touchUpInside" id="Sy4-4v-Q93"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="server ip" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hiC-vX-vb6">
|
||||
<rect key="frame" x="144" y="120" width="70" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="127.0.0.1" borderStyle="roundedRect" placeholder="请输入server ip地址" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="tsE-6W-owH">
|
||||
<rect key="frame" x="218" y="115" width="97" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" keyboardType="numbersAndPunctuation"/>
|
||||
</textField>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" editable="NO" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hsM-Sm-zNN">
|
||||
<rect key="frame" x="39" y="215" width="289" height="171"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="filesInfo" destination="hsM-Sm-zNN" id="58d-ba-lXX"/>
|
||||
<outlet property="ipText" destination="tsE-6W-owH" id="CVG-EQ-j8b"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="tc2-Qw-aMS" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="304.80000000000001" y="432.23388305847078"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@ -0,0 +1,98 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
30
Example/Logan-iOS/Logan-iOS/LGAppDelegate.h
Normal file
30
Example/Logan-iOS/Logan-iOS/LGAppDelegate.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@import UIKit;
|
||||
|
||||
|
||||
@interface LGAppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
@end
|
||||
55
Example/Logan-iOS/Logan-iOS/LGAppDelegate.m
Normal file
55
Example/Logan-iOS/Logan-iOS/LGAppDelegate.m
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#import "LGAppDelegate.h"
|
||||
|
||||
|
||||
@implementation LGAppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for customization after application launch.
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
@end
|
||||
28
Example/Logan-iOS/Logan-iOS/LGViewController.h
Normal file
28
Example/Logan-iOS/Logan-iOS/LGViewController.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@import UIKit;
|
||||
|
||||
|
||||
@interface LGViewController : UIViewController
|
||||
|
||||
@end
|
||||
108
Example/Logan-iOS/Logan-iOS/LGViewController.m
Normal file
108
Example/Logan-iOS/Logan-iOS/LGViewController.m
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#import "LGViewController.h"
|
||||
#import "Logan.h"
|
||||
#include <zlib.h>
|
||||
#import <CommonCrypto/CommonCryptor.h>
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
LoganTypeAction = 1, //用户行为日志
|
||||
LoganTypeNetwork = 2, //网络级日志
|
||||
} LoganType;
|
||||
|
||||
|
||||
@interface LGViewController ()
|
||||
@property (nonatomic, assign) int count;
|
||||
@property (weak, nonatomic) IBOutlet UITextView *filesInfo;
|
||||
@property (weak, nonatomic) IBOutlet UITextField *ipText;
|
||||
@end
|
||||
|
||||
|
||||
@implementation LGViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
NSData *keydata = [@"0123456789012345" dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSData *ivdata = [@"0123456789012345" dataUsingEncoding:NSUTF8StringEncoding];
|
||||
uint64_t file_max = 10 * 1024 * 1024;
|
||||
// logan初始化,传入16位key,16位iv,写入文件最大大小(byte)
|
||||
loganInit(keydata, ivdata, file_max);
|
||||
// 将日志输出至控制台
|
||||
loganUseASL(YES);
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
- (IBAction)lllog:(id)sender {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
//行为日志
|
||||
[self eventLogType:1 forLabel:[NSString stringWithFormat:@"click button %d", _count++]];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)allFilesInfo:(id)sender {
|
||||
NSDictionary *files = loganAllFilesInfo();
|
||||
|
||||
NSMutableString *str = [[NSMutableString alloc] init];
|
||||
for (NSString *k in files.allKeys) {
|
||||
[str appendFormat:@"文件日期 %@,大小 %@byte\n", k, [files objectForKey:k]];
|
||||
}
|
||||
|
||||
self.filesInfo.text = str;
|
||||
}
|
||||
|
||||
- (IBAction)uploadFile:(id)sender {
|
||||
loganUploadFilePath(loganTodaysDate(), ^(NSString *_Nullable filePatch) {
|
||||
if (filePatch == nil) {
|
||||
return;
|
||||
}
|
||||
NSString *urlStr = [NSString stringWithFormat:@"http://%@:3000/logupload", self.ipText.text ?: @"127.0.0.1"];
|
||||
NSURL *url = [NSURL URLWithString:urlStr];
|
||||
NSMutableURLRequest *req = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60];
|
||||
[req setHTTPMethod:@"POST"];
|
||||
[req addValue:@"binary/octet-stream" forHTTPHeaderField:@"Content-Type"];
|
||||
NSURL *fileUrl = [NSURL fileURLWithPath:filePatch];
|
||||
NSURLSessionUploadTask *task = [[NSURLSession sharedSession] uploadTaskWithRequest:req fromFile:fileUrl completionHandler:^(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError *_Nullable error) {
|
||||
if (error == nil) {
|
||||
NSLog(@"上传完成");
|
||||
} else {
|
||||
NSLog(@"上传失败 error:%@", error);
|
||||
}
|
||||
}];
|
||||
[task resume];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
用户行为日志
|
||||
|
||||
@param eventType 事件类型
|
||||
@param label 描述
|
||||
*/
|
||||
- (void)eventLogType:(NSInteger)eventType forLabel:(NSString *)label {
|
||||
NSMutableString *s = [NSMutableString string];
|
||||
[s appendFormat:@"%d\t", (int)eventType];
|
||||
[s appendFormat:@"%@\t", label];
|
||||
logan(LoganTypeAction, s);
|
||||
}
|
||||
@end
|
||||
54
Example/Logan-iOS/Logan-iOS/Logan-iOS-Info.plist
Normal file
54
Example/Logan-iOS/Logan-iOS/Logan-iOS-Info.plist
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
16
Example/Logan-iOS/Logan-iOS/Logan-iOS-Prefix.pch
Normal file
16
Example/Logan-iOS/Logan-iOS/Logan-iOS-Prefix.pch
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Prefix header
|
||||
//
|
||||
// The contents of this file are implicitly included at the beginning of every source file.
|
||||
//
|
||||
|
||||
#import <Availability.h>
|
||||
|
||||
#ifndef __IPHONE_5_0
|
||||
#warning "This project uses features only available in iOS SDK 5.0 and later."
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
@import UIKit;
|
||||
@import Foundation;
|
||||
#endif
|
||||
2
Example/Logan-iOS/Logan-iOS/en.lproj/InfoPlist.strings
Normal file
2
Example/Logan-iOS/Logan-iOS/en.lproj/InfoPlist.strings
Normal file
@ -0,0 +1,2 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
30
Example/Logan-iOS/Logan-iOS/main.m
Normal file
30
Example/Logan-iOS/Logan-iOS/main.m
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@import UIKit;
|
||||
#import "LGAppDelegate.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([LGAppDelegate class]));
|
||||
}
|
||||
}
|
||||
76
Example/Logan-iOS/Tests/LoganTests.m
Normal file
76
Example/Logan-iOS/Tests/LoganTests.m
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "Logan.h"
|
||||
|
||||
|
||||
@interface LoganTests : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation LoganTests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
NSData *keydata = [@"0123456789012345" dataUsingEncoding:NSUTF8StringEncoding];
|
||||
NSData *ivdata = [@"0123456789012345" dataUsingEncoding:NSUTF8StringEncoding];
|
||||
uint64_t file_max = 10 * 1024 * 1024;
|
||||
loganInit(keydata, ivdata, file_max);
|
||||
logan(1, @"test");
|
||||
loganUseASL(YES);
|
||||
loganPrintClibLog(YES);
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testWirte {
|
||||
logan(1, @"test");
|
||||
}
|
||||
|
||||
- (void)testClear {
|
||||
loganClearAllLogs();
|
||||
}
|
||||
|
||||
- (void)testAllFilesInfo {
|
||||
NSDictionary *info = loganAllFilesInfo();
|
||||
XCTAssertNotNil(info, @"all files info should not be nil");
|
||||
}
|
||||
|
||||
- (void)testTodaysDate {
|
||||
XCTAssertNotNil(loganTodaysDate(), @"todays date should not be nil");
|
||||
}
|
||||
|
||||
- (void)testUploadFilePath {
|
||||
loganUploadFilePath(loganTodaysDate(), ^(NSString *_Nullable filePatch) {
|
||||
XCTAssertNotNil(filePatch, @"file patch should not be nil");
|
||||
});
|
||||
}
|
||||
|
||||
- (void)testFlash {
|
||||
loganFlash();
|
||||
}
|
||||
|
||||
@end
|
||||
22
Example/Logan-iOS/Tests/Tests-Info.plist
Normal file
22
Example/Logan-iOS/Tests/Tests-Info.plist
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
7
Example/Logan-iOS/Tests/Tests-Prefix.pch
Normal file
7
Example/Logan-iOS/Tests/Tests-Prefix.pch
Normal file
@ -0,0 +1,7 @@
|
||||
// The contents of this file are implicitly included at the beginning of every test case source file.
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
47
Example/Logan-iOS/Tests/Tests.m
Normal file
47
Example/Logan-iOS/Tests/Tests.m
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@import XCTest;
|
||||
|
||||
|
||||
@interface Tests : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation Tests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testExample {
|
||||
// XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
@end
|
||||
2
Example/Logan-iOS/Tests/en.lproj/InfoPlist.strings
Normal file
2
Example/Logan-iOS/Tests/en.lproj/InfoPlist.strings
Normal file
@ -0,0 +1,2 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, 美团点评
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
23
Logan.podspec
Normal file
23
Logan.podspec
Normal file
@ -0,0 +1,23 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'Logan'
|
||||
s.version = '0.0.19'
|
||||
s.summary = 'Logan.'
|
||||
|
||||
s.description = <<-DESC
|
||||
logan c版本
|
||||
DESC
|
||||
|
||||
s.homepage = 'http://git.dianpingoa.com/v1/sh/projects/MOBILE/repos/nova-clogan/browse'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'white.bai' => 'white.bai@dianping.com' }
|
||||
s.source = { :git => 'ssh://git@git.dianpingoa.com/mobile/nova-clogan.git', :tag => s.version.to_s }
|
||||
s.libraries = "z","c++"
|
||||
s.ios.deployment_target = '8.0'
|
||||
|
||||
s.source_files = "clogan/**/*.{h,c}"
|
||||
s.public_header_files = "clogan/**/*.h"
|
||||
s.subspec 'mbedtls' do |mbedtls|
|
||||
mbedtls.source_files = "mbedtls/**/*.{c,h}"
|
||||
mbedtls.header_dir = 'mbedtls'
|
||||
end
|
||||
end
|
||||
20
Logan/Clogan/CMakeLists.txt
Normal file
20
Logan/Clogan/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
set(MBEDTSL_INCLUDE ../mbedtls/include)
|
||||
set(MBEDTSL_LIBRARY ../mbedtls/library)
|
||||
|
||||
include_directories(${MBEDTSL_INCLUDE})
|
||||
|
||||
add_subdirectory(${MBEDTSL_LIBRARY} clogan.out)
|
||||
|
||||
set(SOURCE_FILES
|
||||
clogan_core.c
|
||||
mmap_util.c mmap_util.c cJSON.c
|
||||
construct_data.c construct_data.c
|
||||
zlib_util.h zlib_util.c logan_config.h
|
||||
json_util.h json_util.c aes_util.h aes_util.c
|
||||
clogan_status.h
|
||||
directory_util.h directory_util.c base_util.h base_util.c console_util.h console_util.c)
|
||||
|
||||
add_library (clogan ${SOURCE_FILES})
|
||||
target_link_libraries(clogan mbedcrypto)
|
||||
42
Logan/Clogan/aes_util.c
Normal file
42
Logan/Clogan/aes_util.c
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "aes_util.h"
|
||||
#include "mbedtls/aes.h"
|
||||
|
||||
static unsigned char KEY[16] = {0};
|
||||
static unsigned char IV[16] = {0};
|
||||
|
||||
void aes_encrypt_clogan(unsigned char *in, unsigned char *out, int length, unsigned char *iv) {
|
||||
mbedtls_aes_context context;
|
||||
mbedtls_aes_setkey_enc(&context, (unsigned char *) KEY, 128);
|
||||
mbedtls_aes_crypt_cbc(&context, MBEDTLS_AES_ENCRYPT, length, iv, in, out); //加密
|
||||
}
|
||||
|
||||
void aes_init_key_iv(const char *key, const char *iv) {
|
||||
memcpy(KEY, key, 16);
|
||||
memcpy(IV, iv, 16);
|
||||
}
|
||||
|
||||
void aes_infalte_iv_clogan(unsigned char *aes_iv) {
|
||||
memcpy(aes_iv, IV, 16);
|
||||
}
|
||||
34
Logan/Clogan/aes_util.h
Normal file
34
Logan/Clogan/aes_util.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_AES_UTIL_H
|
||||
#define CLOGAN_AES_UTIL_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void aes_encrypt_clogan(unsigned char *in, unsigned char *out, int length, unsigned char *iv);
|
||||
|
||||
void aes_init_key_iv(const char *key, const char *iv);
|
||||
|
||||
void aes_infalte_iv_clogan(unsigned char *aes_iv);
|
||||
|
||||
#endif //CLOGAN_AES_UTIL_H
|
||||
84
Logan/Clogan/base_util.c
Normal file
84
Logan/Clogan/base_util.c
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <memory.h>
|
||||
#include "console_util.h"
|
||||
|
||||
#define LOGAN_BYTEORDER_NONE 0
|
||||
#define LOGAN_BYTEORDER_HIGH 1
|
||||
#define LOGAN_BYTEORDER_LOW 2
|
||||
|
||||
//获取毫秒时间戳
|
||||
long long get_system_current_clogan(void) {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long time = ((long long) tv.tv_sec) * 1000 + ((long long) tv.tv_usec) / 1000;
|
||||
return time;
|
||||
}
|
||||
|
||||
//是否为空字符串
|
||||
int is_string_empty_clogan(char *item) {
|
||||
int flag = 1;
|
||||
if (NULL != item && strnlen(item, 10) > 0) {
|
||||
flag = 0;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// 检查CPU的字节序
|
||||
int cpu_byteorder_clogan(void) {
|
||||
static int LOGAN_BYTEORDER = LOGAN_BYTEORDER_NONE;
|
||||
if (LOGAN_BYTEORDER == LOGAN_BYTEORDER_NONE) {
|
||||
union {
|
||||
int i;
|
||||
char c;
|
||||
} t;
|
||||
t.i = 1;
|
||||
if (t.c == 1) {
|
||||
LOGAN_BYTEORDER = LOGAN_BYTEORDER_LOW;
|
||||
printf_clogan("cpu_byteorder_clogan > system is a low byteorder\n");
|
||||
} else {
|
||||
LOGAN_BYTEORDER = LOGAN_BYTEORDER_HIGH;
|
||||
printf_clogan("cpu_byteorder_clogan > system is a high byteorder\n");
|
||||
}
|
||||
}
|
||||
return LOGAN_BYTEORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调整字节序,默认传入的字节序为低字节序,如果系统为高字节序,转化为高字节序
|
||||
* c语言字节序的写入是低字节序的,读取默认也是低字节序的
|
||||
* java语言字节序默认是高字节序的
|
||||
* @param data data
|
||||
*/
|
||||
void adjust_byteorder_clogan(char data[4]) {
|
||||
if (cpu_byteorder_clogan() == LOGAN_BYTEORDER_HIGH) {
|
||||
char *temp = data;
|
||||
char data_temp = *temp;
|
||||
*temp = *(temp + 3);
|
||||
*(temp + 3) = data_temp;
|
||||
data_temp = *(temp + 1);
|
||||
*(temp + 1) = *(temp + 2);
|
||||
*(temp + 2) = data_temp;
|
||||
}
|
||||
}
|
||||
46
Logan/Clogan/base_util.h
Normal file
46
Logan/Clogan/base_util.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_BASE_UTIL_H
|
||||
#define CLOGAN_BASE_UTIL_H
|
||||
|
||||
//获取时间毫秒
|
||||
long long get_system_current_clogan(void);
|
||||
|
||||
//判断String是否为空
|
||||
int is_string_empty_clogan(char *item);
|
||||
|
||||
/**
|
||||
* 检查CPU的字节序
|
||||
* @return 1,高字节序 2,低字节序
|
||||
*/
|
||||
int cpu_byteorder_clogan(void);
|
||||
|
||||
/**
|
||||
* 调整字节序,默认传入的字节序为低字节序,如果系统为高字节序,转化为高字节序
|
||||
* c语言字节序的写入是低字节序的,读取默认也是低字节序的
|
||||
* java语言字节序默认是高字节序的
|
||||
* @param data
|
||||
*/
|
||||
void adjust_byteorder_clogan(char item[4]);
|
||||
|
||||
#endif //CLOGAN_BASE_UTIL_H
|
||||
2742
Logan/Clogan/cJSON.c
Normal file
2742
Logan/Clogan/cJSON.c
Normal file
File diff suppressed because it is too large
Load Diff
263
Logan/Clogan/cJSON.h
Normal file
263
Logan/Clogan/cJSON.h
Normal file
@ -0,0 +1,263 @@
|
||||
/*
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef cJSON__h
|
||||
#define cJSON__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* project version */
|
||||
#define CJSON_VERSION_MAJOR 1
|
||||
#define CJSON_VERSION_MINOR 5
|
||||
#define CJSON_VERSION_PATCH 6
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* cJSON Types: */
|
||||
#define cJSON_Invalid (0)
|
||||
#define cJSON_False (1 << 0)
|
||||
#define cJSON_True (1 << 1)
|
||||
#define cJSON_NULL (1 << 2)
|
||||
#define cJSON_Number (1 << 3)
|
||||
#define cJSON_String (1 << 4)
|
||||
#define cJSON_Array (1 << 5)
|
||||
#define cJSON_Object (1 << 6)
|
||||
#define cJSON_Raw (1 << 7) /* raw json */
|
||||
|
||||
#define cJSON_IsReference 256
|
||||
#define cJSON_StringIsConst 512
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON
|
||||
{
|
||||
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *next;
|
||||
struct cJSON *prev;
|
||||
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
struct cJSON *child;
|
||||
|
||||
/* The type of the item, as above. */
|
||||
int type;
|
||||
|
||||
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||
char *valuestring;
|
||||
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||
int valueint;
|
||||
/* The item's number, if type==cJSON_Number */
|
||||
double valuedouble;
|
||||
|
||||
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
char *string;
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks
|
||||
{
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
typedef int cJSON_bool;
|
||||
|
||||
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 2 define options:
|
||||
|
||||
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||
|
||||
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||
|
||||
setting default visibility to hidden by adding
|
||||
-fvisibility=hidden (for gcc)
|
||||
or
|
||||
-xldscope=hidden (for sun cc)
|
||||
to CFLAGS
|
||||
|
||||
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||
|
||||
*/
|
||||
|
||||
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_EXPORT_SYMBOLS
|
||||
#endif
|
||||
|
||||
#if defined(CJSON_HIDE_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) type __stdcall
|
||||
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllexport) type __stdcall
|
||||
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllimport) type __stdcall
|
||||
#endif
|
||||
#else /* !WIN32 */
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||
#else
|
||||
#define CJSON_PUBLIC(type) type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||
* This is to prevent stack overflows. */
|
||||
#ifndef CJSON_NESTING_LIMIT
|
||||
#define CJSON_NESTING_LIMIT 1000
|
||||
#endif
|
||||
|
||||
/* returns the version of cJSON as a string */
|
||||
CJSON_PUBLIC(const char*) cJSON_Version(void);
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
|
||||
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error. If not, then cJSON_GetErrorPtr() does the job. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||
|
||||
/* Render a cJSON entity to text for transfer/storage. */
|
||||
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
CJSON_PUBLIC(void) cJSON_Delete(cJSON *c);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
|
||||
|
||||
/* These functions check the type of an item */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
|
||||
/* raw json */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
|
||||
|
||||
/* These utilities create an Array of count items. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count);
|
||||
|
||||
/* Append item to the specified array/object. */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||
* writing to `item->string` */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||
|
||||
/* Remove/Detatch items from Arrays/Objects. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
|
||||
/* Update array items. */
|
||||
CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
|
||||
|
||||
|
||||
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||
|
||||
/* Macros for creating things quickly. */
|
||||
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
|
||||
#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
|
||||
#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
|
||||
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
|
||||
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
|
||||
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
|
||||
#define cJSON_AddRawToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateRaw(s))
|
||||
|
||||
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||
/* helper for the cJSON_SetNumberValue macro */
|
||||
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||
|
||||
/* Macro for iterating over an array or object */
|
||||
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||
|
||||
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
766
Logan/Clogan/clogan_core.c
Normal file
766
Logan/Clogan/clogan_core.c
Normal file
@ -0,0 +1,766 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "clogan_core.h"
|
||||
|
||||
#include "mmap_util.h"
|
||||
#include "construct_data.h"
|
||||
#include "cJSON.h"
|
||||
#include "json_util.h"
|
||||
#include "zlib_util.h"
|
||||
#include "aes_util.h"
|
||||
#include "directory_util.h"
|
||||
#include "base_util.h"
|
||||
#include "console_util.h"
|
||||
#include "clogan_status.h"
|
||||
|
||||
static int is_init_ok = 0;
|
||||
static int is_open_ok = 0;
|
||||
|
||||
static unsigned char *_logan_buffer = NULL; //缓存Buffer (不释放)
|
||||
|
||||
static char *_dir_path = NULL; //目录路径 (不释放)
|
||||
|
||||
static char *_mmap_file_path = NULL; //mmap文件路径 (不释放)
|
||||
|
||||
static int buffer_length = 0; //缓存区域的大小
|
||||
|
||||
static unsigned char *_cache_buffer_buffer = NULL; //临时缓存文件 (不释放)
|
||||
|
||||
static int buffer_type; //缓存区块的类型
|
||||
|
||||
static long max_file_len = LOGAN_LOGFILE_MAXLENGTH;
|
||||
|
||||
static cLogan_model *logan_model = NULL; //(不释放)
|
||||
|
||||
int init_file_clogan(cLogan_model *logan_model) {
|
||||
int is_ok = 0;
|
||||
if (LOGAN_FILE_OPEN == logan_model->file_stream_type) {
|
||||
return 1;
|
||||
} else {
|
||||
FILE *file_temp = fopen(logan_model->file_path, "ab+");
|
||||
if (NULL != file_temp) { //初始化文件流开启
|
||||
logan_model->file = file_temp;
|
||||
fseek(file_temp, 0, SEEK_END);
|
||||
long longBytes = ftell(file_temp);
|
||||
logan_model->file_len = longBytes;
|
||||
logan_model->file_stream_type = LOGAN_FILE_OPEN;
|
||||
is_ok = 1;
|
||||
} else {
|
||||
logan_model->file_stream_type = LOGAN_FILE_NONE;
|
||||
}
|
||||
}
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
void init_encrypt_key_clogan(cLogan_model *logan_model) {
|
||||
aes_infalte_iv_clogan(logan_model->aes_iv);
|
||||
}
|
||||
|
||||
void write_mmap_data_clogan(char *path, unsigned char *temp) {
|
||||
logan_model->total_point = temp;
|
||||
logan_model->file_path = path;
|
||||
char len_array[] = {'\0', '\0', '\0', '\0'};
|
||||
len_array[0] = *temp;
|
||||
temp++;
|
||||
len_array[1] = *temp;
|
||||
temp++;
|
||||
len_array[2] = *temp;
|
||||
|
||||
adjust_byteorder_clogan(len_array);//调整字节序,默认为低字节序,在读取的地方处理
|
||||
|
||||
int *total_len = (int *) len_array;
|
||||
|
||||
int t = *total_len;
|
||||
printf_clogan("write_mmapdata_clogan > buffer total length %d\n", t);
|
||||
if (t > LOGAN_WRITEPROTOCOL_HEAER_LENGTH && t < LOGAN_MMAP_LENGTH) {
|
||||
logan_model->total_len = t;
|
||||
if (NULL != logan_model) {
|
||||
if (init_file_clogan(logan_model)) {
|
||||
logan_model->is_ok = 1;
|
||||
logan_model->zlib_type = LOGAN_ZLIB_NONE;
|
||||
clogan_flush();
|
||||
fclose(logan_model->file);
|
||||
logan_model->file_stream_type = LOGAN_FILE_CLOSE;
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logan_model->file_stream_type = LOGAN_FILE_NONE;
|
||||
}
|
||||
logan_model->total_len = 0;
|
||||
logan_model->file_path = NULL;
|
||||
}
|
||||
|
||||
void read_mmap_data_clogan(const char *path_dirs) {
|
||||
if (buffer_type == LOGAN_MMAP_MMAP) {
|
||||
unsigned char *temp = _logan_buffer;
|
||||
unsigned char *temp2 = NULL;
|
||||
char i = *temp;
|
||||
if (LOGAN_MMAP_HEADER_PROTOCOL == i) {
|
||||
temp++;
|
||||
char len_array[] = {'\0', '\0', '\0', '\0'};
|
||||
len_array[0] = *temp;
|
||||
temp++;
|
||||
len_array[1] = *temp;
|
||||
adjust_byteorder_clogan(len_array);
|
||||
int *len_p = (int *) len_array;
|
||||
temp++;
|
||||
temp2 = temp;
|
||||
int len = *len_p;
|
||||
|
||||
printf_clogan("read_mmapdata_clogan > path's json length : %d\n", len);
|
||||
|
||||
if (len > 0 && len < 1024) {
|
||||
temp += len;
|
||||
i = *temp;
|
||||
if (LOGAN_MMAP_TAIL_PROTOCOL == i) {
|
||||
char dir_json[len];
|
||||
memset(dir_json, 0, len);
|
||||
memcpy(dir_json, temp2, len);
|
||||
printf_clogan("dir_json %s\n", dir_json);
|
||||
cJSON *cjson = cJSON_Parse(dir_json);
|
||||
|
||||
if (NULL != cjson) {
|
||||
cJSON *dir_str = cJSON_GetObjectItem(cjson,
|
||||
LOGAN_VERSION_KEY); //删除json根元素释放
|
||||
cJSON *path_str = cJSON_GetObjectItem(cjson, LOGAN_PATH_KEY);
|
||||
if ((NULL != dir_str && cJSON_Number == dir_str->type &&
|
||||
CLOGAN_VERSION_NUMBER == dir_str->valuedouble) &&
|
||||
(NULL != path_str && path_str->type == cJSON_String &&
|
||||
!is_string_empty_clogan(path_str->valuestring))) {
|
||||
|
||||
printf_clogan(
|
||||
"read_mmapdata_clogan > dir , path and version : %s || %s || %lf\n",
|
||||
path_dirs, path_str->valuestring, dir_str->valuedouble);
|
||||
|
||||
size_t dir_len = strlen(path_dirs);
|
||||
size_t path_len = strlen(path_str->valuestring);
|
||||
size_t length = dir_len + path_len + 1;
|
||||
char file_path[length];
|
||||
memset(file_path, 0, length);
|
||||
memcpy(file_path, path_dirs, dir_len);
|
||||
strcat(file_path, path_str->valuestring);
|
||||
temp++;
|
||||
write_mmap_data_clogan(file_path, temp);
|
||||
}
|
||||
cJSON_Delete(cjson);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logan初始化
|
||||
* @param cachedirs 缓存路径
|
||||
* @param pathdirs 目录路径
|
||||
* @param max_file 日志文件最大值
|
||||
*/
|
||||
int
|
||||
clogan_init(const char *cache_dirs, const char *path_dirs, int max_file, const char *encrypt_key16,
|
||||
const char *encrypt_iv16) {
|
||||
int back = CLOGAN_INIT_FAIL_HEADER;
|
||||
if (is_init_ok ||
|
||||
NULL == cache_dirs || strnlen(cache_dirs, 11) == 0 ||
|
||||
NULL == path_dirs || strnlen(path_dirs, 11) == 0 ||
|
||||
NULL == encrypt_key16 || NULL == encrypt_iv16) {
|
||||
back = CLOGAN_INIT_FAIL_HEADER;
|
||||
return back;
|
||||
}
|
||||
|
||||
if (max_file > 0) {
|
||||
max_file_len = max_file;
|
||||
} else {
|
||||
max_file_len = LOGAN_LOGFILE_MAXLENGTH;
|
||||
}
|
||||
|
||||
if (NULL != _dir_path) { // 初始化时 , _dir_path和_mmap_file_path是非空值,先释放,再NULL
|
||||
free(_dir_path);
|
||||
_dir_path = NULL;
|
||||
}
|
||||
if (NULL != _mmap_file_path) {
|
||||
free(_mmap_file_path);
|
||||
_mmap_file_path = NULL;
|
||||
}
|
||||
|
||||
aes_init_key_iv(encrypt_key16, encrypt_iv16);
|
||||
|
||||
size_t path1 = strlen(cache_dirs);
|
||||
size_t path2 = strlen(LOGAN_CACHE_DIR);
|
||||
size_t path3 = strlen(LOGAN_CACHE_FILE);
|
||||
size_t path4 = strlen(LOGAN_DIVIDE_SYMBOL);
|
||||
|
||||
int isAddDivede = 0;
|
||||
char d = *(cache_dirs + path1 - 1);
|
||||
if (d != '/') {
|
||||
isAddDivede = 1;
|
||||
}
|
||||
|
||||
size_t total = path1 + (isAddDivede ? path4 : 0) + path2 + path4 + path3 + 1;
|
||||
char *cache_path = malloc(total);
|
||||
if (NULL != cache_path) {
|
||||
_mmap_file_path = cache_path; //保持mmap文件路径,如果初始化失败,注意释放_mmap_file_path
|
||||
} else {
|
||||
is_init_ok = 0;
|
||||
printf_clogan("clogan_init > malloc memory fail for mmap_file_path \n");
|
||||
back = CLOGAN_INIT_FAIL_NOMALLOC;
|
||||
return back;
|
||||
}
|
||||
|
||||
memset(cache_path, 0, total);
|
||||
strcpy(cache_path, cache_dirs);
|
||||
if (isAddDivede)
|
||||
strcat(cache_path, LOGAN_DIVIDE_SYMBOL);
|
||||
|
||||
strcat(cache_path, LOGAN_CACHE_DIR);
|
||||
strcat(cache_path, LOGAN_DIVIDE_SYMBOL);
|
||||
|
||||
makedir_clogan(cache_path); //创建保存mmap文件的目录
|
||||
|
||||
strcat(cache_path, LOGAN_CACHE_FILE);
|
||||
|
||||
size_t dirLength = strlen(path_dirs);
|
||||
|
||||
isAddDivede = 0;
|
||||
d = *(path_dirs + dirLength - 1);
|
||||
if (d != '/') {
|
||||
isAddDivede = 1;
|
||||
}
|
||||
total = dirLength + (isAddDivede ? path4 : 0) + 1;
|
||||
|
||||
char *dirs = (char *) malloc(total); //缓存文件目录
|
||||
|
||||
if (NULL != dirs) {
|
||||
_dir_path = dirs; //日志写入的文件目录
|
||||
} else {
|
||||
is_init_ok = 0;
|
||||
printf_clogan("clogan_init > malloc memory fail for _dir_path \n");
|
||||
back = CLOGAN_INIT_FAIL_NOMALLOC;
|
||||
return back;
|
||||
}
|
||||
memset(dirs, 0, total);
|
||||
memcpy(dirs, path_dirs, dirLength);
|
||||
if (isAddDivede)
|
||||
strcat(dirs, LOGAN_DIVIDE_SYMBOL);
|
||||
makedir_clogan(_dir_path); //创建缓存目录,如果初始化失败,注意释放_dir_path
|
||||
|
||||
int flag = LOGAN_MMAP_FAIL;
|
||||
if (NULL == _logan_buffer) {
|
||||
if (NULL == _cache_buffer_buffer) {
|
||||
flag = open_mmap_file_clogan(cache_path, &_logan_buffer, &_cache_buffer_buffer);
|
||||
} else {
|
||||
flag = LOGAN_MMAP_MEMORY;
|
||||
}
|
||||
} else {
|
||||
flag = LOGAN_MMAP_MMAP;
|
||||
}
|
||||
|
||||
if (flag == LOGAN_MMAP_MMAP) {
|
||||
buffer_length = LOGAN_MMAP_LENGTH;
|
||||
buffer_type = LOGAN_MMAP_MMAP;
|
||||
is_init_ok = 1;
|
||||
back = CLOGAN_INIT_SUCCESS_MMAP;
|
||||
} else if (flag == LOGAN_MMAP_MEMORY) {
|
||||
buffer_length = LOGAN_MEMORY_LENGTH;
|
||||
buffer_type = LOGAN_MMAP_MEMORY;
|
||||
is_init_ok = 1;
|
||||
back = CLOGAN_INIT_SUCCESS_MEMORY;
|
||||
} else if (flag == LOGAN_MMAP_FAIL) {
|
||||
is_init_ok = 0;
|
||||
back = CLOGAN_INIT_FAIL_NOCACHE;
|
||||
}
|
||||
|
||||
if (is_init_ok) {
|
||||
if (NULL == logan_model) {
|
||||
logan_model = malloc(sizeof(cLogan_model));
|
||||
if (NULL != logan_model) { //堆非空判断 , 如果为null , 就失败
|
||||
memset(logan_model, 0, sizeof(cLogan_model));
|
||||
} else {
|
||||
is_init_ok = 0;
|
||||
printf_clogan("clogan_init > malloc memory fail for logan_model\n");
|
||||
back = CLOGAN_INIT_FAIL_NOMALLOC;
|
||||
return back;
|
||||
}
|
||||
}
|
||||
if (flag == LOGAN_MMAP_MMAP) //MMAP的缓存模式,从缓存的MMAP中读取数据
|
||||
read_mmap_data_clogan(_dir_path);
|
||||
printf_clogan("clogan_init > logan init success\n");
|
||||
} else {
|
||||
printf_clogan("clogan_open > logan init fail\n");
|
||||
// 初始化失败,删除所有路径
|
||||
if (NULL == _dir_path) {
|
||||
free(_dir_path);
|
||||
_dir_path = NULL;
|
||||
}
|
||||
if (NULL == _mmap_file_path) {
|
||||
free(_mmap_file_path);
|
||||
_mmap_file_path = NULL;
|
||||
}
|
||||
}
|
||||
return back;
|
||||
}
|
||||
|
||||
/*
|
||||
* 对mmap添加header和确定总长度位置
|
||||
*/
|
||||
void add_mmap_header_clogan(char *content, cLogan_model *model) {
|
||||
size_t content_len = strlen(content) + 1;
|
||||
size_t total_len = content_len;
|
||||
char *temp = (char *) model->buffer_point;
|
||||
*temp = LOGAN_MMAP_HEADER_PROTOCOL;
|
||||
temp++;
|
||||
*temp = total_len;
|
||||
temp++;
|
||||
*temp = total_len >> 8;
|
||||
printf_clogan("\n add_mmap_header_clogan len %d\n", total_len);
|
||||
temp++;
|
||||
memcpy(temp, content, content_len);
|
||||
temp += content_len;
|
||||
*temp = LOGAN_MMAP_TAIL_PROTOCOL;
|
||||
temp++;
|
||||
model->total_point = (unsigned char *) temp; // 总数据的total_length的指针位置
|
||||
model->total_len = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确立最后的长度指针位置和最后的写入指针位置
|
||||
*/
|
||||
void restore_last_position_clogan(cLogan_model *model) {
|
||||
unsigned char *temp = model->last_point;
|
||||
*temp = LOGAN_WRITE_PROTOCOL_HEADER;
|
||||
model->total_len++;
|
||||
temp++;
|
||||
model->content_lent_point = temp; // 内容的指针地址
|
||||
*temp = model->content_len >> 24;
|
||||
model->total_len++;
|
||||
temp++;
|
||||
*temp = model->content_len >> 16;
|
||||
model->total_len++;
|
||||
temp++;
|
||||
*temp = model->content_len >> 8;
|
||||
model->total_len++;
|
||||
temp++;
|
||||
*temp = model->content_len;
|
||||
model->total_len++;
|
||||
temp++;
|
||||
model->last_point = temp;
|
||||
|
||||
printf_clogan("restore_last_position_clogan > content_len : %d\n", model->content_len);
|
||||
}
|
||||
|
||||
int clogan_open(const char *pathname) {
|
||||
int back = CLOGAN_OPEN_FAIL_NOINIT;
|
||||
if (!is_init_ok) {
|
||||
back = CLOGAN_OPEN_FAIL_NOINIT;
|
||||
return back;
|
||||
}
|
||||
|
||||
is_open_ok = 0;
|
||||
if (NULL == pathname || 0 == strnlen(pathname, 128) || NULL == _logan_buffer ||
|
||||
NULL == _dir_path ||
|
||||
0 == strnlen(_dir_path, 128)) {
|
||||
back = CLOGAN_OPEN_FAIL_HEADER;
|
||||
return back;
|
||||
}
|
||||
|
||||
if (NULL != logan_model) { //回写到日志中
|
||||
if (logan_model->total_len > LOGAN_WRITEPROTOCOL_HEAER_LENGTH) {
|
||||
clogan_flush();
|
||||
}
|
||||
if (logan_model->file_stream_type == LOGAN_FILE_OPEN) {
|
||||
fclose(logan_model->file);
|
||||
logan_model->file_stream_type = LOGAN_FILE_CLOSE;
|
||||
}
|
||||
if (NULL != logan_model->file_path) {
|
||||
free(logan_model->file_path);
|
||||
logan_model->file_path = NULL;
|
||||
}
|
||||
logan_model->total_len = 0;
|
||||
} else {
|
||||
logan_model = malloc(sizeof(cLogan_model));
|
||||
if (NULL != logan_model) {
|
||||
memset(logan_model, 0, sizeof(cLogan_model));
|
||||
} else {
|
||||
logan_model = NULL; //初始化Logan_model失败,直接退出
|
||||
is_open_ok = 0;
|
||||
back = CLOGAN_OPEN_FAIL_MALLOC;
|
||||
return back;
|
||||
}
|
||||
}
|
||||
char *temp = NULL;
|
||||
|
||||
size_t file_path_len = strlen(_dir_path) + strlen(pathname) + 1;
|
||||
char *temp_file = malloc(file_path_len); // 日志文件路径
|
||||
if (NULL != temp_file) {
|
||||
memset(temp_file, 0, file_path_len);
|
||||
temp = temp_file;
|
||||
memcpy(temp, _dir_path, strlen(_dir_path));
|
||||
temp += strlen(_dir_path);
|
||||
memcpy(temp, pathname, strlen(pathname)); //创建文件路径
|
||||
logan_model->file_path = temp_file;
|
||||
|
||||
if (!init_file_clogan(logan_model)) { //初始化文件IO和文件大小
|
||||
is_open_ok = 0;
|
||||
back = CLOGAN_OPEN_FAIL_IO;
|
||||
return back;
|
||||
}
|
||||
|
||||
if (init_zlib_clogan(logan_model) != Z_OK) { //初始化zlib压缩
|
||||
is_open_ok = 0;
|
||||
back = CLOGAN_OPEN_FAIL_ZLIB;
|
||||
return back;
|
||||
}
|
||||
|
||||
logan_model->buffer_point = _logan_buffer;
|
||||
|
||||
if (buffer_type == LOGAN_MMAP_MMAP) { //如果是MMAP,缓存文件目录和文件名称
|
||||
cJSON *root = NULL;
|
||||
Json_map_logan *map = NULL;
|
||||
root = cJSON_CreateObject();
|
||||
map = create_json_map_logan();
|
||||
char *back_data = NULL;
|
||||
if (NULL != root) {
|
||||
if (NULL != map) {
|
||||
add_item_number_clogan(map, LOGAN_VERSION_KEY, CLOGAN_VERSION_NUMBER);
|
||||
add_item_string_clogan(map, LOGAN_PATH_KEY, pathname);
|
||||
inflate_json_by_map_clogan(root, map);
|
||||
back_data = cJSON_PrintUnformatted(root);
|
||||
}
|
||||
cJSON_Delete(root);
|
||||
if (NULL != back_data) {
|
||||
add_mmap_header_clogan(back_data, logan_model);
|
||||
free(back_data);
|
||||
} else {
|
||||
logan_model->total_point = _logan_buffer;
|
||||
logan_model->total_len = 0;
|
||||
}
|
||||
} else {
|
||||
logan_model->total_point = _logan_buffer;
|
||||
logan_model->total_len = 0;
|
||||
}
|
||||
|
||||
logan_model->last_point = logan_model->total_point + LOGAN_MMAP_TOTALLEN;
|
||||
|
||||
if (NULL != map) {
|
||||
delete_json_map_clogan(map);
|
||||
}
|
||||
} else {
|
||||
logan_model->total_point = _logan_buffer;
|
||||
logan_model->total_len = 0;
|
||||
logan_model->last_point = logan_model->total_point + LOGAN_MMAP_TOTALLEN;
|
||||
}
|
||||
restore_last_position_clogan(logan_model);
|
||||
init_encrypt_key_clogan(logan_model);
|
||||
logan_model->is_ok = 1;
|
||||
is_open_ok = 1;
|
||||
} else {
|
||||
is_open_ok = 0;
|
||||
back = CLOGAN_OPEN_FAIL_MALLOC;
|
||||
printf_clogan("clogan_open > malloc memory fail\n");
|
||||
}
|
||||
|
||||
if (is_open_ok) {
|
||||
back = CLOGAN_OPEN_SUCCESS;
|
||||
printf_clogan("clogan_open > logan open success\n");
|
||||
} else {
|
||||
printf_clogan("clogan_open > logan open fail\n");
|
||||
}
|
||||
return back;
|
||||
}
|
||||
|
||||
|
||||
//更新总数据和最后的count的数据到内存中
|
||||
void update_length_clogan(cLogan_model *model) {
|
||||
unsigned char *temp = NULL;
|
||||
if (NULL != model->total_point) {
|
||||
temp = model->total_point;
|
||||
*temp = model->total_len;
|
||||
temp++;
|
||||
*temp = model->total_len >> 8;
|
||||
temp++;
|
||||
*temp = model->total_len >> 16;
|
||||
}
|
||||
|
||||
if (NULL != model->content_lent_point) {
|
||||
temp = model->content_lent_point;
|
||||
// 为了兼容java,采用高字节序
|
||||
*temp = model->content_len >> 24;
|
||||
temp++;
|
||||
*temp = model->content_len >> 16;
|
||||
temp++;
|
||||
*temp = model->content_len >> 8;
|
||||
temp++;
|
||||
*temp = model->content_len;
|
||||
}
|
||||
}
|
||||
|
||||
//对clogan_model数据做还原
|
||||
void clear_clogan(cLogan_model *logan_model) {
|
||||
logan_model->total_len = 0;
|
||||
|
||||
if (logan_model->zlib_type == LOGAN_ZLIB_END) { //因为只有ZLIB_END才会释放掉内存,才能再次初始化
|
||||
memset(logan_model->strm, 0, sizeof(z_stream));
|
||||
logan_model->zlib_type = LOGAN_ZLIB_NONE;
|
||||
init_zlib_clogan(logan_model);
|
||||
}
|
||||
logan_model->remain_data_len = 0;
|
||||
logan_model->content_len = 0;
|
||||
logan_model->last_point = logan_model->total_point + LOGAN_MMAP_TOTALLEN;
|
||||
restore_last_position_clogan(logan_model);
|
||||
init_encrypt_key_clogan(logan_model);
|
||||
logan_model->total_len = 0;
|
||||
update_length_clogan(logan_model);
|
||||
logan_model->total_len = LOGAN_WRITEPROTOCOL_HEAER_LENGTH;
|
||||
}
|
||||
|
||||
//对空的文件插入一行头文件做标示
|
||||
void insert_header_file_clogan(cLogan_model *loganModel) {
|
||||
char *log = "clogan header";
|
||||
int flag = 1;
|
||||
long long local_time = get_system_current_clogan();
|
||||
char *thread_name = "clogan";
|
||||
long long thread_id = 1;
|
||||
int ismain = 1;
|
||||
Construct_Data_cLogan *data = construct_json_data_clogan(log, flag, local_time, thread_name,
|
||||
thread_id, ismain);
|
||||
if (NULL == data) {
|
||||
return;
|
||||
}
|
||||
cLogan_model temp_model; //临时的clogan_model
|
||||
int status_header = 1;
|
||||
memset(&temp_model, 0, sizeof(cLogan_model));
|
||||
if (Z_OK != init_zlib_clogan(&temp_model)) {
|
||||
status_header = 0;
|
||||
}
|
||||
|
||||
if (status_header) {
|
||||
init_encrypt_key_clogan(&temp_model);
|
||||
int length = data->data_len * 10;
|
||||
unsigned char temp_memory[length];
|
||||
memset(temp_memory, 0, length);
|
||||
temp_model.total_len = 0;
|
||||
temp_model.last_point = temp_memory;
|
||||
restore_last_position_clogan(&temp_model);
|
||||
clogan_zlib_compress(&temp_model, data->data, data->data_len);
|
||||
clogan_zlib_end_compress(&temp_model);
|
||||
update_length_clogan(&temp_model);
|
||||
|
||||
fwrite(temp_memory, sizeof(char), temp_model.total_len, loganModel->file);//写入到文件中
|
||||
fflush(logan_model->file);
|
||||
loganModel->file_len += temp_model.total_len; //修改文件大小
|
||||
}
|
||||
|
||||
if (temp_model.is_malloc_zlib) {
|
||||
free(temp_model.strm);
|
||||
temp_model.is_malloc_zlib = 0;
|
||||
}
|
||||
construct_data_delete_clogan(data);
|
||||
}
|
||||
|
||||
//文件写入磁盘、更新文件大小
|
||||
void write_dest_clogan(void *point, size_t size, size_t length, cLogan_model *loganModel) {
|
||||
if (!is_file_exist_clogan(loganModel->file_path)) { //如果文件被删除,再创建一个文件
|
||||
if (logan_model->file_stream_type == LOGAN_FILE_OPEN) {
|
||||
fclose(logan_model->file);
|
||||
logan_model->file_stream_type = LOGAN_FILE_CLOSE;
|
||||
}
|
||||
if (NULL != _dir_path) {
|
||||
if (!is_file_exist_clogan(_dir_path)) {
|
||||
makedir_clogan(_dir_path);
|
||||
}
|
||||
init_file_clogan(logan_model);
|
||||
printf_clogan("clogan_write > create log file , restore open file stream \n");
|
||||
}
|
||||
}
|
||||
if (CLOGAN_EMPTY_FILE == loganModel->file_len) { //如果是空文件插入一行CLogan的头文件
|
||||
insert_header_file_clogan(loganModel);
|
||||
}
|
||||
fwrite(point, sizeof(char), logan_model->total_len, logan_model->file);//写入到文件中
|
||||
fflush(logan_model->file);
|
||||
loganModel->file_len += loganModel->total_len; //修改文件大小
|
||||
}
|
||||
|
||||
void write_flush_clogan() {
|
||||
if (logan_model->zlib_type == LOGAN_ZLIB_ING) {
|
||||
clogan_zlib_end_compress(logan_model);
|
||||
update_length_clogan(logan_model);
|
||||
}
|
||||
if (logan_model->total_len > LOGAN_WRITEPROTOCOL_HEAER_LENGTH) {
|
||||
unsigned char *point = logan_model->total_point;
|
||||
point += LOGAN_MMAP_TOTALLEN;
|
||||
write_dest_clogan(point, sizeof(char), logan_model->total_len, logan_model);
|
||||
printf_clogan("write_flush_clogan > logan total len : %d \n", logan_model->total_len);
|
||||
clear_clogan(logan_model);
|
||||
}
|
||||
}
|
||||
|
||||
void clogan_write2(char *data, int length) {
|
||||
if (NULL != logan_model && logan_model->is_ok) {
|
||||
clogan_zlib_compress(logan_model, data, length);
|
||||
update_length_clogan(logan_model); //有数据操作,要更新数据长度到缓存中
|
||||
int is_gzip_end = 0;
|
||||
|
||||
if (!logan_model->file_len ||
|
||||
logan_model->content_len >= LOGAN_MAX_GZIP_UTIL) { //是否一个压缩单元结束
|
||||
clogan_zlib_end_compress(logan_model);
|
||||
is_gzip_end = 1;
|
||||
update_length_clogan(logan_model);
|
||||
}
|
||||
|
||||
int isWrite = 0;
|
||||
if (!logan_model->file_len && is_gzip_end) { //如果是个空文件、第一条日志写入
|
||||
isWrite = 1;
|
||||
printf_clogan("clogan_write2 > write type empty file \n");
|
||||
} else if (buffer_type == LOGAN_MMAP_MEMORY && is_gzip_end) { //直接写入文件
|
||||
isWrite = 1;
|
||||
printf_clogan("clogan_write2 > write type memory \n");
|
||||
} else if (buffer_type == LOGAN_MMAP_MMAP &&
|
||||
logan_model->total_len >=
|
||||
buffer_length / LOGAN_WRITEPROTOCOL_DEVIDE_VALUE) { //如果是MMAP 且 文件长度已经超过三分之一
|
||||
isWrite = 1;
|
||||
printf_clogan("clogan_write2 > write type MMAP \n");
|
||||
}
|
||||
if (isWrite) { //写入
|
||||
write_flush_clogan();
|
||||
} else if (is_gzip_end) { //如果是mmap类型,不回写IO,初始化下一步
|
||||
logan_model->content_len = 0;
|
||||
logan_model->remain_data_len = 0;
|
||||
init_zlib_clogan(logan_model);
|
||||
restore_last_position_clogan(logan_model);
|
||||
init_encrypt_key_clogan(logan_model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//如果数据流非常大,切割数据,分片写入
|
||||
void clogan_write_section(char *data, int length) {
|
||||
int size = LOGAN_WRITE_SECTION;
|
||||
int times = length / size;
|
||||
int remain_len = length % size;
|
||||
char *temp = data;
|
||||
int i = 0;
|
||||
for (i = 0; i < times; i++) {
|
||||
clogan_write2(temp, size);
|
||||
temp += size;
|
||||
}
|
||||
if (remain_len) {
|
||||
clogan_write2(temp, remain_len);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief 写入数据 按照顺序和类型传值(强调、强调、强调)
|
||||
@param flag 日志类型 (int)
|
||||
@param log 日志内容 (char*)
|
||||
@param local_time 日志发生的本地时间,形如1502100065601 (long long)
|
||||
@param thread_name 线程名称 (char*)
|
||||
@param thread_id 线程id (long long) 为了兼容JAVA
|
||||
@param ismain 是否为主线程,0为是主线程,1位非主线程 (int)
|
||||
*/
|
||||
int
|
||||
clogan_write(int flag, char *log, long long local_time, char *thread_name, long long thread_id,
|
||||
int is_main) {
|
||||
int back = CLOGAN_WRITE_FAIL_HEADER;
|
||||
if (!is_init_ok || NULL == logan_model || !is_open_ok) {
|
||||
back = CLOGAN_WRITE_FAIL_HEADER;
|
||||
return back;
|
||||
}
|
||||
|
||||
if (is_file_exist_clogan(logan_model->file_path)) {
|
||||
if (logan_model->file_len > max_file_len) {
|
||||
printf_clogan("clogan_write > beyond max file , cant write log\n");
|
||||
back = CLOAGN_WRITE_FAIL_MAXFILE;
|
||||
return back;
|
||||
}
|
||||
} else {
|
||||
if (logan_model->file_stream_type == LOGAN_FILE_OPEN) {
|
||||
fclose(logan_model->file);
|
||||
logan_model->file_stream_type = LOGAN_FILE_CLOSE;
|
||||
}
|
||||
if (NULL != _dir_path) {
|
||||
if (!is_file_exist_clogan(_dir_path)) {
|
||||
makedir_clogan(_dir_path);
|
||||
}
|
||||
init_file_clogan(logan_model);
|
||||
printf_clogan("clogan_write > create log file , restore open file stream \n");
|
||||
}
|
||||
}
|
||||
|
||||
//判断MMAP文件是否存在,如果被删除,用内存缓存
|
||||
if (buffer_type == LOGAN_MMAP_MMAP && !is_file_exist_clogan(_mmap_file_path)) {
|
||||
if (NULL != _cache_buffer_buffer) {
|
||||
buffer_type = LOGAN_MMAP_MEMORY;
|
||||
buffer_length = LOGAN_MEMORY_LENGTH;
|
||||
|
||||
printf_clogan("clogan_write > change to memory buffer");
|
||||
|
||||
_logan_buffer = _cache_buffer_buffer;
|
||||
logan_model->total_point = _logan_buffer;
|
||||
logan_model->total_len = 0;
|
||||
logan_model->content_len = 0;
|
||||
logan_model->remain_data_len = 0;
|
||||
|
||||
if (logan_model->zlib_type == LOGAN_ZLIB_INIT) {
|
||||
clogan_zlib_delete_stream(logan_model); //关闭已开的流
|
||||
}
|
||||
|
||||
logan_model->last_point = logan_model->total_point + LOGAN_MMAP_TOTALLEN;
|
||||
restore_last_position_clogan(logan_model);
|
||||
init_zlib_clogan(logan_model);
|
||||
init_encrypt_key_clogan(logan_model);
|
||||
logan_model->is_ok = 1;
|
||||
} else {
|
||||
buffer_type = LOGAN_MMAP_FAIL;
|
||||
is_init_ok = 0;
|
||||
is_open_ok = 0;
|
||||
_logan_buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Construct_Data_cLogan *data = construct_json_data_clogan(log, flag, local_time, thread_name,
|
||||
thread_id, is_main);
|
||||
if (NULL != data) {
|
||||
clogan_write_section(data->data, data->data_len);
|
||||
construct_data_delete_clogan(data);
|
||||
back = CLOGAN_WRITE_SUCCESS;
|
||||
} else {
|
||||
back = CLOGAN_WRITE_FAIL_MALLOC;
|
||||
}
|
||||
return back;
|
||||
}
|
||||
|
||||
int clogan_flush(void) {
|
||||
int back = CLOGAN_FLUSH_FAIL_INIT;
|
||||
if (!is_init_ok || NULL == logan_model) {
|
||||
return back;
|
||||
}
|
||||
write_flush_clogan();
|
||||
back = CLOGAN_FLUSH_SUCCESS;
|
||||
printf_clogan(" clogan_flush > write flush\n");
|
||||
return back;
|
||||
}
|
||||
|
||||
void clogan_debug(int debug) {
|
||||
set_debug_clogan(debug);
|
||||
}
|
||||
92
Logan/Clogan/clogan_core.h
Normal file
92
Logan/Clogan/clogan_core.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_LOGAN_CORE_H
|
||||
#define CLOGAN_LOGAN_CORE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <zlib.h>
|
||||
#include <stdlib.h>
|
||||
#include "logan_config.h"
|
||||
|
||||
/**
|
||||
* 开放接口
|
||||
* 前4个接口在Thread中调用(强调)
|
||||
* 1.clogan_init(char * pathdirs , int max_file ,unsigned char encryp_key[16]) 初始化文件目录、最大文件大小和秘钥
|
||||
* 2.clogan_open(char * pathname);打开一个文件
|
||||
* 3.clogan_write(....)写数据
|
||||
* 4.clogan_flush();缓存数据写入文件
|
||||
* 5.clogan_setdebug() 是否为debug环境 1为开启 0 为关闭
|
||||
* 注意事项:
|
||||
* iOS8以后,模拟器的程序安装路径每次xcode运行安装时都会发生变化。所以在模拟器上进行调试会无法进行mmap回写
|
||||
*/
|
||||
|
||||
/**
|
||||
@brief 初始化文件目录和最大文件大小
|
||||
@param cache_dirs 指定缓存mmap的目录文件
|
||||
@param path_dirs 指定日志文件夹目录
|
||||
@param max_file 指定最大文件大小
|
||||
@param encrypt_key16 指定16位的文件加密key
|
||||
@param encrypt_iv16 16位的文件加密iv
|
||||
*/
|
||||
int
|
||||
clogan_init(const char *cache_dirs, const char *path_dirs, int max_file, const char *encrypt_key16,
|
||||
const char *encrypt_iv16);
|
||||
|
||||
/**
|
||||
@brief 打开一个文件的写入
|
||||
@param pathname 文件名称
|
||||
*/
|
||||
int clogan_open(const char *pathname); //打开一个文件的写入
|
||||
|
||||
/**
|
||||
@brief 写入数据 按照顺序和类型传值(强调、强调、强调)
|
||||
@param flag 日志类型 (int)
|
||||
log 日志内容 (char*)
|
||||
local_time 日志发生的本地时间,形如1502100065601 (long long)
|
||||
thread_name 线程名称 (char*)
|
||||
thread_id 线程id (long long) 为了兼容JAVA
|
||||
is_main 是否为主线程,0为是主线程,1位非主线程 (int)
|
||||
*/
|
||||
int
|
||||
clogan_write(int flag, char *log, long long local_time, char *thread_name, long long thread_id,
|
||||
int is_main);
|
||||
|
||||
/**
|
||||
@brief 强制写入文件。建议在崩溃或者退出程序的时候调用
|
||||
*/
|
||||
int clogan_flush(void);
|
||||
|
||||
/**
|
||||
@brief 是否为debug环境。debug环境将输出过程日志到控制台中
|
||||
@param debug 1为开启 0为关闭 默认为0
|
||||
*/
|
||||
void clogan_debug(int debug);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif //CLOGAN_LOGAN_CORE_H
|
||||
56
Logan/Clogan/clogan_status.h
Normal file
56
Logan/Clogan/clogan_status.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_DEMO_CLOGAN_STATUS_H
|
||||
#define CLOGAN_DEMO_CLOGAN_STATUS_H
|
||||
|
||||
#define CLGOAN_INIT_STATUS "clogan_init" //初始化函数
|
||||
#define CLOGAN_INIT_SUCCESS_MMAP -1010 //初始化成功, mmap内存
|
||||
#define CLOGAN_INIT_SUCCESS_MEMORY -1020 //初始化成功, 堆内存
|
||||
#define CLOGAN_INIT_FAIL_NOCACHE -1030 //初始化失败 , 没有缓存
|
||||
#define CLOGAN_INIT_FAIL_NOMALLOC -1040 //初始化失败 , 没有堆内存
|
||||
#define CLOGAN_INIT_FAIL_HEADER -1050 //初始化失败 , 初始化头失败
|
||||
#define CLOGAN_INIT_INITPUBLICKEY_ERROR -1061//初始化失败,初始化公钥失败
|
||||
#define CLOGAN_INIT_INITBLICKENCRYPT_ERROR -1062//初始化失败,公钥加密失败
|
||||
#define CLOGAN_INIT_INITBASE64_ERROR -1063 //初始化失败,base64失败
|
||||
#define CLOGAN_INIT_INITMALLOC_ERROR -1064 //初始化失败 malloc分配失败
|
||||
|
||||
#define CLOGAN_OPEN_STATUS "clogan_open" //打开文件函数
|
||||
#define CLOGAN_OPEN_SUCCESS -2010 //打开文件成功
|
||||
#define CLOGAN_OPEN_FAIL_IO -2020 //打开文件IO失败
|
||||
#define CLOGAN_OPEN_FAIL_ZLIB -2030 //打开文件zlib失败
|
||||
#define CLOGAN_OPEN_FAIL_MALLOC -2040 //打开文件malloc失败
|
||||
#define CLOGAN_OPEN_FAIL_NOINIT -2050 //打开文件没有初始化失败
|
||||
#define CLOGAN_OPEN_FAIL_HEADER -2060 //打开文件头失败
|
||||
|
||||
#define CLOGAN_WRITE_STATUS "clogan_write" //写入函数
|
||||
#define CLOGAN_WRITE_SUCCESS -4010 //写入日志成功
|
||||
#define CLOGAN_WRITE_FAIL_PARAM -4020 //写入失败, 可变参数错误
|
||||
#define CLOAGN_WRITE_FAIL_MAXFILE -4030 //写入失败,超过文件最大值
|
||||
#define CLOGAN_WRITE_FAIL_MALLOC -4040 //写入失败,malloc失败
|
||||
#define CLOGAN_WRITE_FAIL_HEADER -4050 //写入头失败
|
||||
|
||||
#define CLOGAN_FLUSH_STATUS "clogan_flush" //强制写入函数
|
||||
#define CLOGAN_FLUSH_SUCCESS -5010 //fush日志成功
|
||||
#define CLOGAN_FLUSH_FAIL_INIT -5020 //初始化失败,日志flush不成功
|
||||
|
||||
#endif //CLOGAN_DEMO_CLOGAN_STATUS_H
|
||||
42
Logan/Clogan/console_util.c
Normal file
42
Logan/Clogan/console_util.c
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include "console_util.h"
|
||||
|
||||
static int is_debug_logan = 0;
|
||||
|
||||
int printf_clogan(char *fmt, ...) {
|
||||
int cnt = 0;
|
||||
if (is_debug_logan) {
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
cnt = vprintf(fmt, argptr);
|
||||
va_end(argptr);
|
||||
}
|
||||
return (cnt);
|
||||
}
|
||||
|
||||
void set_debug_clogan(int debug) {
|
||||
is_debug_logan = debug;
|
||||
}
|
||||
31
Logan/Clogan/console_util.h
Normal file
31
Logan/Clogan/console_util.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_DEMO_CONSOLE_H_H
|
||||
#define CLOGAN_DEMO_CONSOLE_H_H
|
||||
|
||||
|
||||
int printf_clogan(char *content, ...);
|
||||
|
||||
void set_debug_clogan(int debug);
|
||||
|
||||
#endif //CLOGAN_DEMO_CONSOLE_H_H
|
||||
95
Logan/Clogan/construct_data.c
Normal file
95
Logan/Clogan/construct_data.c
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "construct_data.h"
|
||||
#include "cJSON.h"
|
||||
#include "stdlib.h"
|
||||
#include "json_util.h"
|
||||
#include "console_util.h"
|
||||
|
||||
static const char *log_key = "c";
|
||||
static const char *flag_key = "f";
|
||||
static const char *localtime_key = "l";
|
||||
static const char *threadname_key = "n";
|
||||
static const char *threadid_key = "i";
|
||||
static const char *ismain_key = "m";
|
||||
|
||||
Construct_Data_cLogan *
|
||||
construct_json_data_clogan(char *log, int flag, long long local_time, char *thread_name,
|
||||
long long thread_id, int is_main) {
|
||||
Construct_Data_cLogan *construct_data = NULL;
|
||||
cJSON *root = NULL;
|
||||
Json_map_logan *map = NULL;
|
||||
root = cJSON_CreateObject();
|
||||
map = create_json_map_logan();
|
||||
if (NULL != root) {
|
||||
if (NULL != map) {
|
||||
add_item_string_clogan(map, log_key, log);
|
||||
add_item_number_clogan(map, flag_key, (double) flag);
|
||||
add_item_number_clogan(map, localtime_key, (double) local_time);
|
||||
add_item_string_clogan(map, threadname_key, thread_name);
|
||||
add_item_number_clogan(map, threadid_key, (double) thread_id);
|
||||
add_item_bool_clogan(map, ismain_key, is_main);
|
||||
inflate_json_by_map_clogan(root, map);
|
||||
char *back_data = cJSON_PrintUnformatted(root);
|
||||
construct_data = (Construct_Data_cLogan *) malloc(sizeof(Construct_Data_cLogan));
|
||||
|
||||
if (NULL != construct_data) {
|
||||
memset(construct_data, 0, sizeof(Construct_Data_cLogan));
|
||||
size_t str_len = strlen(back_data);
|
||||
size_t length = str_len + 2;
|
||||
unsigned char *temp_data = (unsigned char *) malloc(length);
|
||||
if (NULL != temp_data) {
|
||||
unsigned char *temp_point = temp_data;
|
||||
memset(temp_point, 0, length);
|
||||
memcpy(temp_point, back_data, str_len);
|
||||
temp_point += str_len;
|
||||
char return_data[] = {'\n'};
|
||||
memcpy(temp_point, return_data, 1); //添加\n字符
|
||||
construct_data->data = (char *) temp_data; //赋值
|
||||
construct_data->data_len = (int) length;
|
||||
} else {
|
||||
free(construct_data); //创建数据
|
||||
construct_data = NULL;
|
||||
printf_clogan(
|
||||
"construct_json_data_clogan > malloc memory fail for temp_data\n");
|
||||
}
|
||||
}
|
||||
free(back_data);
|
||||
}
|
||||
cJSON_Delete(root);
|
||||
}
|
||||
if (NULL != map) {
|
||||
delete_json_map_clogan(map);
|
||||
}
|
||||
return construct_data;
|
||||
}
|
||||
|
||||
void construct_data_delete_clogan(Construct_Data_cLogan *item) {
|
||||
if (NULL != item) {
|
||||
if (NULL != item->data) {
|
||||
free(item->data);
|
||||
}
|
||||
free(item);
|
||||
}
|
||||
}
|
||||
37
Logan/Clogan/construct_data.h
Normal file
37
Logan/Clogan/construct_data.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_BUILD_DATA_H
|
||||
#define CLOGAN_BUILD_DATA_H
|
||||
|
||||
typedef struct {
|
||||
char *data;
|
||||
int data_len;
|
||||
} Construct_Data_cLogan;
|
||||
|
||||
Construct_Data_cLogan *
|
||||
construct_json_data_clogan(char *log, int flag, long long local_time, char *thread_name,
|
||||
long long thread_id, int is_main);
|
||||
|
||||
void construct_data_delete_clogan(Construct_Data_cLogan *data);
|
||||
|
||||
#endif //CLOGAN_BUILD_DATA_H
|
||||
86
Logan/Clogan/directory_util.c
Normal file
86
Logan/Clogan/directory_util.c
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "logan_config.h"
|
||||
#include "console_util.h"
|
||||
|
||||
#define LOGAN_MAX_PATH 1024
|
||||
|
||||
//判断文件和目录是否存在
|
||||
int is_file_exist_clogan(const char *path) {
|
||||
int isExist = 0;
|
||||
if (NULL != path && strnlen(path, 1) > 0) {
|
||||
if (access(path, F_OK) == 0) {
|
||||
isExist = 1;
|
||||
}
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
|
||||
//根据路径创建目录
|
||||
int makedir_clogan(const char *path) {
|
||||
size_t beginCmpPath = 0;
|
||||
size_t endCmpPath = 0;
|
||||
size_t pathLen = strlen(path);
|
||||
char currentPath[LOGAN_MAX_PATH] = {0};
|
||||
|
||||
printf_clogan("makedir_clogan > path : %s\n", path);
|
||||
//相对路径
|
||||
if ('/' != path[0]) {
|
||||
//获取当前路径
|
||||
getcwd(currentPath, LOGAN_MAX_PATH);
|
||||
strcat(currentPath, "/");
|
||||
printf_clogan("makedir_clogan > currentPath : %s\n", currentPath);
|
||||
beginCmpPath = strlen(currentPath);
|
||||
strcat(currentPath, path);
|
||||
if (path[pathLen - 1] != '/') {
|
||||
strcat(currentPath, "/");
|
||||
}
|
||||
endCmpPath = strlen(currentPath);
|
||||
} else {
|
||||
//绝对路径
|
||||
strcpy(currentPath, path);
|
||||
if (path[pathLen - 1] != '/') {
|
||||
strcat(currentPath, "/");
|
||||
}
|
||||
beginCmpPath = 1;
|
||||
endCmpPath = strlen(currentPath);
|
||||
}
|
||||
|
||||
//创建各级目录
|
||||
for (size_t i = beginCmpPath; i < endCmpPath; i++) {
|
||||
if ('/' == currentPath[i]) {
|
||||
currentPath[i] = '\0';
|
||||
if (access(currentPath, F_OK) != 0) {
|
||||
if (mkdir(currentPath, 0777) == -1) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
currentPath[i] = '/';
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
30
Logan/Clogan/directory_util.h
Normal file
30
Logan/Clogan/directory_util.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_DIRECTORY_UTIL_H
|
||||
#define CLOGAN_DIRECTORY_UTIL_H
|
||||
|
||||
int makedir_clogan(const char *path);
|
||||
|
||||
int is_file_exist_clogan(const char *path);
|
||||
|
||||
#endif //CLOGAN_DIRECTORY_UTIL_H
|
||||
134
Logan/Clogan/json_util.c
Normal file
134
Logan/Clogan/json_util.c
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "json_util.h"
|
||||
|
||||
Json_map_logan *create_json_map_logan(void) {
|
||||
Json_map_logan *item = malloc(sizeof(Json_map_logan));
|
||||
if (NULL != item)
|
||||
memset(item, 0, sizeof(Json_map_logan));
|
||||
return item;
|
||||
}
|
||||
|
||||
int is_empty_json_map_clogan(Json_map_logan *item) {
|
||||
Json_map_logan temp;
|
||||
memset(&temp, 0, sizeof(Json_map_logan));
|
||||
if (memcmp(item, &temp, sizeof(Json_map_logan)) == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void add_item_string_clogan(Json_map_logan *map, const char *key, const char *value) {
|
||||
if (NULL != map && NULL != value && NULL != key && strnlen(key, 128) > 0) {
|
||||
Json_map_logan *item = map;
|
||||
Json_map_logan *temp = item;
|
||||
if (!is_empty_json_map_clogan(item)) {
|
||||
while (NULL != item->nextItem) {
|
||||
item = item->nextItem;
|
||||
}
|
||||
temp = create_json_map_logan();
|
||||
item->nextItem = temp;
|
||||
}
|
||||
if (NULL != temp) {
|
||||
temp->type = CLOGAN_JSON_MAP_STRING;
|
||||
temp->key = (char *) key;
|
||||
temp->valueStr = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void add_item_number_clogan(Json_map_logan *map, const char *key, double number) {
|
||||
if (NULL != map && NULL != key && strnlen(key, 128) > 0) {
|
||||
Json_map_logan *item = map;
|
||||
Json_map_logan *temp = item;
|
||||
if (!is_empty_json_map_clogan(item)) {
|
||||
while (NULL != item->nextItem) {
|
||||
item = item->nextItem;
|
||||
}
|
||||
temp = create_json_map_logan();
|
||||
item->nextItem = temp;
|
||||
}
|
||||
if (NULL != temp) {
|
||||
temp->type = CLOGAN_JSON_MAP_NUMBER;
|
||||
temp->key = (char *) key;
|
||||
temp->valueNumber = number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void add_item_bool_clogan(Json_map_logan *map, const char *key, int boolValue) {
|
||||
if (NULL != map && NULL != key && strnlen(key, 128) > 0) {
|
||||
Json_map_logan *item = map;
|
||||
Json_map_logan *temp = item;
|
||||
if (!is_empty_json_map_clogan(item)) {
|
||||
while (NULL != item->nextItem) {
|
||||
item = item->nextItem;
|
||||
}
|
||||
temp = create_json_map_logan();
|
||||
item->nextItem = temp;
|
||||
}
|
||||
if (NULL != temp) {
|
||||
temp->type = CLOGAN_JSON_MAP_BOOL;
|
||||
temp->key = (char *) key;
|
||||
temp->valueBool = boolValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void delete_json_map_clogan(Json_map_logan *map) {
|
||||
if (NULL != map) {
|
||||
Json_map_logan *item = map;
|
||||
Json_map_logan *temp = NULL;
|
||||
do {
|
||||
temp = item->nextItem;
|
||||
free(item);
|
||||
item = temp;
|
||||
} while (NULL != item);
|
||||
}
|
||||
}
|
||||
|
||||
void inflate_json_by_map_clogan(cJSON *root, Json_map_logan *map) {
|
||||
if (NULL != root && NULL != map) {
|
||||
Json_map_logan *item = map;
|
||||
do {
|
||||
switch (item->type) {
|
||||
case CLOGAN_JSON_MAP_STRING:
|
||||
if (NULL != item->valueStr) {
|
||||
cJSON_AddStringToObject(root, item->key, item->valueStr);
|
||||
}
|
||||
break;
|
||||
case CLOGAN_JSON_MAP_NUMBER:
|
||||
cJSON_AddNumberToObject(root, item->key, item->valueNumber);
|
||||
break;
|
||||
case CLOGAN_JSON_MAP_BOOL:
|
||||
cJSON_AddBoolToObject(root, item->key, item->valueBool);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
item = item->nextItem;
|
||||
} while (NULL != item);
|
||||
}
|
||||
}
|
||||
55
Logan/Clogan/json_util.h
Normal file
55
Logan/Clogan/json_util.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_JSON_UTIL_H
|
||||
#define CLOGAN_JSON_UTIL_H
|
||||
|
||||
#include "cJSON.h"
|
||||
|
||||
#define CLOGAN_JSON_MAP_STRING 1
|
||||
#define CLOGAN_JSON_MAP_NUMBER 2
|
||||
#define CLOGAN_JSON_MAP_BOOL 3
|
||||
|
||||
typedef struct json_map {
|
||||
char *key;
|
||||
const char *valueStr;
|
||||
double valueNumber;
|
||||
int valueBool;
|
||||
int type;
|
||||
struct json_map *nextItem;
|
||||
} Json_map_logan;
|
||||
|
||||
Json_map_logan *create_json_map_logan(void);
|
||||
|
||||
int is_empty_json_map_clogan(Json_map_logan *item);
|
||||
|
||||
void add_item_string_clogan(Json_map_logan *map, const char *key, const char *value);
|
||||
|
||||
void add_item_number_clogan(Json_map_logan *map, const char *key, double number);
|
||||
|
||||
void add_item_bool_clogan(Json_map_logan *map, const char *key, int boolValue);
|
||||
|
||||
void delete_json_map_clogan(Json_map_logan *item);
|
||||
|
||||
void inflate_json_by_map_clogan(cJSON *root, Json_map_logan *map);
|
||||
|
||||
#endif //CLOGAN_JSON_UTIL_H
|
||||
92
Logan/Clogan/logan_config.h
Normal file
92
Logan/Clogan/logan_config.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_LOGAN_CONFIG_H
|
||||
#define CLOGAN_LOGAN_CONFIG_H
|
||||
|
||||
#include <zlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define LOGAN_VERSION_KEY "logan_version"
|
||||
#define LOGAN_PATH_KEY "file"
|
||||
|
||||
#define LOGAN_WRITE_PROTOCOL_HEADER '\1'
|
||||
#define LOGAN_WRITE_PROTOCOL_TAIL '\0'
|
||||
|
||||
#define LOGAN_CACHE_DIR "logan_cache"
|
||||
#define LOGAN_CACHE_FILE "logan.mmap2"
|
||||
|
||||
#define LOGAN_MMAP_HEADER_PROTOCOL '\15' //MMAP的头文件标识符
|
||||
#define LOGAN_MMAP_TAIL_PROTOCOL '\16' //MMAP尾文件标识符
|
||||
#define LOGAN_MMAP_TOTALLEN 3 //MMAP文件长度
|
||||
|
||||
#define LOGAN_MAX_GZIP_UTIL 5 * 1024 //压缩单元的大小
|
||||
|
||||
#define LOGAN_WRITEPROTOCOL_HEAER_LENGTH 5 //Logan写入协议的头和写入数据的总长度
|
||||
|
||||
#define LOGAN_WRITEPROTOCOL_DEVIDE_VALUE 3 //多少分之一写入
|
||||
|
||||
#define LOGAN_DIVIDE_SYMBOL "/"
|
||||
|
||||
#define LOGAN_LOGFILE_MAXLENGTH 10 * 1024 * 1024
|
||||
|
||||
#define LOGAN_WRITE_SECTION 20 * 1024 //多大长度做分片
|
||||
|
||||
#define LOGAN_RETURN_SYMBOL "\n"
|
||||
|
||||
#define LOGAN_FILE_NONE 0
|
||||
#define LOGAN_FILE_OPEN 1
|
||||
#define LOGAN_FILE_CLOSE 2
|
||||
|
||||
#define CLOGAN_EMPTY_FILE 0
|
||||
|
||||
#define CLOGAN_VERSION_NUMBER 3 //Logan的版本号(2)版本
|
||||
|
||||
typedef struct logan_model_struct {
|
||||
int total_len; //数据长度
|
||||
char *file_path; //文件路径
|
||||
|
||||
int is_malloc_zlib;
|
||||
z_stream *strm;
|
||||
int zlib_type; //压缩类型
|
||||
char remain_data[16]; //剩余空间
|
||||
int remain_data_len; //剩余空间长度
|
||||
|
||||
int is_ready_gzip; //是否可以gzip
|
||||
|
||||
int file_stream_type; //文件流类型
|
||||
FILE *file; //文件流
|
||||
|
||||
long file_len; //文件大小
|
||||
|
||||
unsigned char *buffer_point; //缓存的指针 (不变)
|
||||
unsigned char *last_point; //最后写入位置的指针
|
||||
unsigned char *total_point; //总数的指针 (可能变) , 给c看,低字节
|
||||
unsigned char *content_lent_point;//协议内容长度指针 , 给java看,高字节
|
||||
int content_len; //内容的大小
|
||||
|
||||
unsigned char aes_iv[16]; //aes_iv
|
||||
int is_ok;
|
||||
|
||||
} cLogan_model;
|
||||
|
||||
#endif //CLOGAN_LOGAN_CONFIG_H
|
||||
20
Logan/Clogan/main.dSYM/Contents/Info.plist
Normal file
20
Logan/Clogan/main.dSYM/Contents/Info.plist
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.main</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Logan/Clogan/main.dSYM/Contents/Resources/DWARF/main
Normal file
BIN
Logan/Clogan/main.dSYM/Contents/Resources/DWARF/main
Normal file
Binary file not shown.
123
Logan/Clogan/mmap_util.c
Normal file
123
Logan/Clogan/mmap_util.c
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "console_util.h"
|
||||
#include <string.h>
|
||||
#include "mmap_util.h"
|
||||
#include <errno.h>
|
||||
|
||||
//创建MMAP缓存buffer或者内存buffer
|
||||
int open_mmap_file_clogan(char *_filepath, unsigned char **buffer, unsigned char **cache) {
|
||||
int back = LOGAN_MMAP_FAIL;
|
||||
if (NULL == _filepath || 0 == strnlen(_filepath, 128)) {
|
||||
back = LOGAN_MMAP_MEMORY;
|
||||
} else {
|
||||
unsigned char *p_map = NULL;
|
||||
int size = LOGAN_MMAP_LENGTH;
|
||||
int fd = open(_filepath, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); //后两个添加权限
|
||||
int isNeedCheck = 0; //是否需要检查mmap缓存文件重新检查
|
||||
if (fd != -1) { //保护
|
||||
int isFileOk = 0;
|
||||
FILE *file = fopen(_filepath, "rb+"); //先判断文件是否有值,再mmap内存映射
|
||||
if (NULL != file) {
|
||||
fseek(file, 0, SEEK_END);
|
||||
long longBytes = ftell(file);
|
||||
if (longBytes < LOGAN_MMAP_LENGTH) {
|
||||
fseek(file, 0, SEEK_SET);
|
||||
char zero_data[size];
|
||||
memset(zero_data, 0, size);
|
||||
size_t _size = 0;
|
||||
_size = fwrite(zero_data, sizeof(char), size, file);
|
||||
fflush(file);
|
||||
if (_size == size) {
|
||||
printf_clogan("copy data 2 mmap file success\n");
|
||||
isFileOk = 1;
|
||||
isNeedCheck = 1;
|
||||
} else {
|
||||
isFileOk = 0;
|
||||
}
|
||||
} else {
|
||||
isFileOk = 1;
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
isFileOk = 0;
|
||||
}
|
||||
|
||||
if (isNeedCheck) { //加强保护,对映射的文件要有一个适合长度的文件
|
||||
FILE *file = fopen(_filepath, "rb");
|
||||
if (file != NULL) {
|
||||
fseek(file, 0, SEEK_END);
|
||||
long longBytes = ftell(file);
|
||||
if (longBytes >= LOGAN_MMAP_LENGTH) {
|
||||
isFileOk = 1;
|
||||
} else {
|
||||
isFileOk = 0;
|
||||
}
|
||||
fclose(file);
|
||||
} else {
|
||||
isFileOk = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFileOk) {
|
||||
p_map = (unsigned char *) mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
}
|
||||
if (p_map != MAP_FAILED && NULL != p_map && isFileOk) {
|
||||
back = LOGAN_MMAP_MMAP;
|
||||
} else {
|
||||
back = LOGAN_MMAP_MEMORY;
|
||||
printf_clogan("open mmap fail , reason : %s \n", strerror(errno));
|
||||
|
||||
}
|
||||
close(fd);
|
||||
|
||||
if (back == LOGAN_MMAP_MMAP &&
|
||||
access(_filepath, F_OK) != -1) { //在返回mmap前,做最后一道判断,如果有mmap文件才用mmap
|
||||
back = LOGAN_MMAP_MMAP;
|
||||
*buffer = p_map;
|
||||
} else {
|
||||
back = LOGAN_MMAP_MEMORY;
|
||||
if (NULL != p_map)
|
||||
munmap(p_map, size);
|
||||
}
|
||||
} else {
|
||||
printf_clogan("open(%s) fail: %s\n", _filepath, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
int size = LOGAN_MEMORY_LENGTH;
|
||||
unsigned char *tempData = malloc(size);
|
||||
if (NULL != tempData) {
|
||||
memset(tempData, 0, size);
|
||||
*cache = tempData;
|
||||
if (back != LOGAN_MMAP_MMAP) {
|
||||
*buffer = tempData;
|
||||
back = LOGAN_MMAP_MEMORY; //如果文件打开失败、如果mmap映射失败,走内存缓存
|
||||
}
|
||||
} else {
|
||||
if (back != LOGAN_MMAP_MMAP)
|
||||
back = LOGAN_MMAP_FAIL;
|
||||
}
|
||||
return back;
|
||||
}
|
||||
54
Logan/Clogan/mmap_util.h
Normal file
54
Logan/Clogan/mmap_util.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef LOGAN_MMAP_MMAP
|
||||
#define LOGAN_MMAP_MMAP 1
|
||||
#endif
|
||||
|
||||
#ifndef LOGAN_MMAP_MEMORY
|
||||
#define LOGAN_MMAP_MEMORY 0
|
||||
#endif
|
||||
|
||||
#ifndef LOGAN_MMAP_FAIL
|
||||
#define LOGAN_MMAP_FAIL -1
|
||||
#endif
|
||||
|
||||
#ifndef LOGAN_MMAP_LENGTH
|
||||
#define LOGAN_MMAP_LENGTH 150 * 1024 //150k
|
||||
#endif
|
||||
|
||||
#ifndef LOGAN_MEMORY_LENGTH
|
||||
#define LOGAN_MEMORY_LENGTH 150 * 1024 //150k
|
||||
#endif
|
||||
|
||||
#ifndef CLOGAN_MMAP_UTIL_H
|
||||
#define CLOGAN_MMAP_UTIL_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include<sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
int open_mmap_file_clogan(char *_filepath, unsigned char **buffer, unsigned char **cache);
|
||||
|
||||
#endif //CLOGAN_MMAP_UTIL_H
|
||||
190
Logan/Clogan/zlib_util.c
Normal file
190
Logan/Clogan/zlib_util.c
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "zlib_util.h"
|
||||
#include "aes_util.h"
|
||||
|
||||
int init_zlib_clogan(cLogan_model *model) {
|
||||
int ret = 1;
|
||||
if (model->zlib_type == LOGAN_ZLIB_INIT) { //如果是init的状态则不需要init
|
||||
return Z_OK;
|
||||
}
|
||||
z_stream *temp_zlib = NULL;
|
||||
if (!model->is_malloc_zlib) {
|
||||
temp_zlib = malloc(sizeof(z_stream));
|
||||
} else {
|
||||
temp_zlib = model->strm;
|
||||
}
|
||||
|
||||
if (NULL != temp_zlib) {
|
||||
model->is_malloc_zlib = 1; //表示已经 malloc 一个zlib
|
||||
memset(temp_zlib, 0, sizeof(z_stream));
|
||||
model->strm = temp_zlib;
|
||||
temp_zlib->zalloc = Z_NULL;
|
||||
temp_zlib->zfree = Z_NULL;
|
||||
temp_zlib->opaque = Z_NULL;
|
||||
ret = deflateInit2(temp_zlib, Z_BEST_COMPRESSION, Z_DEFLATED, (15 + 16), 8,
|
||||
Z_DEFAULT_STRATEGY);
|
||||
if (ret == Z_OK) {
|
||||
model->is_ready_gzip = 1;
|
||||
model->zlib_type = LOGAN_ZLIB_INIT;
|
||||
} else {
|
||||
model->is_ready_gzip = 0;
|
||||
model->zlib_type = LOGAN_ZLIB_FAIL;
|
||||
}
|
||||
} else {
|
||||
model->is_malloc_zlib = 0;
|
||||
model->is_ready_gzip = 0;
|
||||
model->zlib_type = LOGAN_ZLIB_FAIL;
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void clogan_zlib(cLogan_model *model, char *data, int data_len, int type) {
|
||||
int is_gzip = model->is_ready_gzip;
|
||||
int ret;
|
||||
if (is_gzip) {
|
||||
unsigned int have;
|
||||
unsigned char out[LOGAN_CHUNK];
|
||||
z_stream *strm = model->strm;
|
||||
|
||||
strm->avail_in = (uInt) data_len;
|
||||
strm->next_in = (unsigned char *) data;
|
||||
do {
|
||||
strm->avail_out = LOGAN_CHUNK;
|
||||
strm->next_out = (unsigned char *) out;
|
||||
ret = deflate(strm, type);
|
||||
if (Z_STREAM_ERROR == ret) {
|
||||
deflateEnd(model->strm);
|
||||
|
||||
model->is_ready_gzip = 0;
|
||||
model->zlib_type = LOGAN_ZLIB_END;
|
||||
} else {
|
||||
have = LOGAN_CHUNK - strm->avail_out;
|
||||
int total_len = model->remain_data_len + have;
|
||||
unsigned char *temp = NULL;
|
||||
int handler_len = (total_len / 16) * 16;
|
||||
int remain_len = total_len % 16;
|
||||
if (handler_len) {
|
||||
int copy_data_len = handler_len - model->remain_data_len;
|
||||
char gzip_data[handler_len];
|
||||
temp = (unsigned char *) gzip_data;
|
||||
if (model->remain_data_len) {
|
||||
memcpy(temp, model->remain_data, model->remain_data_len);
|
||||
temp += model->remain_data_len;
|
||||
}
|
||||
memcpy(temp, out, copy_data_len); //填充剩余数据和压缩数据
|
||||
aes_encrypt_clogan((unsigned char *) gzip_data, model->last_point, handler_len,
|
||||
(unsigned char *) model->aes_iv); //把加密数据写入缓存
|
||||
model->total_len += handler_len;
|
||||
model->content_len += handler_len;
|
||||
model->last_point += handler_len;
|
||||
}
|
||||
if (remain_len) {
|
||||
if (handler_len) {
|
||||
int copy_data_len = handler_len - model->remain_data_len;
|
||||
temp = (unsigned char *) out;
|
||||
temp += copy_data_len;
|
||||
memcpy(model->remain_data, temp, remain_len); //填充剩余数据和压缩数据
|
||||
} else {
|
||||
temp = (unsigned char *) model->remain_data;
|
||||
temp += model->remain_data_len;
|
||||
memcpy(temp, out, have);
|
||||
}
|
||||
}
|
||||
model->remain_data_len = remain_len;
|
||||
}
|
||||
} while (strm->avail_out == 0);
|
||||
} else {
|
||||
int total_len = model->remain_data_len + data_len;
|
||||
unsigned char *temp = NULL;
|
||||
int handler_len = (total_len / 16) * 16;
|
||||
int remain_len = total_len % 16;
|
||||
if (handler_len) {
|
||||
int copy_data_len = handler_len - model->remain_data_len;
|
||||
char gzip_data[handler_len];
|
||||
temp = (unsigned char *) gzip_data;
|
||||
if (model->remain_data_len) {
|
||||
memcpy(temp, model->remain_data, model->remain_data_len);
|
||||
temp += model->remain_data_len;
|
||||
}
|
||||
memcpy(temp, data, copy_data_len); //填充剩余数据和压缩数据
|
||||
|
||||
aes_encrypt_clogan((unsigned char *) gzip_data, model->last_point, handler_len,
|
||||
(unsigned char *) model->aes_iv);
|
||||
model->total_len += handler_len;
|
||||
model->content_len += handler_len;
|
||||
model->last_point += handler_len;
|
||||
}
|
||||
if (remain_len) {
|
||||
if (handler_len) {
|
||||
int copy_data_len = handler_len - model->remain_data_len;
|
||||
temp = (unsigned char *) data;
|
||||
temp += copy_data_len;
|
||||
memcpy(model->remain_data, temp, remain_len); //填充剩余数据和压缩数据
|
||||
} else {
|
||||
temp = (unsigned char *) model->remain_data;
|
||||
temp += model->remain_data_len;
|
||||
memcpy(temp, data, data_len);
|
||||
}
|
||||
}
|
||||
model->remain_data_len = remain_len;
|
||||
}
|
||||
}
|
||||
|
||||
void clogan_zlib_end_compress(cLogan_model *model) {
|
||||
clogan_zlib(model, NULL, 0, Z_FINISH);
|
||||
(void) deflateEnd(model->strm);
|
||||
int val = 16 - model->remain_data_len;
|
||||
char data[16];
|
||||
memset(data, val, 16);
|
||||
if (model->remain_data_len) {
|
||||
memcpy(data, model->remain_data, model->remain_data_len);
|
||||
}
|
||||
aes_encrypt_clogan((unsigned char *) data, model->last_point, 16,
|
||||
(unsigned char *) model->aes_iv); //把加密数据写入缓存
|
||||
model->last_point += 16;
|
||||
*(model->last_point) = LOGAN_WRITE_PROTOCOL_TAIL;
|
||||
model->last_point++;
|
||||
model->remain_data_len = 0;
|
||||
model->total_len += 17;
|
||||
model->content_len += 16; //为了兼容之前协议content_len,只包含内容,不包含结尾符
|
||||
model->zlib_type = LOGAN_ZLIB_END;
|
||||
model->is_ready_gzip = 0;
|
||||
}
|
||||
|
||||
void clogan_zlib_compress(cLogan_model *model, char *data, int data_len) {
|
||||
if (model->zlib_type == LOGAN_ZLIB_ING || model->zlib_type == LOGAN_ZLIB_INIT) {
|
||||
model->zlib_type = LOGAN_ZLIB_ING;
|
||||
clogan_zlib(model, data, data_len, Z_SYNC_FLUSH);
|
||||
} else {
|
||||
init_zlib_clogan(model);
|
||||
}
|
||||
}
|
||||
|
||||
void clogan_zlib_delete_stream(cLogan_model *model) {
|
||||
(void) deflateEnd(model->strm);
|
||||
model->zlib_type = LOGAN_ZLIB_END;
|
||||
model->is_ready_gzip = 0;
|
||||
}
|
||||
49
Logan/Clogan/zlib_util.h
Normal file
49
Logan/Clogan/zlib_util.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, 美团点评
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef CLOGAN_ZLIB_UTIL_H
|
||||
#define CLOGAN_ZLIB_UTIL_H
|
||||
|
||||
#include "logan_config.h"
|
||||
#include <zlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define LOGAN_CHUNK 16384
|
||||
|
||||
//定义Logan_zlib的状态类型
|
||||
|
||||
#define LOGAN_ZLIB_NONE 0
|
||||
#define LOGAN_ZLIB_INIT 1
|
||||
#define LOGAN_ZLIB_ING 2
|
||||
#define LOGAN_ZLIB_END 3
|
||||
#define LOGAN_ZLIB_FAIL 4
|
||||
|
||||
int init_zlib_clogan(cLogan_model *model); //初始化Logan
|
||||
|
||||
void clogan_zlib_compress(cLogan_model *model, char *data, int data_len); //压缩文件
|
||||
|
||||
void clogan_zlib_end_compress(cLogan_model *model); //压缩结束
|
||||
|
||||
void clogan_zlib_delete_stream(cLogan_model *model); //删除初始化的z_stream
|
||||
|
||||
#endif //CLOGAN_ZLIB_UTIL_H
|
||||
823
Logan/clogan.xcodeproj/project.pbxproj
Normal file
823
Logan/clogan.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,823 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
A7C4888020F74AED001F74C0 /* console_util.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4886B20F74AED001F74C0 /* console_util.c */; };
|
||||
A7C4888120F74AED001F74C0 /* directory_util.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4886E20F74AED001F74C0 /* directory_util.c */; };
|
||||
A7C4888220F74AED001F74C0 /* mmap_util.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4887120F74AED001F74C0 /* mmap_util.c */; };
|
||||
A7C4888320F74AED001F74C0 /* base_util.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4887420F74AED001F74C0 /* base_util.c */; };
|
||||
A7C4888420F74AED001F74C0 /* zlib_util.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4887520F74AED001F74C0 /* zlib_util.c */; };
|
||||
A7C4888520F74AED001F74C0 /* cJSON.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4887620F74AED001F74C0 /* cJSON.c */; };
|
||||
A7C4888620F74AED001F74C0 /* construct_data.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4887720F74AED001F74C0 /* construct_data.c */; };
|
||||
A7C4888720F74AED001F74C0 /* aes_util.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4887C20F74AED001F74C0 /* aes_util.c */; };
|
||||
A7C4888820F74AED001F74C0 /* json_util.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4887D20F74AED001F74C0 /* json_util.c */; };
|
||||
A7C4888920F74AED001F74C0 /* clogan_core.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4887F20F74AED001F74C0 /* clogan_core.c */; };
|
||||
A7C4892220F74AFD001F74C0 /* x509_create.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488D520F74AFD001F74C0 /* x509_create.c */; };
|
||||
A7C4892320F74AFD001F74C0 /* x509_crt.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488D620F74AFD001F74C0 /* x509_crt.c */; };
|
||||
A7C4892420F74AFD001F74C0 /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488D720F74AFD001F74C0 /* aes.c */; };
|
||||
A7C4892520F74AFD001F74C0 /* md4.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488D820F74AFD001F74C0 /* md4.c */; };
|
||||
A7C4892620F74AFD001F74C0 /* ssl_srv.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488D920F74AFD001F74C0 /* ssl_srv.c */; };
|
||||
A7C4892720F74AFD001F74C0 /* camellia.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488DA20F74AFD001F74C0 /* camellia.c */; };
|
||||
A7C4892820F74AFD001F74C0 /* pk_wrap.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488DB20F74AFD001F74C0 /* pk_wrap.c */; };
|
||||
A7C4892920F74AFD001F74C0 /* pk.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488DC20F74AFD001F74C0 /* pk.c */; };
|
||||
A7C4892A20F74AFD001F74C0 /* ecdh.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488DE20F74AFD001F74C0 /* ecdh.c */; };
|
||||
A7C4892B20F74AFD001F74C0 /* ssl_tls.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488DF20F74AFD001F74C0 /* ssl_tls.c */; };
|
||||
A7C4892C20F74AFD001F74C0 /* x509_crl.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E020F74AFD001F74C0 /* x509_crl.c */; };
|
||||
A7C4892D20F74AFD001F74C0 /* cipher_wrap.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E120F74AFD001F74C0 /* cipher_wrap.c */; };
|
||||
A7C4892E20F74AFD001F74C0 /* des.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E220F74AFD001F74C0 /* des.c */; };
|
||||
A7C4892F20F74AFD001F74C0 /* ssl_cookie.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E320F74AFD001F74C0 /* ssl_cookie.c */; };
|
||||
A7C4893020F74AFD001F74C0 /* ctr_drbg.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E420F74AFD001F74C0 /* ctr_drbg.c */; };
|
||||
A7C4893120F74AFD001F74C0 /* aesni.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E520F74AFD001F74C0 /* aesni.c */; };
|
||||
A7C4893220F74AFD001F74C0 /* dhm.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E620F74AFD001F74C0 /* dhm.c */; };
|
||||
A7C4893320F74AFD001F74C0 /* ssl_cache.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E720F74AFD001F74C0 /* ssl_cache.c */; };
|
||||
A7C4893420F74AFD001F74C0 /* ssl_ciphersuites.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E820F74AFD001F74C0 /* ssl_ciphersuites.c */; };
|
||||
A7C4893520F74AFD001F74C0 /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = A7C488E920F74AFD001F74C0 /* Makefile */; };
|
||||
A7C4893620F74AFD001F74C0 /* hmac_drbg.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488EA20F74AFD001F74C0 /* hmac_drbg.c */; };
|
||||
A7C4893720F74AFD001F74C0 /* rsa.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488EB20F74AFD001F74C0 /* rsa.c */; };
|
||||
A7C4893820F74AFD001F74C0 /* ssl_ticket.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488EC20F74AFD001F74C0 /* ssl_ticket.c */; };
|
||||
A7C4893920F74AFD001F74C0 /* asn1parse.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488ED20F74AFD001F74C0 /* asn1parse.c */; };
|
||||
A7C4893A20F74AFD001F74C0 /* certs.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488EE20F74AFD001F74C0 /* certs.c */; };
|
||||
A7C4893B20F74AFD001F74C0 /* pkwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488EF20F74AFD001F74C0 /* pkwrite.c */; };
|
||||
A7C4893C20F74AFD001F74C0 /* gcm.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F020F74AFD001F74C0 /* gcm.c */; };
|
||||
A7C4893D20F74AFD001F74C0 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F120F74AFD001F74C0 /* sha1.c */; };
|
||||
A7C4893E20F74AFD001F74C0 /* asn1write.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F220F74AFD001F74C0 /* asn1write.c */; };
|
||||
A7C4893F20F74AFD001F74C0 /* havege.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F320F74AFD001F74C0 /* havege.c */; };
|
||||
A7C4894020F74AFD001F74C0 /* ccm.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F420F74AFD001F74C0 /* ccm.c */; };
|
||||
A7C4894120F74AFD001F74C0 /* version_features.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F520F74AFD001F74C0 /* version_features.c */; };
|
||||
A7C4894220F74AFD001F74C0 /* entropy_poll.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F620F74AFD001F74C0 /* entropy_poll.c */; };
|
||||
A7C4894320F74AFD001F74C0 /* x509write_csr.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F720F74AFD001F74C0 /* x509write_csr.c */; };
|
||||
A7C4894420F74AFD001F74C0 /* platform.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F820F74AFD001F74C0 /* platform.c */; };
|
||||
A7C4894520F74AFD001F74C0 /* cmac.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488F920F74AFD001F74C0 /* cmac.c */; };
|
||||
A7C4894620F74AFD001F74C0 /* bignum.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488FA20F74AFD001F74C0 /* bignum.c */; };
|
||||
A7C4894720F74AFD001F74C0 /* pkparse.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488FB20F74AFD001F74C0 /* pkparse.c */; };
|
||||
A7C4894820F74AFD001F74C0 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488FC20F74AFD001F74C0 /* debug.c */; };
|
||||
A7C4894920F74AFD001F74C0 /* ripemd160.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488FD20F74AFD001F74C0 /* ripemd160.c */; };
|
||||
A7C4894A20F74AFD001F74C0 /* ssl_cli.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488FE20F74AFD001F74C0 /* ssl_cli.c */; };
|
||||
A7C4894B20F74AFD001F74C0 /* blowfish.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C488FF20F74AFD001F74C0 /* blowfish.c */; };
|
||||
A7C4894C20F74AFD001F74C0 /* pkcs5.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890020F74AFD001F74C0 /* pkcs5.c */; };
|
||||
A7C4894D20F74AFD001F74C0 /* pem.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890120F74AFD001F74C0 /* pem.c */; };
|
||||
A7C4894E20F74AFD001F74C0 /* oid.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890220F74AFD001F74C0 /* oid.c */; };
|
||||
A7C4894F20F74AFD001F74C0 /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890320F74AFD001F74C0 /* error.c */; };
|
||||
A7C4895020F74AFD001F74C0 /* md2.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890420F74AFD001F74C0 /* md2.c */; };
|
||||
A7C4895120F74AFD001F74C0 /* md_wrap.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890520F74AFD001F74C0 /* md_wrap.c */; };
|
||||
A7C4895220F74AFD001F74C0 /* x509_csr.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890620F74AFD001F74C0 /* x509_csr.c */; };
|
||||
A7C4895320F74AFD001F74C0 /* pkcs11.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890A20F74AFD001F74C0 /* pkcs11.c */; };
|
||||
A7C4895420F74AFD001F74C0 /* base64.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890B20F74AFD001F74C0 /* base64.c */; };
|
||||
A7C4895520F74AFD001F74C0 /* memory_buffer_alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890C20F74AFD001F74C0 /* memory_buffer_alloc.c */; };
|
||||
A7C4895620F74AFD001F74C0 /* ecp.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890D20F74AFD001F74C0 /* ecp.c */; };
|
||||
A7C4895720F74AFD001F74C0 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890E20F74AFD001F74C0 /* version.c */; };
|
||||
A7C4895820F74AFD001F74C0 /* x509.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4890F20F74AFD001F74C0 /* x509.c */; };
|
||||
A7C4895920F74AFD001F74C0 /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891020F74AFD001F74C0 /* sha256.c */; };
|
||||
A7C4895A20F74AFD001F74C0 /* ecp_curves.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891120F74AFD001F74C0 /* ecp_curves.c */; };
|
||||
A7C4895B20F74AFD001F74C0 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891220F74AFD001F74C0 /* md5.c */; };
|
||||
A7C4895C20F74AFD001F74C0 /* arc4.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891320F74AFD001F74C0 /* arc4.c */; };
|
||||
A7C4895D20F74AFD001F74C0 /* timing.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891420F74AFD001F74C0 /* timing.c */; };
|
||||
A7C4895E20F74AFD001F74C0 /* xtea.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891520F74AFD001F74C0 /* xtea.c */; };
|
||||
A7C4895F20F74AFD001F74C0 /* x509write_crt.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891620F74AFD001F74C0 /* x509write_crt.c */; };
|
||||
A7C4896020F74AFD001F74C0 /* threading.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891720F74AFD001F74C0 /* threading.c */; };
|
||||
A7C4896120F74AFD001F74C0 /* padlock.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891820F74AFD001F74C0 /* padlock.c */; };
|
||||
A7C4896220F74AFD001F74C0 /* pkcs12.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891920F74AFD001F74C0 /* pkcs12.c */; };
|
||||
A7C4896320F74AFD001F74C0 /* entropy.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891A20F74AFD001F74C0 /* entropy.c */; };
|
||||
A7C4896420F74AFD001F74C0 /* net_sockets.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891B20F74AFD001F74C0 /* net_sockets.c */; };
|
||||
A7C4896520F74AFD001F74C0 /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891C20F74AFD001F74C0 /* sha512.c */; };
|
||||
A7C4896620F74AFD001F74C0 /* md.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891D20F74AFD001F74C0 /* md.c */; };
|
||||
A7C4896720F74AFD001F74C0 /* ecjpake.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891E20F74AFD001F74C0 /* ecjpake.c */; };
|
||||
A7C4896820F74AFD001F74C0 /* cipher.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4891F20F74AFD001F74C0 /* cipher.c */; };
|
||||
A7C4896920F74AFD001F74C0 /* ecdsa.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C4892020F74AFD001F74C0 /* ecdsa.c */; };
|
||||
A7C489B820F75102001F74C0 /* clogan_core.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C4887020F74AED001F74C0 /* clogan_core.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
A7C4885920F74AC5001F74C0 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
A7C4885B20F74AC5001F74C0 /* libclogan.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libclogan.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A7C4886820F74AED001F74C0 /* zlib_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zlib_util.h; sourceTree = "<group>"; };
|
||||
A7C4886920F74AED001F74C0 /* base_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base_util.h; sourceTree = "<group>"; };
|
||||
A7C4886B20F74AED001F74C0 /* console_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = console_util.c; sourceTree = "<group>"; };
|
||||
A7C4886C20F74AED001F74C0 /* construct_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = construct_data.h; sourceTree = "<group>"; };
|
||||
A7C4886D20F74AED001F74C0 /* cJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cJSON.h; sourceTree = "<group>"; };
|
||||
A7C4886E20F74AED001F74C0 /* directory_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = directory_util.c; sourceTree = "<group>"; };
|
||||
A7C4886F20F74AED001F74C0 /* aes_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes_util.h; sourceTree = "<group>"; };
|
||||
A7C4887020F74AED001F74C0 /* clogan_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clogan_core.h; sourceTree = "<group>"; };
|
||||
A7C4887120F74AED001F74C0 /* mmap_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mmap_util.c; sourceTree = "<group>"; };
|
||||
A7C4887220F74AED001F74C0 /* json_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = json_util.h; sourceTree = "<group>"; };
|
||||
A7C4887320F74AED001F74C0 /* logan_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = logan_config.h; sourceTree = "<group>"; };
|
||||
A7C4887420F74AED001F74C0 /* base_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base_util.c; sourceTree = "<group>"; };
|
||||
A7C4887520F74AED001F74C0 /* zlib_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zlib_util.c; sourceTree = "<group>"; };
|
||||
A7C4887620F74AED001F74C0 /* cJSON.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cJSON.c; sourceTree = "<group>"; };
|
||||
A7C4887720F74AED001F74C0 /* construct_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = construct_data.c; sourceTree = "<group>"; };
|
||||
A7C4887820F74AED001F74C0 /* console_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = console_util.h; sourceTree = "<group>"; };
|
||||
A7C4887A20F74AED001F74C0 /* clogan_status.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clogan_status.h; sourceTree = "<group>"; };
|
||||
A7C4887B20F74AED001F74C0 /* directory_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = directory_util.h; sourceTree = "<group>"; };
|
||||
A7C4887C20F74AED001F74C0 /* aes_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aes_util.c; sourceTree = "<group>"; };
|
||||
A7C4887D20F74AED001F74C0 /* json_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = json_util.c; sourceTree = "<group>"; };
|
||||
A7C4887E20F74AED001F74C0 /* mmap_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmap_util.h; sourceTree = "<group>"; };
|
||||
A7C4887F20F74AED001F74C0 /* clogan_core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = clogan_core.c; sourceTree = "<group>"; };
|
||||
A7C4888C20F74AFD001F74C0 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
A7C4888E20F74AFD001F74C0 /* pem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pem.h; sourceTree = "<group>"; };
|
||||
A7C4888F20F74AFD001F74C0 /* check_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = check_config.h; sourceTree = "<group>"; };
|
||||
A7C4889020F74AFD001F74C0 /* error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error.h; sourceTree = "<group>"; };
|
||||
A7C4889120F74AFD001F74C0 /* md2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md2.h; sourceTree = "<group>"; };
|
||||
A7C4889220F74AFD001F74C0 /* oid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = oid.h; sourceTree = "<group>"; };
|
||||
A7C4889320F74AFD001F74C0 /* pkcs5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pkcs5.h; sourceTree = "<group>"; };
|
||||
A7C4889420F74AFD001F74C0 /* ripemd160.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ripemd160.h; sourceTree = "<group>"; };
|
||||
A7C4889520F74AFD001F74C0 /* blowfish.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blowfish.h; sourceTree = "<group>"; };
|
||||
A7C4889620F74AFD001F74C0 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
|
||||
A7C4889720F74AFD001F74C0 /* x509.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509.h; sourceTree = "<group>"; };
|
||||
A7C4889820F74AFD001F74C0 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; };
|
||||
A7C4889920F74AFD001F74C0 /* ecp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ecp.h; sourceTree = "<group>"; };
|
||||
A7C4889A20F74AFD001F74C0 /* net.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = net.h; sourceTree = "<group>"; };
|
||||
A7C4889B20F74AFD001F74C0 /* cipher_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cipher_internal.h; sourceTree = "<group>"; };
|
||||
A7C4889C20F74AFD001F74C0 /* md_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md_internal.h; sourceTree = "<group>"; };
|
||||
A7C4889D20F74AFD001F74C0 /* base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base64.h; sourceTree = "<group>"; };
|
||||
A7C4889E20F74AFD001F74C0 /* pkcs11.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pkcs11.h; sourceTree = "<group>"; };
|
||||
A7C4889F20F74AFD001F74C0 /* ssl_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ssl_internal.h; sourceTree = "<group>"; };
|
||||
A7C488A020F74AFD001F74C0 /* asn1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1.h; sourceTree = "<group>"; };
|
||||
A7C488A120F74AFD001F74C0 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
|
||||
A7C488A220F74AFD001F74C0 /* memory_buffer_alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory_buffer_alloc.h; sourceTree = "<group>"; };
|
||||
A7C488A320F74AFD001F74C0 /* x509_csr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509_csr.h; sourceTree = "<group>"; };
|
||||
A7C488A420F74AFD001F74C0 /* xtea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xtea.h; sourceTree = "<group>"; };
|
||||
A7C488A520F74AFD001F74C0 /* threading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = threading.h; sourceTree = "<group>"; };
|
||||
A7C488A620F74AFD001F74C0 /* compat-1.3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "compat-1.3.h"; sourceTree = "<group>"; };
|
||||
A7C488A720F74AFD001F74C0 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
|
||||
A7C488A820F74AFD001F74C0 /* timing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timing.h; sourceTree = "<group>"; };
|
||||
A7C488A920F74AFD001F74C0 /* arc4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arc4.h; sourceTree = "<group>"; };
|
||||
A7C488AA20F74AFD001F74C0 /* sha256.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha256.h; sourceTree = "<group>"; };
|
||||
A7C488AB20F74AFD001F74C0 /* ecdsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ecdsa.h; sourceTree = "<group>"; };
|
||||
A7C488AC20F74AFD001F74C0 /* md.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md.h; sourceTree = "<group>"; };
|
||||
A7C488AD20F74AFD001F74C0 /* cipher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cipher.h; sourceTree = "<group>"; };
|
||||
A7C488AE20F74AFD001F74C0 /* ecjpake.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ecjpake.h; sourceTree = "<group>"; };
|
||||
A7C488AF20F74AFD001F74C0 /* net_sockets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = net_sockets.h; sourceTree = "<group>"; };
|
||||
A7C488B020F74AFD001F74C0 /* entropy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = entropy.h; sourceTree = "<group>"; };
|
||||
A7C488B120F74AFD001F74C0 /* pkcs12.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pkcs12.h; sourceTree = "<group>"; };
|
||||
A7C488B220F74AFD001F74C0 /* padlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = padlock.h; sourceTree = "<group>"; };
|
||||
A7C488B320F74AFD001F74C0 /* sha512.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha512.h; sourceTree = "<group>"; };
|
||||
A7C488B420F74AFD001F74C0 /* bn_mul.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bn_mul.h; sourceTree = "<group>"; };
|
||||
A7C488B520F74AFD001F74C0 /* pk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pk.h; sourceTree = "<group>"; };
|
||||
A7C488B620F74AFD001F74C0 /* ecp_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ecp_internal.h; sourceTree = "<group>"; };
|
||||
A7C488B720F74AFD001F74C0 /* ssl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ssl.h; sourceTree = "<group>"; };
|
||||
A7C488B820F74AFD001F74C0 /* platform_time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform_time.h; sourceTree = "<group>"; };
|
||||
A7C488B920F74AFD001F74C0 /* camellia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = camellia.h; sourceTree = "<group>"; };
|
||||
A7C488BA20F74AFD001F74C0 /* md4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md4.h; sourceTree = "<group>"; };
|
||||
A7C488BB20F74AFD001F74C0 /* x509_crt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509_crt.h; sourceTree = "<group>"; };
|
||||
A7C488BC20F74AFD001F74C0 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
|
||||
A7C488BD20F74AFD001F74C0 /* pk_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pk_internal.h; sourceTree = "<group>"; };
|
||||
A7C488BE20F74AFD001F74C0 /* ssl_cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ssl_cookie.h; sourceTree = "<group>"; };
|
||||
A7C488BF20F74AFD001F74C0 /* dhm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dhm.h; sourceTree = "<group>"; };
|
||||
A7C488C020F74AFD001F74C0 /* aesni.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aesni.h; sourceTree = "<group>"; };
|
||||
A7C488C120F74AFD001F74C0 /* ctr_drbg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ctr_drbg.h; sourceTree = "<group>"; };
|
||||
A7C488C220F74AFD001F74C0 /* des.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = des.h; sourceTree = "<group>"; };
|
||||
A7C488C320F74AFD001F74C0 /* x509_crl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509_crl.h; sourceTree = "<group>"; };
|
||||
A7C488C420F74AFD001F74C0 /* ecdh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ecdh.h; sourceTree = "<group>"; };
|
||||
A7C488C520F74AFD001F74C0 /* sha1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha1.h; sourceTree = "<group>"; };
|
||||
A7C488C620F74AFD001F74C0 /* gcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gcm.h; sourceTree = "<group>"; };
|
||||
A7C488C720F74AFD001F74C0 /* certs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = certs.h; sourceTree = "<group>"; };
|
||||
A7C488C820F74AFD001F74C0 /* rsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rsa.h; sourceTree = "<group>"; };
|
||||
A7C488C920F74AFD001F74C0 /* hmac_drbg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hmac_drbg.h; sourceTree = "<group>"; };
|
||||
A7C488CA20F74AFD001F74C0 /* ssl_ticket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ssl_ticket.h; sourceTree = "<group>"; };
|
||||
A7C488CB20F74AFD001F74C0 /* ssl_ciphersuites.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ssl_ciphersuites.h; sourceTree = "<group>"; };
|
||||
A7C488CC20F74AFD001F74C0 /* ssl_cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ssl_cache.h; sourceTree = "<group>"; };
|
||||
A7C488CD20F74AFD001F74C0 /* cmac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cmac.h; sourceTree = "<group>"; };
|
||||
A7C488CE20F74AFD001F74C0 /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = "<group>"; };
|
||||
A7C488CF20F74AFD001F74C0 /* bignum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bignum.h; sourceTree = "<group>"; };
|
||||
A7C488D020F74AFD001F74C0 /* entropy_poll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = entropy_poll.h; sourceTree = "<group>"; };
|
||||
A7C488D120F74AFD001F74C0 /* havege.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = havege.h; sourceTree = "<group>"; };
|
||||
A7C488D220F74AFD001F74C0 /* asn1write.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1write.h; sourceTree = "<group>"; };
|
||||
A7C488D320F74AFD001F74C0 /* ccm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccm.h; sourceTree = "<group>"; };
|
||||
A7C488D520F74AFD001F74C0 /* x509_create.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x509_create.c; sourceTree = "<group>"; };
|
||||
A7C488D620F74AFD001F74C0 /* x509_crt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x509_crt.c; sourceTree = "<group>"; };
|
||||
A7C488D720F74AFD001F74C0 /* aes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aes.c; sourceTree = "<group>"; };
|
||||
A7C488D820F74AFD001F74C0 /* md4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md4.c; sourceTree = "<group>"; };
|
||||
A7C488D920F74AFD001F74C0 /* ssl_srv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_srv.c; sourceTree = "<group>"; };
|
||||
A7C488DA20F74AFD001F74C0 /* camellia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = camellia.c; sourceTree = "<group>"; };
|
||||
A7C488DB20F74AFD001F74C0 /* pk_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pk_wrap.c; sourceTree = "<group>"; };
|
||||
A7C488DC20F74AFD001F74C0 /* pk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pk.c; sourceTree = "<group>"; };
|
||||
A7C488DD20F74AFD001F74C0 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
A7C488DE20F74AFD001F74C0 /* ecdh.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecdh.c; sourceTree = "<group>"; };
|
||||
A7C488DF20F74AFD001F74C0 /* ssl_tls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_tls.c; sourceTree = "<group>"; };
|
||||
A7C488E020F74AFD001F74C0 /* x509_crl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x509_crl.c; sourceTree = "<group>"; };
|
||||
A7C488E120F74AFD001F74C0 /* cipher_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cipher_wrap.c; sourceTree = "<group>"; };
|
||||
A7C488E220F74AFD001F74C0 /* des.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = des.c; sourceTree = "<group>"; };
|
||||
A7C488E320F74AFD001F74C0 /* ssl_cookie.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_cookie.c; sourceTree = "<group>"; };
|
||||
A7C488E420F74AFD001F74C0 /* ctr_drbg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ctr_drbg.c; sourceTree = "<group>"; };
|
||||
A7C488E520F74AFD001F74C0 /* aesni.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aesni.c; sourceTree = "<group>"; };
|
||||
A7C488E620F74AFD001F74C0 /* dhm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dhm.c; sourceTree = "<group>"; };
|
||||
A7C488E720F74AFD001F74C0 /* ssl_cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_cache.c; sourceTree = "<group>"; };
|
||||
A7C488E820F74AFD001F74C0 /* ssl_ciphersuites.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_ciphersuites.c; sourceTree = "<group>"; };
|
||||
A7C488E920F74AFD001F74C0 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
A7C488EA20F74AFD001F74C0 /* hmac_drbg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hmac_drbg.c; sourceTree = "<group>"; };
|
||||
A7C488EB20F74AFD001F74C0 /* rsa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rsa.c; sourceTree = "<group>"; };
|
||||
A7C488EC20F74AFD001F74C0 /* ssl_ticket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_ticket.c; sourceTree = "<group>"; };
|
||||
A7C488ED20F74AFD001F74C0 /* asn1parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asn1parse.c; sourceTree = "<group>"; };
|
||||
A7C488EE20F74AFD001F74C0 /* certs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = certs.c; sourceTree = "<group>"; };
|
||||
A7C488EF20F74AFD001F74C0 /* pkwrite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkwrite.c; sourceTree = "<group>"; };
|
||||
A7C488F020F74AFD001F74C0 /* gcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gcm.c; sourceTree = "<group>"; };
|
||||
A7C488F120F74AFD001F74C0 /* sha1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = "<group>"; };
|
||||
A7C488F220F74AFD001F74C0 /* asn1write.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asn1write.c; sourceTree = "<group>"; };
|
||||
A7C488F320F74AFD001F74C0 /* havege.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = havege.c; sourceTree = "<group>"; };
|
||||
A7C488F420F74AFD001F74C0 /* ccm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccm.c; sourceTree = "<group>"; };
|
||||
A7C488F520F74AFD001F74C0 /* version_features.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version_features.c; sourceTree = "<group>"; };
|
||||
A7C488F620F74AFD001F74C0 /* entropy_poll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = entropy_poll.c; sourceTree = "<group>"; };
|
||||
A7C488F720F74AFD001F74C0 /* x509write_csr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x509write_csr.c; sourceTree = "<group>"; };
|
||||
A7C488F820F74AFD001F74C0 /* platform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = platform.c; sourceTree = "<group>"; };
|
||||
A7C488F920F74AFD001F74C0 /* cmac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cmac.c; sourceTree = "<group>"; };
|
||||
A7C488FA20F74AFD001F74C0 /* bignum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bignum.c; sourceTree = "<group>"; };
|
||||
A7C488FB20F74AFD001F74C0 /* pkparse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkparse.c; sourceTree = "<group>"; };
|
||||
A7C488FC20F74AFD001F74C0 /* debug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = debug.c; sourceTree = "<group>"; };
|
||||
A7C488FD20F74AFD001F74C0 /* ripemd160.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ripemd160.c; sourceTree = "<group>"; };
|
||||
A7C488FE20F74AFD001F74C0 /* ssl_cli.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_cli.c; sourceTree = "<group>"; };
|
||||
A7C488FF20F74AFD001F74C0 /* blowfish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = blowfish.c; sourceTree = "<group>"; };
|
||||
A7C4890020F74AFD001F74C0 /* pkcs5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkcs5.c; sourceTree = "<group>"; };
|
||||
A7C4890120F74AFD001F74C0 /* pem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pem.c; sourceTree = "<group>"; };
|
||||
A7C4890220F74AFD001F74C0 /* oid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = oid.c; sourceTree = "<group>"; };
|
||||
A7C4890320F74AFD001F74C0 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = "<group>"; };
|
||||
A7C4890420F74AFD001F74C0 /* md2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md2.c; sourceTree = "<group>"; };
|
||||
A7C4890520F74AFD001F74C0 /* md_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md_wrap.c; sourceTree = "<group>"; };
|
||||
A7C4890620F74AFD001F74C0 /* x509_csr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x509_csr.c; sourceTree = "<group>"; };
|
||||
A7C4890A20F74AFD001F74C0 /* pkcs11.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkcs11.c; sourceTree = "<group>"; };
|
||||
A7C4890B20F74AFD001F74C0 /* base64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base64.c; sourceTree = "<group>"; };
|
||||
A7C4890C20F74AFD001F74C0 /* memory_buffer_alloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memory_buffer_alloc.c; sourceTree = "<group>"; };
|
||||
A7C4890D20F74AFD001F74C0 /* ecp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecp.c; sourceTree = "<group>"; };
|
||||
A7C4890E20F74AFD001F74C0 /* version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = "<group>"; };
|
||||
A7C4890F20F74AFD001F74C0 /* x509.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x509.c; sourceTree = "<group>"; };
|
||||
A7C4891020F74AFD001F74C0 /* sha256.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha256.c; sourceTree = "<group>"; };
|
||||
A7C4891120F74AFD001F74C0 /* ecp_curves.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecp_curves.c; sourceTree = "<group>"; };
|
||||
A7C4891220F74AFD001F74C0 /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5.c; sourceTree = "<group>"; };
|
||||
A7C4891320F74AFD001F74C0 /* arc4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arc4.c; sourceTree = "<group>"; };
|
||||
A7C4891420F74AFD001F74C0 /* timing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = timing.c; sourceTree = "<group>"; };
|
||||
A7C4891520F74AFD001F74C0 /* xtea.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xtea.c; sourceTree = "<group>"; };
|
||||
A7C4891620F74AFD001F74C0 /* x509write_crt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = x509write_crt.c; sourceTree = "<group>"; };
|
||||
A7C4891720F74AFD001F74C0 /* threading.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = threading.c; sourceTree = "<group>"; };
|
||||
A7C4891820F74AFD001F74C0 /* padlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = padlock.c; sourceTree = "<group>"; };
|
||||
A7C4891920F74AFD001F74C0 /* pkcs12.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkcs12.c; sourceTree = "<group>"; };
|
||||
A7C4891A20F74AFD001F74C0 /* entropy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = entropy.c; sourceTree = "<group>"; };
|
||||
A7C4891B20F74AFD001F74C0 /* net_sockets.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = net_sockets.c; sourceTree = "<group>"; };
|
||||
A7C4891C20F74AFD001F74C0 /* sha512.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha512.c; sourceTree = "<group>"; };
|
||||
A7C4891D20F74AFD001F74C0 /* md.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md.c; sourceTree = "<group>"; };
|
||||
A7C4891E20F74AFD001F74C0 /* ecjpake.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecjpake.c; sourceTree = "<group>"; };
|
||||
A7C4891F20F74AFD001F74C0 /* cipher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cipher.c; sourceTree = "<group>"; };
|
||||
A7C4892020F74AFD001F74C0 /* ecdsa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ecdsa.c; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
A7C4885820F74AC5001F74C0 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
A7C4885220F74AC5001F74C0 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7C4888A20F74AFD001F74C0 /* mbedtls */,
|
||||
A7C4886720F74AED001F74C0 /* Clogan */,
|
||||
A7C4885C20F74AC5001F74C0 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A7C4885C20F74AC5001F74C0 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7C4885B20F74AC5001F74C0 /* libclogan.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A7C4886720F74AED001F74C0 /* Clogan */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7C4886820F74AED001F74C0 /* zlib_util.h */,
|
||||
A7C4886920F74AED001F74C0 /* base_util.h */,
|
||||
A7C4886B20F74AED001F74C0 /* console_util.c */,
|
||||
A7C4886C20F74AED001F74C0 /* construct_data.h */,
|
||||
A7C4886D20F74AED001F74C0 /* cJSON.h */,
|
||||
A7C4886E20F74AED001F74C0 /* directory_util.c */,
|
||||
A7C4886F20F74AED001F74C0 /* aes_util.h */,
|
||||
A7C4887020F74AED001F74C0 /* clogan_core.h */,
|
||||
A7C4887120F74AED001F74C0 /* mmap_util.c */,
|
||||
A7C4887220F74AED001F74C0 /* json_util.h */,
|
||||
A7C4887320F74AED001F74C0 /* logan_config.h */,
|
||||
A7C4887420F74AED001F74C0 /* base_util.c */,
|
||||
A7C4887520F74AED001F74C0 /* zlib_util.c */,
|
||||
A7C4887620F74AED001F74C0 /* cJSON.c */,
|
||||
A7C4887720F74AED001F74C0 /* construct_data.c */,
|
||||
A7C4887820F74AED001F74C0 /* console_util.h */,
|
||||
A7C4887A20F74AED001F74C0 /* clogan_status.h */,
|
||||
A7C4887B20F74AED001F74C0 /* directory_util.h */,
|
||||
A7C4887C20F74AED001F74C0 /* aes_util.c */,
|
||||
A7C4887D20F74AED001F74C0 /* json_util.c */,
|
||||
A7C4887E20F74AED001F74C0 /* mmap_util.h */,
|
||||
A7C4887F20F74AED001F74C0 /* clogan_core.c */,
|
||||
);
|
||||
path = Clogan;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A7C4888A20F74AFD001F74C0 /* mbedtls */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7C4888B20F74AFD001F74C0 /* include */,
|
||||
A7C488D420F74AFD001F74C0 /* library */,
|
||||
);
|
||||
path = mbedtls;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A7C4888B20F74AFD001F74C0 /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7C4888C20F74AFD001F74C0 /* CMakeLists.txt */,
|
||||
A7C4888D20F74AFD001F74C0 /* mbedtls */,
|
||||
);
|
||||
path = include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A7C4888D20F74AFD001F74C0 /* mbedtls */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7C4888E20F74AFD001F74C0 /* pem.h */,
|
||||
A7C4888F20F74AFD001F74C0 /* check_config.h */,
|
||||
A7C4889020F74AFD001F74C0 /* error.h */,
|
||||
A7C4889120F74AFD001F74C0 /* md2.h */,
|
||||
A7C4889220F74AFD001F74C0 /* oid.h */,
|
||||
A7C4889320F74AFD001F74C0 /* pkcs5.h */,
|
||||
A7C4889420F74AFD001F74C0 /* ripemd160.h */,
|
||||
A7C4889520F74AFD001F74C0 /* blowfish.h */,
|
||||
A7C4889620F74AFD001F74C0 /* debug.h */,
|
||||
A7C4889720F74AFD001F74C0 /* x509.h */,
|
||||
A7C4889820F74AFD001F74C0 /* version.h */,
|
||||
A7C4889920F74AFD001F74C0 /* ecp.h */,
|
||||
A7C4889A20F74AFD001F74C0 /* net.h */,
|
||||
A7C4889B20F74AFD001F74C0 /* cipher_internal.h */,
|
||||
A7C4889C20F74AFD001F74C0 /* md_internal.h */,
|
||||
A7C4889D20F74AFD001F74C0 /* base64.h */,
|
||||
A7C4889E20F74AFD001F74C0 /* pkcs11.h */,
|
||||
A7C4889F20F74AFD001F74C0 /* ssl_internal.h */,
|
||||
A7C488A020F74AFD001F74C0 /* asn1.h */,
|
||||
A7C488A120F74AFD001F74C0 /* config.h */,
|
||||
A7C488A220F74AFD001F74C0 /* memory_buffer_alloc.h */,
|
||||
A7C488A320F74AFD001F74C0 /* x509_csr.h */,
|
||||
A7C488A420F74AFD001F74C0 /* xtea.h */,
|
||||
A7C488A520F74AFD001F74C0 /* threading.h */,
|
||||
A7C488A620F74AFD001F74C0 /* compat-1.3.h */,
|
||||
A7C488A720F74AFD001F74C0 /* md5.h */,
|
||||
A7C488A820F74AFD001F74C0 /* timing.h */,
|
||||
A7C488A920F74AFD001F74C0 /* arc4.h */,
|
||||
A7C488AA20F74AFD001F74C0 /* sha256.h */,
|
||||
A7C488AB20F74AFD001F74C0 /* ecdsa.h */,
|
||||
A7C488AC20F74AFD001F74C0 /* md.h */,
|
||||
A7C488AD20F74AFD001F74C0 /* cipher.h */,
|
||||
A7C488AE20F74AFD001F74C0 /* ecjpake.h */,
|
||||
A7C488AF20F74AFD001F74C0 /* net_sockets.h */,
|
||||
A7C488B020F74AFD001F74C0 /* entropy.h */,
|
||||
A7C488B120F74AFD001F74C0 /* pkcs12.h */,
|
||||
A7C488B220F74AFD001F74C0 /* padlock.h */,
|
||||
A7C488B320F74AFD001F74C0 /* sha512.h */,
|
||||
A7C488B420F74AFD001F74C0 /* bn_mul.h */,
|
||||
A7C488B520F74AFD001F74C0 /* pk.h */,
|
||||
A7C488B620F74AFD001F74C0 /* ecp_internal.h */,
|
||||
A7C488B720F74AFD001F74C0 /* ssl.h */,
|
||||
A7C488B820F74AFD001F74C0 /* platform_time.h */,
|
||||
A7C488B920F74AFD001F74C0 /* camellia.h */,
|
||||
A7C488BA20F74AFD001F74C0 /* md4.h */,
|
||||
A7C488BB20F74AFD001F74C0 /* x509_crt.h */,
|
||||
A7C488BC20F74AFD001F74C0 /* aes.h */,
|
||||
A7C488BD20F74AFD001F74C0 /* pk_internal.h */,
|
||||
A7C488BE20F74AFD001F74C0 /* ssl_cookie.h */,
|
||||
A7C488BF20F74AFD001F74C0 /* dhm.h */,
|
||||
A7C488C020F74AFD001F74C0 /* aesni.h */,
|
||||
A7C488C120F74AFD001F74C0 /* ctr_drbg.h */,
|
||||
A7C488C220F74AFD001F74C0 /* des.h */,
|
||||
A7C488C320F74AFD001F74C0 /* x509_crl.h */,
|
||||
A7C488C420F74AFD001F74C0 /* ecdh.h */,
|
||||
A7C488C520F74AFD001F74C0 /* sha1.h */,
|
||||
A7C488C620F74AFD001F74C0 /* gcm.h */,
|
||||
A7C488C720F74AFD001F74C0 /* certs.h */,
|
||||
A7C488C820F74AFD001F74C0 /* rsa.h */,
|
||||
A7C488C920F74AFD001F74C0 /* hmac_drbg.h */,
|
||||
A7C488CA20F74AFD001F74C0 /* ssl_ticket.h */,
|
||||
A7C488CB20F74AFD001F74C0 /* ssl_ciphersuites.h */,
|
||||
A7C488CC20F74AFD001F74C0 /* ssl_cache.h */,
|
||||
A7C488CD20F74AFD001F74C0 /* cmac.h */,
|
||||
A7C488CE20F74AFD001F74C0 /* platform.h */,
|
||||
A7C488CF20F74AFD001F74C0 /* bignum.h */,
|
||||
A7C488D020F74AFD001F74C0 /* entropy_poll.h */,
|
||||
A7C488D120F74AFD001F74C0 /* havege.h */,
|
||||
A7C488D220F74AFD001F74C0 /* asn1write.h */,
|
||||
A7C488D320F74AFD001F74C0 /* ccm.h */,
|
||||
);
|
||||
path = mbedtls;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A7C488D420F74AFD001F74C0 /* library */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7C488D520F74AFD001F74C0 /* x509_create.c */,
|
||||
A7C488D620F74AFD001F74C0 /* x509_crt.c */,
|
||||
A7C488D720F74AFD001F74C0 /* aes.c */,
|
||||
A7C488D820F74AFD001F74C0 /* md4.c */,
|
||||
A7C488D920F74AFD001F74C0 /* ssl_srv.c */,
|
||||
A7C488DA20F74AFD001F74C0 /* camellia.c */,
|
||||
A7C488DB20F74AFD001F74C0 /* pk_wrap.c */,
|
||||
A7C488DC20F74AFD001F74C0 /* pk.c */,
|
||||
A7C488DD20F74AFD001F74C0 /* CMakeLists.txt */,
|
||||
A7C488DE20F74AFD001F74C0 /* ecdh.c */,
|
||||
A7C488DF20F74AFD001F74C0 /* ssl_tls.c */,
|
||||
A7C488E020F74AFD001F74C0 /* x509_crl.c */,
|
||||
A7C488E120F74AFD001F74C0 /* cipher_wrap.c */,
|
||||
A7C488E220F74AFD001F74C0 /* des.c */,
|
||||
A7C488E320F74AFD001F74C0 /* ssl_cookie.c */,
|
||||
A7C488E420F74AFD001F74C0 /* ctr_drbg.c */,
|
||||
A7C488E520F74AFD001F74C0 /* aesni.c */,
|
||||
A7C488E620F74AFD001F74C0 /* dhm.c */,
|
||||
A7C488E720F74AFD001F74C0 /* ssl_cache.c */,
|
||||
A7C488E820F74AFD001F74C0 /* ssl_ciphersuites.c */,
|
||||
A7C488E920F74AFD001F74C0 /* Makefile */,
|
||||
A7C488EA20F74AFD001F74C0 /* hmac_drbg.c */,
|
||||
A7C488EB20F74AFD001F74C0 /* rsa.c */,
|
||||
A7C488EC20F74AFD001F74C0 /* ssl_ticket.c */,
|
||||
A7C488ED20F74AFD001F74C0 /* asn1parse.c */,
|
||||
A7C488EE20F74AFD001F74C0 /* certs.c */,
|
||||
A7C488EF20F74AFD001F74C0 /* pkwrite.c */,
|
||||
A7C488F020F74AFD001F74C0 /* gcm.c */,
|
||||
A7C488F120F74AFD001F74C0 /* sha1.c */,
|
||||
A7C488F220F74AFD001F74C0 /* asn1write.c */,
|
||||
A7C488F320F74AFD001F74C0 /* havege.c */,
|
||||
A7C488F420F74AFD001F74C0 /* ccm.c */,
|
||||
A7C488F520F74AFD001F74C0 /* version_features.c */,
|
||||
A7C488F620F74AFD001F74C0 /* entropy_poll.c */,
|
||||
A7C488F720F74AFD001F74C0 /* x509write_csr.c */,
|
||||
A7C488F820F74AFD001F74C0 /* platform.c */,
|
||||
A7C488F920F74AFD001F74C0 /* cmac.c */,
|
||||
A7C488FA20F74AFD001F74C0 /* bignum.c */,
|
||||
A7C488FB20F74AFD001F74C0 /* pkparse.c */,
|
||||
A7C488FC20F74AFD001F74C0 /* debug.c */,
|
||||
A7C488FD20F74AFD001F74C0 /* ripemd160.c */,
|
||||
A7C488FE20F74AFD001F74C0 /* ssl_cli.c */,
|
||||
A7C488FF20F74AFD001F74C0 /* blowfish.c */,
|
||||
A7C4890020F74AFD001F74C0 /* pkcs5.c */,
|
||||
A7C4890120F74AFD001F74C0 /* pem.c */,
|
||||
A7C4890220F74AFD001F74C0 /* oid.c */,
|
||||
A7C4890320F74AFD001F74C0 /* error.c */,
|
||||
A7C4890420F74AFD001F74C0 /* md2.c */,
|
||||
A7C4890520F74AFD001F74C0 /* md_wrap.c */,
|
||||
A7C4890620F74AFD001F74C0 /* x509_csr.c */,
|
||||
A7C4890A20F74AFD001F74C0 /* pkcs11.c */,
|
||||
A7C4890B20F74AFD001F74C0 /* base64.c */,
|
||||
A7C4890C20F74AFD001F74C0 /* memory_buffer_alloc.c */,
|
||||
A7C4890D20F74AFD001F74C0 /* ecp.c */,
|
||||
A7C4890E20F74AFD001F74C0 /* version.c */,
|
||||
A7C4890F20F74AFD001F74C0 /* x509.c */,
|
||||
A7C4891020F74AFD001F74C0 /* sha256.c */,
|
||||
A7C4891120F74AFD001F74C0 /* ecp_curves.c */,
|
||||
A7C4891220F74AFD001F74C0 /* md5.c */,
|
||||
A7C4891320F74AFD001F74C0 /* arc4.c */,
|
||||
A7C4891420F74AFD001F74C0 /* timing.c */,
|
||||
A7C4891520F74AFD001F74C0 /* xtea.c */,
|
||||
A7C4891620F74AFD001F74C0 /* x509write_crt.c */,
|
||||
A7C4891720F74AFD001F74C0 /* threading.c */,
|
||||
A7C4891820F74AFD001F74C0 /* padlock.c */,
|
||||
A7C4891920F74AFD001F74C0 /* pkcs12.c */,
|
||||
A7C4891A20F74AFD001F74C0 /* entropy.c */,
|
||||
A7C4891B20F74AFD001F74C0 /* net_sockets.c */,
|
||||
A7C4891C20F74AFD001F74C0 /* sha512.c */,
|
||||
A7C4891D20F74AFD001F74C0 /* md.c */,
|
||||
A7C4891E20F74AFD001F74C0 /* ecjpake.c */,
|
||||
A7C4891F20F74AFD001F74C0 /* cipher.c */,
|
||||
A7C4892020F74AFD001F74C0 /* ecdsa.c */,
|
||||
);
|
||||
path = library;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
A7C489B620F750E8001F74C0 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A7C489B820F75102001F74C0 /* clogan_core.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
A7C4885A20F74AC5001F74C0 /* clogan */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = A7C4886420F74AC5001F74C0 /* Build configuration list for PBXNativeTarget "clogan" */;
|
||||
buildPhases = (
|
||||
A7C4885720F74AC5001F74C0 /* Sources */,
|
||||
A7C4885820F74AC5001F74C0 /* Frameworks */,
|
||||
A7C4885920F74AC5001F74C0 /* CopyFiles */,
|
||||
A7C489B620F750E8001F74C0 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = clogan;
|
||||
productName = clogan;
|
||||
productReference = A7C4885B20F74AC5001F74C0 /* libclogan.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
A7C4885320F74AC5001F74C0 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = ten22;
|
||||
TargetAttributes = {
|
||||
A7C4885A20F74AC5001F74C0 = {
|
||||
CreatedOnToolsVersion = 9.3;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = A7C4885620F74AC5001F74C0 /* Build configuration list for PBXProject "clogan" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = A7C4885220F74AC5001F74C0;
|
||||
productRefGroup = A7C4885C20F74AC5001F74C0 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
A7C4885A20F74AC5001F74C0 /* clogan */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
A7C4885720F74AC5001F74C0 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A7C4895820F74AFD001F74C0 /* x509.c in Sources */,
|
||||
A7C4893520F74AFD001F74C0 /* Makefile in Sources */,
|
||||
A7C4894A20F74AFD001F74C0 /* ssl_cli.c in Sources */,
|
||||
A7C4893F20F74AFD001F74C0 /* havege.c in Sources */,
|
||||
A7C4888920F74AED001F74C0 /* clogan_core.c in Sources */,
|
||||
A7C4892520F74AFD001F74C0 /* md4.c in Sources */,
|
||||
A7C4894920F74AFD001F74C0 /* ripemd160.c in Sources */,
|
||||
A7C4892420F74AFD001F74C0 /* aes.c in Sources */,
|
||||
A7C4892720F74AFD001F74C0 /* camellia.c in Sources */,
|
||||
A7C4895F20F74AFD001F74C0 /* x509write_crt.c in Sources */,
|
||||
A7C4892D20F74AFD001F74C0 /* cipher_wrap.c in Sources */,
|
||||
A7C4892820F74AFD001F74C0 /* pk_wrap.c in Sources */,
|
||||
A7C4894F20F74AFD001F74C0 /* error.c in Sources */,
|
||||
A7C4893120F74AFD001F74C0 /* aesni.c in Sources */,
|
||||
A7C4894E20F74AFD001F74C0 /* oid.c in Sources */,
|
||||
A7C4894C20F74AFD001F74C0 /* pkcs5.c in Sources */,
|
||||
A7C4892C20F74AFD001F74C0 /* x509_crl.c in Sources */,
|
||||
A7C4894620F74AFD001F74C0 /* bignum.c in Sources */,
|
||||
A7C4892A20F74AFD001F74C0 /* ecdh.c in Sources */,
|
||||
A7C4894420F74AFD001F74C0 /* platform.c in Sources */,
|
||||
A7C4892F20F74AFD001F74C0 /* ssl_cookie.c in Sources */,
|
||||
A7C4893C20F74AFD001F74C0 /* gcm.c in Sources */,
|
||||
A7C4894820F74AFD001F74C0 /* debug.c in Sources */,
|
||||
A7C4896320F74AFD001F74C0 /* entropy.c in Sources */,
|
||||
A7C4895E20F74AFD001F74C0 /* xtea.c in Sources */,
|
||||
A7C4893D20F74AFD001F74C0 /* sha1.c in Sources */,
|
||||
A7C4894020F74AFD001F74C0 /* ccm.c in Sources */,
|
||||
A7C4888620F74AED001F74C0 /* construct_data.c in Sources */,
|
||||
A7C4892920F74AFD001F74C0 /* pk.c in Sources */,
|
||||
A7C4895420F74AFD001F74C0 /* base64.c in Sources */,
|
||||
A7C4893220F74AFD001F74C0 /* dhm.c in Sources */,
|
||||
A7C4893320F74AFD001F74C0 /* ssl_cache.c in Sources */,
|
||||
A7C4895D20F74AFD001F74C0 /* timing.c in Sources */,
|
||||
A7C4888720F74AED001F74C0 /* aes_util.c in Sources */,
|
||||
A7C4888320F74AED001F74C0 /* base_util.c in Sources */,
|
||||
A7C4896220F74AFD001F74C0 /* pkcs12.c in Sources */,
|
||||
A7C4896020F74AFD001F74C0 /* threading.c in Sources */,
|
||||
A7C4892B20F74AFD001F74C0 /* ssl_tls.c in Sources */,
|
||||
A7C4888220F74AED001F74C0 /* mmap_util.c in Sources */,
|
||||
A7C4895720F74AFD001F74C0 /* version.c in Sources */,
|
||||
A7C4895220F74AFD001F74C0 /* x509_csr.c in Sources */,
|
||||
A7C4892620F74AFD001F74C0 /* ssl_srv.c in Sources */,
|
||||
A7C4894B20F74AFD001F74C0 /* blowfish.c in Sources */,
|
||||
A7C4892E20F74AFD001F74C0 /* des.c in Sources */,
|
||||
A7C4894120F74AFD001F74C0 /* version_features.c in Sources */,
|
||||
A7C4893620F74AFD001F74C0 /* hmac_drbg.c in Sources */,
|
||||
A7C4892220F74AFD001F74C0 /* x509_create.c in Sources */,
|
||||
A7C4888420F74AED001F74C0 /* zlib_util.c in Sources */,
|
||||
A7C4894220F74AFD001F74C0 /* entropy_poll.c in Sources */,
|
||||
A7C4896520F74AFD001F74C0 /* sha512.c in Sources */,
|
||||
A7C4894720F74AFD001F74C0 /* pkparse.c in Sources */,
|
||||
A7C4895520F74AFD001F74C0 /* memory_buffer_alloc.c in Sources */,
|
||||
A7C4895120F74AFD001F74C0 /* md_wrap.c in Sources */,
|
||||
A7C4893A20F74AFD001F74C0 /* certs.c in Sources */,
|
||||
A7C4888520F74AED001F74C0 /* cJSON.c in Sources */,
|
||||
A7C4896120F74AFD001F74C0 /* padlock.c in Sources */,
|
||||
A7C4896920F74AFD001F74C0 /* ecdsa.c in Sources */,
|
||||
A7C4895B20F74AFD001F74C0 /* md5.c in Sources */,
|
||||
A7C4895020F74AFD001F74C0 /* md2.c in Sources */,
|
||||
A7C4894520F74AFD001F74C0 /* cmac.c in Sources */,
|
||||
A7C4895620F74AFD001F74C0 /* ecp.c in Sources */,
|
||||
A7C4888820F74AED001F74C0 /* json_util.c in Sources */,
|
||||
A7C4896720F74AFD001F74C0 /* ecjpake.c in Sources */,
|
||||
A7C4893920F74AFD001F74C0 /* asn1parse.c in Sources */,
|
||||
A7C4892320F74AFD001F74C0 /* x509_crt.c in Sources */,
|
||||
A7C4893020F74AFD001F74C0 /* ctr_drbg.c in Sources */,
|
||||
A7C4894320F74AFD001F74C0 /* x509write_csr.c in Sources */,
|
||||
A7C4893720F74AFD001F74C0 /* rsa.c in Sources */,
|
||||
A7C4896820F74AFD001F74C0 /* cipher.c in Sources */,
|
||||
A7C4895C20F74AFD001F74C0 /* arc4.c in Sources */,
|
||||
A7C4893820F74AFD001F74C0 /* ssl_ticket.c in Sources */,
|
||||
A7C4894D20F74AFD001F74C0 /* pem.c in Sources */,
|
||||
A7C4893B20F74AFD001F74C0 /* pkwrite.c in Sources */,
|
||||
A7C4888020F74AED001F74C0 /* console_util.c in Sources */,
|
||||
A7C4895320F74AFD001F74C0 /* pkcs11.c in Sources */,
|
||||
A7C4888120F74AED001F74C0 /* directory_util.c in Sources */,
|
||||
A7C4896620F74AFD001F74C0 /* md.c in Sources */,
|
||||
A7C4896420F74AFD001F74C0 /* net_sockets.c in Sources */,
|
||||
A7C4893420F74AFD001F74C0 /* ssl_ciphersuites.c in Sources */,
|
||||
A7C4895920F74AFD001F74C0 /* sha256.c in Sources */,
|
||||
A7C4895A20F74AFD001F74C0 /* ecp_curves.c in Sources */,
|
||||
A7C4893E20F74AFD001F74C0 /* asn1write.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
A7C4886220F74AC5001F74C0 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.3;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A7C4886320F74AC5001F74C0 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.3;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
A7C4886520F74AC5001F74C0 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
HEADER_SEARCH_PATHS = mbedtls/include/;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A7C4886620F74AC5001F74C0 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
HEADER_SEARCH_PATHS = mbedtls/include/;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
A7C4885620F74AC5001F74C0 /* Build configuration list for PBXProject "clogan" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A7C4886220F74AC5001F74C0 /* Debug */,
|
||||
A7C4886320F74AC5001F74C0 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
A7C4886420F74AC5001F74C0 /* Build configuration list for PBXNativeTarget "clogan" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A7C4886520F74AC5001F74C0 /* Debug */,
|
||||
A7C4886620F74AC5001F74C0 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = A7C4885320F74AC5001F74C0 /* Project object */;
|
||||
}
|
||||
7
Logan/clogan.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
Logan/clogan.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:clogan.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user