separate structures in DSWaylandProtocolTracePrivate.h to DSWaylandProtocolTraceStruct.h 68/242768/1
authordyamy-lee <dyamy.lee@samsung.com>
Fri, 28 Aug 2020 04:23:25 +0000 (13:23 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Tue, 1 Sep 2020 01:29:29 +0000 (10:29 +0900)
Change-Id: I0f49469d9a5daaea37626043c7713fca19a3d91c

src/DSWaylandServer/DSWaylandProtocolTrace.h
src/DSWaylandServer/DSWaylandProtocolTracePrivate.h
src/DSWaylandServer/DSWaylandProtocolTraceStruct.h [new file with mode: 0644]
src/meson.build

index b53e999..59cbbf0 100644 (file)
@@ -51,7 +51,6 @@ private:
     static std::mutex __mutex;
     static DSWaylandProtocolTrace *__protocolTrace;
     static int __refCount;
-
 };
 
 }
index d387a9f..a64c0db 100644 (file)
 #define __DS_WAYLAND_PROTOCOL_TRACE_PRIVATE_H__
 
 #include "DSWaylandProtocolTrace.h"
-//#include "DSWaylandProtocolTraceStruct.h"
+#include "DSWaylandProtocolTraceStruct.h"
 #include <wayland-server.h>
 #include <wayland-server-core.h>
 #include <wayland-util.h>
 #include <cstring>
 
