[mynewt-mcumgr] 17/42: log_mgmt command handler group.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git

commit 2622b41bfc82f66e89b5faea8abfb34959c3c86d
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:52:28 2018 -0800

log_mgmt command handler group.
---
 cmd/CMakeLists.txt |   1 +
 cmd/Kconfig|   1 +
 cmd/log_mgmt/CMakeLists.txt|   9 +
 cmd/log_mgmt/Kconfig   |  53 +++
 cmd/log_mgmt/include/log_mgmt/log_mgmt.h   |  83 +
 cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h  |  48 +++
 cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c | 206 +++
 cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c | 189 ++
 cmd/log_mgmt/src/log_mgmt.c| 494 +
 cmd/log_mgmt/src/log_mgmt_config.h |  45 +++
 cmd/log_mgmt/src/stubs.c   |  65 
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c   |   2 +
 12 files changed, 1196 insertions(+)

diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
index bc91e2f..be26ded 100644
--- a/cmd/CMakeLists.txt
+++ b/cmd/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_FS_MGMT   fs_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_IMG_MGMT  img_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_LOG_MGMT  log_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_OS_MGMT   os_mgmt)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index a0e2031..ea51804 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -19,6 +19,7 @@ menu "Command handlers"
 
 source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
 source "ext/mcumgr/cmd/img_mgmt/Kconfig"
+source "ext/mcumgr/cmd/log_mgmt/Kconfig"
 source "ext/mcumgr/cmd/os_mgmt/Kconfig"
 
 endmenu
diff --git a/cmd/log_mgmt/CMakeLists.txt b/cmd/log_mgmt/CMakeLists.txt
new file mode 100644
index 000..7d72dcd
--- /dev/null
+++ b/cmd/log_mgmt/CMakeLists.txt
@@ -0,0 +1,9 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
+cmd/log_mgmt/src/log_mgmt.c
+cmd/log_mgmt/src/stubs.c
+)
diff --git a/cmd/log_mgmt/Kconfig b/cmd/log_mgmt/Kconfig
new file mode 100644
index 000..e949aa6
--- /dev/null
+++ b/cmd/log_mgmt/Kconfig
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE log
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this log
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this log except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# Under the License.
+
+menuconfig MCUMGR_CMD_LOG_MGMT
+bool
+prompt "Enable mcumgr handlers for log management"
+default n
+help
+  Enables mcumgr handlers for log management
+
+if MCUMGR_CMD_LOG_MGMT
+config LOG_MGMT_CHUNK_SIZE
+int
+prompt "Maximum chunk size for log downloads"
+default 512
+help
+  Limits the maximum chunk size in log downloads.  A buffer of this size
+  gets allocated on the stack during handling of the log show command.
+
+config LOG_MGMT_NAME_LEN
+int
+prompt "Maximum log name length"
+default 64
+help
+  Limits the maximum length of log names.  If a log's name length exceeds
+  this number, it gets truncated in management responses.  A buffer of this
+  size gets allocated on the stack during handling of all log management
+  commands.
+
+config LOG_MGMT_BODY_LEN
+int
+prompt "Maximum log body length"
+default 128
+help
+  Limits the maximum length of log entry bodies.  If a log entry's body
+  length exceeds this number, it gets truncated in management responses.  A
+  buffer of this size gets allocated on the stack during handling of the
+  log show command.
+endif
diff --git a/cmd/log_mgmt/include/log_mgmt/log_mgmt.h 
b/cmd/log_mgmt/include/log_mgmt/log_mgmt.h
new file mode 100644
index 000..01df2e5
--- /dev/null
+++ b/cmd/log_mgmt/include/log_mgmt/log_mgmt.h
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the 

[mynewt-mcumgr] 17/42: log_mgmt command handler group.

2018-02-12 Thread ccollins
This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git

commit afdb0474da89b2cb8b59ddff6be404ba3484745b
Author: Christopher Collins 
AuthorDate: Fri Jan 26 15:52:28 2018 -0800

