Kissdx develop manual: Admin GET CONFIG

From Kissdx-wiki

Jump to: navigation, search

Home  : Home > Kissdx REFERENCE Manual >

Contents

Feature #51 kissdx remote administration - view config feature

This feature is requested : http://www.vidartysse.net/BUGS/view_bug.php?bug_id=51 New command-line options for managing a running kissdx server from the same computer, or even from a remote host. Management functions include

   * STOP = Stop kissdx at the enf of current file playback
   * FORCESTOP = Stop kissdx whatever any streaming occurs
   * RELOAD_CONFIG = re-read the configuration file to pick up changes.
   * GET_TXT_CONFIG =  Get current configuration loaded in memory

Context

The context is a running system on which, you just connect. What config file has been used ? what directory is currently streamed ?

Using a 'ps -aux|grep kiss' does not give an 100% sure information, because a local modification of kissdx.conf may have occured since last usage.

kissdx looks at startup a set of config file. How to know if kissd.conf or kissdx.conf has been used ?

Expectation

Using another instance of kissdx to send a "GET_TXT_CONFIG" message.
kissdx server receiving this command should answer with a set of "Text" oriented information.
Future feature may be "GET_KML_CONFIG" to return a KML orientied information.

Code analysis

config.c already contains a function to display config at startup time in console mode.

void show_current_config_Verbose(const config_settings_t *config_p)

The objective is to display content of *config pointer.

First step is to duplicate the section of 30 lines of log() to be send_config()

cons: double maintenance effort
ex: log("kissdx %s is now using the following config:", KISSD_VERSION);

Second step may be a function returning an XML flow and a function to render it according text, html,kml ... kissdx release incorporating libxml2 may help managing this orientation

LIST_VIDEO for kissdx in client mode

During development, it become mandatory to create a simulator to avoid the usage of KiSS player (already in use by my kids) A new administration command : LIST_VIDEO send a PCLINK-TCP:8000 command LIST VIDEO and display the result

olivier@ubuntudev:~/eclipse/workspace2/kissdx$ ./kissdx -s LIST_VIDEO -m 10.39.10.1
Admin command requested   : LIST_VIDEO
kissdx Administration Client with command [LIST_VIDEO][10]
LIST_VIDEO= [Déja joué|Déja joué|1|]
LIST_VIDEO= [{kissdx-DIR}_local_dvdrom|{kissdx-DIR}_local_dvdrom|1|]
LIST_VIDEO= [DVD_Image|DVD_Image|1|]
LIST_VIDEO= [home_linux|home_linux|1|]
LIST_VIDEO= [Qmultimedia|Qmultimedia|1|]
LIST_VIDEO= [test|test|1|]
LIST_VIDEO= [win_dvdrip|win_dvdrip|1|]
LIST_VIDEO= [Indestructible.mac.xvid.divx.avi|/home/olivier/Shared_Kiss/Video/Indestructible.mac.xvid.divx.avi|0|]
LIST_VIDEO= [Madonna_HungUp.mpg|/home/olivier/Shared_Kiss/Video/Madonna_HungUp.mpg|0|]
LIST_VIDEO= [EOL]

GET_TXT_CONFIG : kissdx admin command

kissdx client mode ===> PCLINK://IP:8008 "GET_TXT_CONFIG ||\n"
kissdx.c: main()        parse command line, detect Send options with GET_TXT_CONFIG
=> cmdclient.c: get_txt_config()             * Specific behaviour is : send string and print response
 ==> cmdclient.c: deliver_tcp_cmd()            -Generic function sending 'only' a string and return the socket created
 while !eof(?) print result of read(socket)    -print response
kissdx.h: which constant definition ?  

kissdx server mode ===> PCLINK://IP      "Text structured content of 'config' object"
kissdx.c: dodaemon()                         * Accept ADMCMD request GET_TXT_CONFIG
=> cmdserver.c: handle_admin_command_gettxtconfig()
 ==> cmdserver.c: send_txt_config()            -Create a text view of C structure 'config' 
  ===> connection.c: send_converted_line()     -Insert a ending "\n" (0x0A ?) and translate if needed
TODO : Each config line should be structured as PCLINK LIST_VIDEO response are


Synopsis of PCLINK protocol

Kiss Player   => PcLink Server (request ) : "Param1|Param2|Param3|\n"
PcLink Server => Kiss Player   (response) : "Param1|Param2|Param3|\n"
Sample
PcLink request  : "LIST VIDEO ||\n\r\n\r"
PcLink response : "Movie.avi| /VIDEO/Movie.avi|0|\nEOL\n"
LIST VIDEO - Request
Root listing request         = "LIST VIDEO ||\n"
Subdirectory listing request = "LIST VIDEO |home_linux/eclipse/workspace2|\n"

