Merge branch 'tizen_2.4_merge' into tizen
[sdk/target/sdbd.git] / src / sdb.h
index da25ab1..9cef525 100644 (file)
--- a/src/sdb.h
+++ b/src/sdb.h
 
 #include <limits.h>
 #include <stdlib.h>
+#include <stddef.h>
 
 #include "transport.h"  /* readx(), writex() */
 #include "fdevent.h"
+#include "sdbd_plugin.h"
 #if !SDB_HOST
 #include "commandline_sdbd.h"
 #endif
 #define A_OKAY 0x59414b4f
 #define A_CLSE 0x45534c43
 #define A_WRTE 0x45545257
+#define A_STAT 0x54415453
 
-#define A_VERSION 0x01000000        // SDB protocol version
+#define A_VERSION 0x02000000        // SDB protocol version
 
 #define SDB_VERSION_MAJOR 2         // Used for help/version information
-#define SDB_VERSION_MINOR 1         // Used for help/version information
+#define SDB_VERSION_MINOR 2         // Used for help/version information
+#define SDB_VERSION_PATCH 31        // Used for help/version information
 
 #define SDB_SERVER_VERSION 0        // Increment this when we want to force users to start a new sdb server
 
@@ -92,11 +96,6 @@ struct asocket {
         */
     int    closing;
 
-        /* flag: quit adbd when both ends close the
-        ** local service socket
-        */
-    int    exit_on_close;
-
         /* the asocket we are connected to
         */
 
@@ -228,16 +227,54 @@ struct alistener
     adisconnect  disconnect;
 };
 
-#define SDBD_CAP_RET_ENABLED  "enabled"
-#define SDBD_CAP_RET_DISABLED "disabled"
+#define UNKNOWN "unknown"
+#define INFOBUF_MAXLEN 64
+#define INFO_VERSION "2.2.0"
+typedef struct platform_info {
+    char platform_info_version[INFOBUF_MAXLEN];
+    char model_name[INFOBUF_MAXLEN]; // Emulator
+    char platform_name[INFOBUF_MAXLEN]; // Tizen
+    char platform_version[INFOBUF_MAXLEN]; // 2.2.1
+    char profile_name[INFOBUF_MAXLEN]; // 2.2.1
+} pinfo;
+
+#define ENABLED "enabled"
+#define DISABLED "disabled"
+#define CPUARCH_ARMV6 "armv6"
+#define CPUARCH_ARMV7 "armv7"
+#define CPUARCH_X86 "x86"
+#define CAPBUF_SIZE 4096
 #define CAPBUF_ITEMSIZE 32
 typedef struct platform_capabilities
 {
-       char usbproto_support[CAPBUF_ITEMSIZE];     // enabled or disabled
-       char sockproto_support[CAPBUF_ITEMSIZE];    // enabled or disabled
+    char secure_protocol[CAPBUF_ITEMSIZE];      // enabled or disabled
+    char intershell_support[CAPBUF_ITEMSIZE];   // enabled or disabled
+    char filesync_support[CAPBUF_ITEMSIZE];     // push or pull or pushpull or disabled
+    char rootonoff_support[CAPBUF_ITEMSIZE];    // enabled or disabled
+    char zone_support[CAPBUF_ITEMSIZE];         // enabled or disabled
+    char multiuser_support[CAPBUF_ITEMSIZE];    // enabled or disabled
+    char syncwinsz_support[CAPBUF_ITEMSIZE];    // enabled or disabled
+    char usbproto_support[CAPBUF_ITEMSIZE];     // enabled or disabled
+    char sockproto_support[CAPBUF_ITEMSIZE];    // enabled or disabled
+
+    char cpu_arch[CAPBUF_ITEMSIZE];             // cpu architecture (ex. x86)
+    char profile_name[CAPBUF_ITEMSIZE];         // profile name (ex. mobile)
+    char vendor_name[CAPBUF_ITEMSIZE];          // vendor name (ex. Tizen)
+
+    char platform_version[CAPBUF_ITEMSIZE];     // platform version (ex. 2.3.0)
+    char product_version[CAPBUF_ITEMSIZE];      // product version (ex. 1.0)
+    char sdbd_version[CAPBUF_ITEMSIZE];         // sdbd version
+    char sdbd_plugin_version[CAPBUF_ITEMSIZE];  // sdbd plugin version
 } pcap;
 pcap g_capabilities;
 
+#define SDBD_PLUGIN_PATH    "/usr/lib/libsdbd_plugin.so"
+#define SDBD_PLUGIN_INTF    "sdbd_plugin_cmd_proc"
+typedef int (*SDBD_PLUGIN_CMD_PROC_PTR)(const char*, const char*, sdbd_plugin_param);
+extern SDBD_PLUGIN_CMD_PROC_PTR sdbd_plugin_cmd_proc;
+int request_plugin_cmd(const char* cmd, const char* in_buf, char *out_buf, unsigned int out_len);
+int request_plugin_verification(const char* cmd, const char* in_buf);
+
 void print_packet(const char *label, apacket *p);
 
 asocket *find_local_socket(unsigned id);
@@ -271,6 +308,7 @@ int sdb_main(int is_daemon, int server_port);
 void init_transport_registration(void);
 int  list_transports(char *buf, size_t  bufsize);
 void update_transports(void);
+void broadcast_transport(apacket *p);
 
 asocket*  create_device_tracker(void);
 
@@ -335,7 +373,8 @@ void log_service(int fd, void *cookie);
 void remount_service(int fd, void *cookie);
 char * get_log_file_path(const char * log_name);
 
-int rootshell_mode;// 0: developer, 1: root
+int rootshell_mode; // 0: developer, 1: root
+int booting_done; // 0: platform booting is in progess 1: platform booting is done
 
 // This is the users and groups config for the platform
 
@@ -350,6 +389,7 @@ int rootshell_mode;// 0: developer, 1: root
 
 #endif
 
+int is_pwlocked(void);
 int should_drop_privileges(void);
 int set_developer_privileges();
 void set_root_privileges();
@@ -357,6 +397,9 @@ void set_root_privileges();
 int get_emulator_forward_port(void);
 int get_emulator_name(char str[], int str_size);
 int get_device_name(char str[], int str_size);
+int get_emulator_hostip(char str[], int str_size);
+int get_emulator_guestip(char str[], int str_size);
+
 /* packet allocator */
 apacket *get_apacket(void);
 void put_apacket(apacket *p);
@@ -500,7 +543,7 @@ void ffs_usb_kick(usb_handle *h);
 void linux_usb_init();
 void linux_usb_cleanup();
 int linux_usb_write(usb_handle *h, const void *data, int len);
-int linux_usb_read(usb_handle *h, void *data, int len);
+int linux_usb_read(usb_handle *h, void *data, unsigned len);
 int linux_usb_close(usb_handle *h);
 void linux_usb_kick(usb_handle *h);
 
@@ -524,6 +567,7 @@ int connection_state(atransport *t);
 #define CS_RECOVERY   4
 #define CS_NOPERM     5 /* Insufficient permissions to communicate with the device */
 #define CS_SIDELOAD   6
+#define CS_PWLOCK     10
 
 extern int HOST;
 extern int SHELL_EXIT_NOTIFY_FD;
@@ -535,6 +579,7 @@ extern SdbdCommandlineArgs sdbd_commandline_args;
 
 int sendfailmsg(int fd, const char *reason);
 int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s);
+int copy_packet(apacket* dest, apacket* src);
 
 int is_emulator(void);
 #define DEFAULT_DEVICENAME "unknown"