log_mgmt command handler group.
---
 cmd/CMakeLists.txt |   1 +
 cmd/Kconfig|   1 +
 cmd/log_mgmt/CMakeLists.txt|   9 +
 cmd/log_mgmt/Kconfig   |  53 +++
 cmd/log_mgmt/include/log_mgmt/log_mgmt.h   |  83 +
 cmd/log_mgmt/include/log_mgmt/log_mgmt_impl.h  |  48 +++
 cmd/log_mgmt/port/mynewt/src/mynewt_log_mgmt.c | 206 +++
 cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c | 189 ++
 cmd/log_mgmt/src/log_mgmt.c| 494 +
 cmd/log_mgmt/src/log_mgmt_config.h |  45 +++
 cmd/log_mgmt/src/stubs.c   |  65 
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c   |   2 +
 12 files changed, 1196 insertions(+)

diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
index bc91e2f..be26ded 100644
--- a/cmd/CMakeLists.txt
+++ b/cmd/CMakeLists.txt
@@ -1,3 +1,4 @@
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_FS_MGMT   fs_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_IMG_MGMT  img_mgmt)
+add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_LOG_MGMT  log_mgmt)
 add_subdirectory_ifdef(CONFIG_MCUMGR_CMD_OS_MGMT   os_mgmt)
diff --git a/cmd/Kconfig b/cmd/Kconfig
index a0e2031..ea51804 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -19,6 +19,7 @@ menu "Command handlers"
 
 source "ext/mcumgr/cmd/fs_mgmt/Kconfig"
 source "ext/mcumgr/cmd/img_mgmt/Kconfig"
+source "ext/mcumgr/cmd/log_mgmt/Kconfig"
 source "ext/mcumgr/cmd/os_mgmt/Kconfig"
 
 endmenu
diff --git a/cmd/log_mgmt/CMakeLists.txt b/cmd/log_mgmt/CMakeLists.txt
new file mode 100644
index 000..7d72dcd
--- /dev/null
+++ b/cmd/log_mgmt/CMakeLists.txt
@@ -0,0 +1,9 @@
+target_include_directories(MCUMGR INTERFACE 
+include
+)
+
+zephyr_library_sources(
+cmd/log_mgmt/port/zephyr/src/zephyr_log_mgmt.c
+cmd/log_mgmt/src/log_mgmt.c
+cmd/log_mgmt/src/stubs.c
+)
diff --git a/cmd/log_mgmt/Kconfig b/cmd/log_mgmt/Kconfig
new file mode 100644
index 000..e949aa6
--- /dev/null
+++ b/cmd/log_mgmt/Kconfig
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE log
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this log
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this log except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# Under the License.
+
+menuconfig MCUMGR_CMD_LOG_MGMT
+bool
+prompt "Enable mcumgr handlers for log management"
+default n
+help
+  Enables mcumgr handlers for log management
+
+if MCUMGR_CMD_LOG_MGMT
+config LOG_MGMT_CHUNK_SIZE
+int
+prompt "Maximum chunk size for log downloads"
+default 512
+help
+  Limits the maximum chunk size in log downloads.  A buffer of this size
+  gets allocated on the stack during handling of the log show command.
+
+config LOG_MGMT_NAME_LEN
+int
+prompt "Maximum log name length"
+default 64
+help
+  Limits the maximum length of log names.  If a log's name length exceeds
+  this number, it gets truncated in management responses.  A buffer of this
+  size gets allocated on the stack during handling of all log management
+  commands.
+
+config LOG_MGMT_BODY_LEN
+int
+prompt "Maximum log body length"
+default 128
+help
+  Limits the maximum length of log entry bodies.  If a log entry's body
+  length exceeds this number, it gets truncated in management responses.  A
+  buffer of this size gets allocated on the stack during handling of the
+  log show command.
+endif
diff --git a/cmd/log_mgmt/include/log_mgmt/log_mgmt.h 
b/cmd/log_mgmt/include/log_mgmt/log_mgmt.h
new file mode 100644
index 000..01df2e5
--- /dev/null
+++ b/cmd/log_mgmt/include/log_mgmt/log_mgmt.h
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the