-#define PATH_MAX 512
-
-#ifndef MAX
-#define MAX(x, y) (((x) > (y)) ? (x) : (y))
-#endif
-
-#ifndef MIN
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#endif
-
-#define BUF_SNPRINTF(fmt, ARG...) do { \
-     str_l = snprintf(str_buff, str_r, fmt, ##ARG); \
-     str_buff += str_l; \
-     str_r -= str_l; \
-} while(0)
-
-
-/*
-#ifndef REPLY
-  #define REPLY(fmt, ARG...)  \
-     do { \
-          if (reply && len && *len > 0) \
-            { \
-               int s = snprintf(reply, *len, fmt, ##ARG); \
-               reply += s; \
-               *len -= s; \
-            } \
-       } while (0)
-#endif
-*/
-#define MAX_RULE 64
-#define STRING_MAX 64
 
 namespace display_server
 {
-typedef struct _ProtocolTrace_Tree_Node ProtocolTrace_Tree_Node;
-typedef struct _ProtocolTrace_Tree ProtocolTrace_Tree;
-typedef struct _ProtocolTrace_Token_Data ProtocolTrace_Token_Data;
-typedef struct _ProtocolTrace_Rule_Node ProtocolTrace_Rule_Node;
-typedef struct _ProtocolTrace_Rule ProtocolTrace_Rule;
-typedef struct _ProtocolTrace_Rule_Checker ProtocolTrace_Rule_Checker;
-typedef struct _ProtocolTrace_Protocol_Log ProtocolTrace_Protocol_Log;
-
-typedef int (*ProtocolTrace_Tree_Traverse_Cb) (ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg);
-
-struct _ProtocolTrace_Tree_Node
-{
-    ProtocolTrace_Tree_Node *left;
-    ProtocolTrace_Tree_Node *right;
-};
-
-struct _ProtocolTrace_Tree
-{
-    int size;
-    ProtocolTrace_Tree_Node *head;
-};
-
-typedef enum
-{
-    PROTOCOLTRACE_TOKEN_UNKNOWN = 0,
-    PROTOCOLTRACE_TOKEN_L_BR =1,
-    PROTOCOLTRACE_TOKEN_R_BR =2,
-    PROTOCOLTRACE_TOKEN_NOT_EQ=3,
-    PROTOCOLTRACE_TOKEN_EQUAL=4,
-    PROTOCOLTRACE_TOKEN_LSS_THAN=5,
-    PROTOCOLTRACE_TOKEN_LSS_EQ =6,
-    PROTOCOLTRACE_TOKEN_GRT_THAN=7,
-    PROTOCOLTRACE_TOKEN_GRT_EQ =8,
-    PROTOCOLTRACE_TOKEN_AND=9,
-    PROTOCOLTRACE_TOKEN_OR=10,
-    PROTOCOLTRACE_TOKEN_SPACE=11,
-    PROTOCOLTRACE_TOKEN_SYMBOL=12,
-    PROTOCOLTRACE_TOKEN_NUMBER=13,
-    PROTOCOLTRACE_TOKEN_EOS=14,
-} ProtocolTrace_Token;
-
-struct _ProtocolTrace_Token_Data
-{
-    const char **string;
-    ProtocolTrace_Token last_token;
-    const char *last_symbol;
-    int symbol_len;
-};
-typedef enum
-{
-    PROTOCOLTRACE_NODE_TYPE_NONE,
-    PROTOCOLTRACE_NODE_TYPE_AND,
-    PROTOCOLTRACE_NODE_TYPE_OR,
-    PROTOCOLTRACE_NODE_TYPE_DATA,
-    PROTOCOLTRACE_NODE_TYPE_ALL
-} ProtocolTrace_Node_Type;
-
-typedef enum
-{
-    PROTOCOLTRACE_COMPARER_EQUAL,
-    PROTOCOLTRACE_COMPARER_LESS,
-    PROTOCOLTRACE_COMPARER_GREATER,
-    PROTOCOLTRACE_COMPARER_LESS_EQ,
-    PROTOCOLTRACE_COMPARER_GREATE_EQ,
-    PROTOCOLTRACE_COMPARER_NOT_EQ
-} ProtocolTrace_Comparer;
-
-typedef enum
-{
-    PROTOCOLTRACE_DATA_TYPE_INTEGER,
-    PROTOCOLTRACE_DATA_TYPE_STRING
-} ProtocolTrace_Data_Type;
-
-typedef enum
-{
-    PROTOCOLTRACE_RESULT_UNKNOWN,
-    PROTOCOLTRACE_RESULT_TRUE,
-    PROTOCOLTRACE_RESULT_FALSE
-} ProtocolTrace_Result_Type;
-
-struct _ProtocolTrace_Rule_Node
-{
-    ProtocolTrace_Node_Type node_type;
-    char variable_name[STRING_MAX];
-    ProtocolTrace_Comparer comparer;
-    ProtocolTrace_Data_Type value_type;
-
-    union
-    {
-        char string[STRING_MAX];
-        int integer;
-    }value;
-
-    ProtocolTrace_Result_Type result;
-};
-
-typedef enum
-{
-    PROTOCOLTRACE_POLICY_TYPE_UNDEFINED,
-    PROTOCOLTRACE_TYPE_ALLOW,
-    PROTOCOLTRACE_TYPE_DENY
-} ProtocolTrace_Policy_Type;
-
-struct _ProtocolTrace_Rule
-{
-    ProtocolTrace_Policy_Type policy;
-    ProtocolTrace_Tree *tree;
-};
-
-struct _ProtocolTrace_Rule_Checker
-{
-    ProtocolTrace_Rule rules[MAX_RULE];
-    int count;
-};
-typedef enum
-{
-    PROTOCOLTRACE_RULE_SET_OK,
-    PROTOCOLTRACE_RULE_SET_ERR_TOO_MANY_RULES,
-    PROTOCOLTRACE_RULE_SET_ERR_PARSE,
-    PROTOCOLTRACE_RULE_SET_ERR_NO_RULE
- } ProtocolTrace_Rule_Set_Result;
-typedef enum{
-    PROTOCOL_TYPE_REQUEST,
-    PROTOCOL_TYPE_EVENT
-} ProtocolTrace_Protocol_Type;
-struct _ProtocolTrace_Protocol_Log
-{
-    ProtocolTrace_Protocol_Type type;
-    int client_pid;
-    int target_id;
-    char name[PATH_MAX +1];
-    char cmd[PATH_MAX +1];
-};
-struct argument_details {
-      char type;
-      int nullable;
-};
-
-typedef struct
-{
-    int type;
-    int target_id;
-    const char *name;
-    int pid;
-    const char *cmd;
-} ProtocolTrace_Validate_Args;
-
-typedef struct
-{
-    char **reply;
-    int *len;
-} ProtocolTrace_Reply_Buffer;
-
 class DSWaylandProtocolTracePrivate : public DSObjectPrivate
 {
 DS_PIMPL_USE_PUBLIC(DSWaylandProtocolTrace);
diff --git a/src/DSWaylandServer/DSWaylandProtocolTraceStruct.h b/src/DSWaylandServer/DSWaylandProtocolTraceStruct.h
new file mode 100644 (file)
index 0000000..a1129cd
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* 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 (including the next
+* paragraph) 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 __DS_WAYLAND_PROTOCOL_TRACE_STRUCT_H__
+#define __DS_WAYLAND_PROTOCOL_TRACE_STRUCT_H__
+
+#define PATH_MAX 512
+#define MAX_RULE 64
+#define STRING_MAX 64
+
+#ifndef MAX
+#define MAX(x, y) (((x) > (y)) ? (x) : (y))
+#endif
+
+#ifndef MIN
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#endif
+
+#define BUF_SNPRINTF(fmt, ARG...) do { \
+     str_l = snprintf(str_buff, str_r, fmt, ##ARG); \
+     str_buff += str_l; \
+     str_r -= str_l; \
+} while(0)
+
+/*
+#ifndef REPLY
+  #define REPLY(fmt, ARG...)  \
+     do { \
+          if (reply && len && *len > 0) \
+            { \
+               int s = snprintf(reply, *len, fmt, ##ARG); \
+               reply += s; \
+               *len -= s; \
+            } \
+       } while (0)
+#endif
+*/
+
+namespace display_server
+{
+
+typedef struct _ProtocolTrace_Tree_Node ProtocolTrace_Tree_Node;
+typedef struct _ProtocolTrace_Tree ProtocolTrace_Tree;
+typedef struct _ProtocolTrace_Token_Data ProtocolTrace_Token_Data;
+typedef struct _ProtocolTrace_Rule_Node ProtocolTrace_Rule_Node;
+typedef struct _ProtocolTrace_Rule ProtocolTrace_Rule;
+typedef struct _ProtocolTrace_Rule_Checker ProtocolTrace_Rule_Checker;
+typedef struct _ProtocolTrace_Protocol_Log ProtocolTrace_Protocol_Log;
+
+typedef int (*ProtocolTrace_Tree_Traverse_Cb) (ProtocolTrace_Tree *tree, ProtocolTrace_Tree_Node *node, ProtocolTrace_Tree_Node *parent, void *arg);
+
+struct _ProtocolTrace_Tree_Node
+{
+    ProtocolTrace_Tree_Node *left;
+    ProtocolTrace_Tree_Node *right;
+};
+
+struct _ProtocolTrace_Tree
+{
+    int size;
+    ProtocolTrace_Tree_Node *head;
+};
+
+typedef enum
+{
+    PROTOCOLTRACE_TOKEN_UNKNOWN = 0,
+    PROTOCOLTRACE_TOKEN_L_BR =1,
+    PROTOCOLTRACE_TOKEN_R_BR =2,
+    PROTOCOLTRACE_TOKEN_NOT_EQ=3,
+    PROTOCOLTRACE_TOKEN_EQUAL=4,
+    PROTOCOLTRACE_TOKEN_LSS_THAN=5,
+    PROTOCOLTRACE_TOKEN_LSS_EQ =6,
+    PROTOCOLTRACE_TOKEN_GRT_THAN=7,
+    PROTOCOLTRACE_TOKEN_GRT_EQ =8,
+    PROTOCOLTRACE_TOKEN_AND=9,
+    PROTOCOLTRACE_TOKEN_OR=10,
+    PROTOCOLTRACE_TOKEN_SPACE=11,
+    PROTOCOLTRACE_TOKEN_SYMBOL=12,
+    PROTOCOLTRACE_TOKEN_NUMBER=13,
+    PROTOCOLTRACE_TOKEN_EOS=14,
+} ProtocolTrace_Token;
+
+struct _ProtocolTrace_Token_Data
+{
+    const char **string;
+    ProtocolTrace_Token last_token;
+    const char *last_symbol;
+    int symbol_len;
+};
+typedef enum
+{
+    PROTOCOLTRACE_NODE_TYPE_NONE,
+    PROTOCOLTRACE_NODE_TYPE_AND,
+    PROTOCOLTRACE_NODE_TYPE_OR,
+    PROTOCOLTRACE_NODE_TYPE_DATA,
+    PROTOCOLTRACE_NODE_TYPE_ALL
+} ProtocolTrace_Node_Type;
+
+typedef enum
+{
+    PROTOCOLTRACE_COMPARER_EQUAL,
+    PROTOCOLTRACE_COMPARER_LESS,
+    PROTOCOLTRACE_COMPARER_GREATER,
+    PROTOCOLTRACE_COMPARER_LESS_EQ,
+    PROTOCOLTRACE_COMPARER_GREATE_EQ,
+    PROTOCOLTRACE_COMPARER_NOT_EQ
+} ProtocolTrace_Comparer;
+
+typedef enum
+{
+    PROTOCOLTRACE_DATA_TYPE_INTEGER,
+    PROTOCOLTRACE_DATA_TYPE_STRING
+} ProtocolTrace_Data_Type;
+
+typedef enum
+{
+    PROTOCOLTRACE_RESULT_UNKNOWN,
+    PROTOCOLTRACE_RESULT_TRUE,
+    PROTOCOLTRACE_RESULT_FALSE
+} ProtocolTrace_Result_Type;
+
+struct _ProtocolTrace_Rule_Node
+{
+    ProtocolTrace_Node_Type node_type;
+    char variable_name[STRING_MAX];
+    ProtocolTrace_Comparer comparer;
+    ProtocolTrace_Data_Type value_type;
+
+    union
+    {
+        char string[STRING_MAX];
+        int integer;
+    }value;
+
+    ProtocolTrace_Result_Type result;
+};
+
+typedef enum
+{
+    PROTOCOLTRACE_POLICY_TYPE_UNDEFINED,
+    PROTOCOLTRACE_TYPE_ALLOW,
+    PROTOCOLTRACE_TYPE_DENY
+} ProtocolTrace_Policy_Type;
+
+struct _ProtocolTrace_Rule
+{
+    ProtocolTrace_Policy_Type policy;
+    ProtocolTrace_Tree *tree;
+};
+
+struct _ProtocolTrace_Rule_Checker
+{
+    ProtocolTrace_Rule rules[MAX_RULE];
+    int count;
+};
+typedef enum
+{
+    PROTOCOLTRACE_RULE_SET_OK,
+    PROTOCOLTRACE_RULE_SET_ERR_TOO_MANY_RULES,
+    PROTOCOLTRACE_RULE_SET_ERR_PARSE,
+    PROTOCOLTRACE_RULE_SET_ERR_NO_RULE
+ } ProtocolTrace_Rule_Set_Result;
+typedef enum{
+    PROTOCOL_TYPE_REQUEST,
+    PROTOCOL_TYPE_EVENT
+} ProtocolTrace_Protocol_Type;
+struct _ProtocolTrace_Protocol_Log
+{
+    ProtocolTrace_Protocol_Type type;
+    int client_pid;
+    int target_id;
+    char name[PATH_MAX +1];
+    char cmd[PATH_MAX +1];
+};
+struct argument_details {
+      char type;
+      int nullable;
+};
+
+typedef struct
+{
+    int type;
+    int target_id;
+    const char *name;
+    int pid;
+    const char *cmd;
+} ProtocolTrace_Validate_Args;
+
+typedef struct
+{
+    char **reply;
+    int *len;
+} ProtocolTrace_Reply_Buffer;
+
+}
+
+
+#endif //__DS_WAYLAND_PROTOCOL_TRACE_STRUCT_H__
\ No newline at end of file
index ea39c2c..62c7b30 100644 (file)
@@ -177,13 +177,14 @@ libds_wayland_srcs = [
        'DSWaylandServer/DSWaylandTizenLaunchSplash.h',
        'DSWaylandServer/DSWaylandTizenLaunchSplash.cpp',
        'DSWaylandServer/DSWaylandProtocolTracePrivate.h',
+       'DSWaylandServer/DSWaylandProtocolTraceStruct.h',
        'DSWaylandServer/DSWaylandProtocolTrace.h',
        'DSWaylandServer/DSWaylandProtocolTrace.cpp',
        'DSWaylandServer/DSWaylandTizenPolicyExt.h',
        'DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h',
        'DSWaylandServer/DSWaylandTizenPolicyExt.cpp',
        'DSWaylandServer/tizen_policy_ext-server-protocol.h',
-       'DSWaylandServer/tizen_policy_ext-protocol.c',
+       'DSWaylandServer/tizen_policy_ext-protocol.c',  
        ]
 
 libds_srcs += libds_wayland_srcs