LIST VIDEO - Response same for "LIST PICTURE" or "LIST AUDIO"
An end user movie (last entry in a tree)  = Movie.avi|/home/media/video/Movie.avi|0|\n
A directory browsable                     = kids_video|kids_video|1|\n
Others
ACTION 2 /home/media/image/Hidden feature.jpg|\n
=> 200
SIZE /home/media/image/Hidden feature.jpg|\n
=> 000000000033898
GET /home/media/image/picture.jpg| 0 4096 |oqmzybpxxxxx|\n
GET /home/media/image/picture.jpg| 12288 4096 |oqmzybpxxxxx|\n
GET fullpath| start_position size_to_send|playerId|\n
=> Read 71 bytes
Admin command GET_TXT_CONFIG protocol
Global   config request    = "GET_TXT_CONFIG ||\n"
Specific config request    = "GET_TXT_CONFIG |configuration_parameter_name|\n"
- 
Global   config response   = (multiple line) of specific response
Specific config response   = Parameter_name|parameter_value_inTxtFormat|comment|\n"

System Trace [KiSS player] <=> [kissdx] (Wireshark trace)

  • => ARE_YOU_KISS_PCLINK_SERVER? => (UDP:8000)
0020   .. .. .. .. .. .. .. .. .. .. 41 52 45 5f 59 4f  .....@.#..ARE_YO
0030   55 5f 4b 49 53 53 5f 50 43 4c 49 4e 4b 5f 53 45  U_KISS_PCLINK_SE
0040   52 56 45 52 3f                                   RVER?
  • <= Hostname and kissdx version
0020   .. .. .. .. .. .. .. .. .. .. 75 62 75 6e 74 75  ...@...;..ubuntu
0030   64 65 76 2e 68 6f 6d 65 2e 66 72 20 2d 20 6b 69  dev.home.fr - ki
0040   73 73 64 78 20 76 30 2e 31 33 2d 78 78 2c 32 30  ssdx v0.13-xx,20
0050   30 37 2d 30 33 2d 78 78 20 28 4f 4b 29           07-03-xx (OK)
  • => LIST VIDEO || (17 bytes TCP)
0040   .. .. 4c 49 53 54 20 56 49 44 45 4f 20 7c 7c 0d  ..LIST VIDEO ||.
0050   0a 0d 0a                                         ...
  • <= Directory listing
Déja joué (recently used) (27 bytes TCP)
0040   .. .. 44 c3 a9 6a 61 20 6a 6f 75 c3 a9 7c 44 c3  ,.D..ja jou..|D.
0050   a9 6a 61 20 6a 6f 75 c3 a9 7c 31 7c 0a           .ja jou..|1|.

Directory first entry (55 bytes TCP)
0040   .. .. 7b 6b 69 73 73 64 78 2d 44 49 52 7d 5f 6c  ,.{kissdx-DIR}_l
0050   6f 63 61 6c 5f 64 76 64 72 6f 6d 7c 7b 6b 69 73  ocal_dvdrom|{kis
0060   73 64 78 2d 44 49 52 7d 5f 6c 6f 63 61 6c 5f 64  sdx-DIR}_local_d
0070   76 64 72 6f 6d 7c 31 7c 0a                       vdrom|1|.
... 
Two before last entry ...(27 bytes TCP)
0040   .. .. 51 6d 75 6c 74 69 6d 65 64 69 61 7c 51 6d  ,.Qmultimedia|Qm
0050   75 6c 74 69 6d 65 64 69 61 7c 31 7c 0a           ultimedia|1|.

One before last entry ...(25 bytes TCP)
0040   .. .. 77 69 6e 5f 64 76 64 72 69 70 7c 77 69 6e  ,.win_dvdrip|win
0050   5f 64 76 64 72 69 70 7c 31 7c 0a                 _dvdrip|1|.
Directory last entry (178 bytes TCP)
0040   .. .. 49 6e 64 65 73 74 72 75 63 74 69 62 6c 65  ,.Indestructible
0050   2e 6d 61 63 2e 78 76 69 64 2e 64 69 76 78 2e 61  .mac.xvid.divx.a
0060   76 69 7c 2f 68 6f 6d 65 2f 6f 6c 69 76 69 65 72  vi|/home/olivier
0070   2f 53 68 61 72 65 64 5f 4b 69 73 73 2f 56 69 64  /Shared_Kiss/Vid
0080   65 6f 2f 49 6e 64 65 73 74 72 75 63 74 69 62 6c  eo/Indestructibl
0090   65 2e 6d 61 63 2e 78 76 69 64 2e 64 69 76 78 2e  e.mac.xvid.divx.
00a0   61 76 69 7c 30 7c 0a 4d 61 64 6f 6e 6e 61 5f 48  avi|0|.Madonna_H
00b0   75 6e 67 55 70 2e 6d 70 67 7c 2f 68 6f 6d 65 2f  ungUp.mpg|/home/
00c0   6f 6c 69 76 69 65 72 2f 53 68 61 72 65 64 5f 4b  olivier/Shared_K
00d0   69 73 73 2f 56 69 64 65 6f 2f 4d 61 64 6f 6e 6e  iss/Video/Madonn
00e0   61 5f 48 75 6e 67 55 70 2e 6d 70 67 7c 30 7c 0a  a_HungUp.mpg|0|.
00f0   45 4f 4c 0a                                      EOL.

Close connection exchange (ACK-FIN)
* Full conversation (ASCII)
LIST VIDEO ||

D..ja jou..|D..ja jou..|1|
{kissdx-DIR}_local_dvdrom|{kissdx-DIR}_local_dvdrom|1|
DVD_Image|DVD_Image|1|
home_linux|home_linux|1|
Qmultimedia|Qmultimedia|1|
test|test|1|
win_dvdrip|win_dvdrip|1|
Indestructible.mac.xvid.divx.avi|/home/olivier/Shared_Kiss/Video/Indestructible.mac.xvid.divx.avi|0|
Madonna_HungUp.mpg|/home/olivier/Shared_Kiss/Video/Madonna_HungUp.mpg|0|
EOL
* Full conversation (HEX)
00000000  4c 49 53 54 20 56 49 44  45 4f 20 7c 7c 0d 0a 0d LIST VID EO ||...
00000010  0a                                               .
00000000  44 c3 a9 6a 61 20 6a 6f  75 c3 a9 7c 44 c3 a9 6a D..ja jo u..|D..j
00000010  61 20 6a 6f 75 c3 a9 7c  31 7c 0a                a jou..| 1|.
0000001B  7b 6b 69 73 73 64 78 2d  44 49 52 7d 5f 6c 6f 63 {kissdx- DIR}_loc
0000002B  61 6c 5f 64 76 64 72 6f  6d 7c 7b 6b 69 73 73 64 al_dvdro m|{kissd
0000003B  78 2d 44 49 52 7d 5f 6c  6f 63 61 6c 5f 64 76 64 x-DIR}_l ocal_dvd
0000004B  72 6f 6d 7c 31 7c 0a                             rom|1|.
00000052  44 56 44 5f 49 6d 61 67  65 7c 44 56 44 5f 49 6d DVD_Imag e|DVD_Im
00000062  61 67 65 7c 31 7c 0a                             age|1|.
00000069  68 6f 6d 65 5f 6c 69 6e  75 78 7c 68 6f 6d 65 5f home_lin ux|home_
00000079  6c 69 6e 75 78 7c 31 7c  0a                      linux|1| .
00000082  51 6d 75 6c 74 69 6d 65  64 69 61 7c 51 6d 75 6c Qmultime dia|Qmul
00000092  74 69 6d 65 64 69 61 7c  31 7c 0a                timedia| 1|.
0000009D  74 65 73 74 7c 74 65 73  74 7c 31 7c 0a          test|tes t|1|.
000000AA  77 69 6e 5f 64 76 64 72  69 70 7c 77 69 6e 5f 64 win_dvdr ip|win_d
000000BA  76 64 72 69 70 7c 31 7c  0a                      vdrip|1| .
000000C3  49 6e 64 65 73 74 72 75  63 74 69 62 6c 65 2e 6d Indestru ctible.m
000000D3  61 63 2e 78 76 69 64 2e  64 69 76 78 2e 61 76 69 ac.xvid. divx.avi
000000E3  7c 2f 68 6f 6d 65 2f 6f  6c 69 76 69 65 72 2f 53 |/home/o livier/S
000000F3  68 61 72 65 64 5f 4b 69  73 73 2f 56 69 64 65 6f hared_Ki ss/Video
00000103  2f 49 6e 64 65 73 74 72  75 63 74 69 62 6c 65 2e /Indestr uctible.
00000113  6d 61 63 2e 78 76 69 64  2e 64 69 76 78 2e 61 76 mac.xvid .divx.av
00000123  69 7c 30 7c 0a 4d 61 64  6f 6e 6e 61 5f 48 75 6e i|0|.Mad onna_Hun
00000133  67 55 70 2e 6d 70 67 7c  2f 68 6f 6d 65 2f 6f 6c gUp.mpg| /home/ol
00000143  69 76 69 65 72 2f 53 68  61 72 65 64 5f 4b 69 73 ivier/Sh ared_Kis
00000153  73 2f 56 69 64 65 6f 2f  4d 61 64 6f 6e 6e 61 5f s/Video/ Madonna_
00000163  48 75 6e 67 55 70 2e 6d  70 67 7c 30 7c 0a 45 4f HungUp.m pg|0|.EO
00000173  4c 0a                                            L.
Personal tools
Developper