PROTOCOL 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. Architecture and Protocol Specification
  2. For the sake of easyness we call the "central interconnection point" server just "central".
  3. Connect to the central interconnection point.
  4. Authentication is done via 'authorized_keys' as explained in the README or above. Once you are authenticated, the actual
  5. authorization (i.e. the permissions you have) is done on the server side. So, when you connect with your client, you are
  6. allowed to send a specific set of commands, depending on the assigned role.
  7. Available client commands are shown upon connection to your client.
  8. Client Commands that you can send
  9. ------------------------------------------------------------------------------------------------------------------------
  10. C <chattext>
  11. example: C Hey mihawk, have you seen my latest underwear? It has the Simpsons family printed on it!
  12. Every client will receive a <chattext>. This is a connection-wide broadcast with no real meaning. It is only meant for
  13. having a chat with other connected debug connections. So, it's good for developing and having party chat.
  14. reply-format: C <your-name>: <your-chattext>
  15. reply-example: C paul_specbot: Hey mihawk, have you seen my latest underwear? It has the Simpsons family printed on it!
  16. ------------------------------------------------------------------------------------------------------------------------
  17. PART
  18. Central will gracefully close your connection.
  19. ------------------------------------------------------------------------------------------------------------------------
  20. PING
  21. A command to test if connections and processing are still alive. Central will answer with "PONG [optional text]" to show
  22. it's still kicking around and working. We encourage all clients to send PING to central on a regular basis of about
  23. 90 seconds. So your client will notice broken connections to begin reconnecting. We want a robust network. All clients
  24. need to find their connections by themselves.
  25. reply: PONG
  26. ------------------------------------------------------------------------------------------------------------------------
  27. REQ_BC <network>,<frequency>,<source/channel>,'<nickname>','<message>'
  28. example: REQ_BC QWalt,-qw-,qw://84.34.166.158:28001 3/4,'Panjabi','noob 2on2'
  29. We request central to fan out a message broadcast with the given specifics. Central will calculate a md5-hash for this
  30. request as an identifier and reply it to you. From now on, this request is always referenced by the md5-hash. Meanwhile,
  31. in the background, central will send BC commands to the other clients. Those clients will answer with BC_RE with reached
  32. user count to central. Central will forward those counts to you with BC_RE. It is up to your client to interprete and
  33. sum up those counts after some seconds (3s) of timeout. Perhaps give those counts back to the originating human user who
  34. sent the message. It's not needed, but it's nice.
  35. reply-format:
  36. BC_ID <req-md5hash> for: <network>,<frequency>,<source/channel>
  37. BC_RE <req-md5hash> <Key1>=<Count1>[,<Key2>=<Count2>][,<Key3>=<Count3>]
  38. reply-example:
  39. BC_ID 0043d5c53120922b4323235fa8f839d5 for: QWalt,-qw-,qw://84.34.166.158:28001 3/4
  40. BC_RE 0043d5c53120922b4323235fa8f839d5 Users=283,Channels=69
  41. BC_RE 0043d5c53120922b4323235fa8f839d5 Users=32,Channels=13,Players=8,Servers=2
  42. BC_RE 0043d5c53120922b4323235fa8f839d5 Players=41,Servers=12
  43. ------------------------------------------------------------------------------------------------------------------------
  44. REQ_DNS <serverip>:<serverport> [server-type]
  45. example: REQ_DNS 85.235.251.94:27501 qw
  46. Central will try to determine how to name that game server. If a game server name is not already cached and the data is
  47. not young enough then central will request a status from that game server to find its game server name. Inside the
  48. game server name may be a short hostname that resolves to its ip. It also tries the reverse dns lookup of that ip.
  49. The shorter the name, the better. If it can't establish a good hostname, it will return you the ip address.
  50. [server-type] is not yet implemented. It defaults to quakeworld ("qw").
  51. reply-format: DNS_RE <serverip>:<serverport> <good name>
  52. reply-example: DNS_RE 85.235.251.94:27501 qw.foppa.dk
  53. ------------------------------------------------------------------------------------------------------------------------
  54. WHO
  55. This will show you who is connected to central. It's a multi-line reply consisting of the <name> of the client and
  56. its roles. <role1> is always specified. More roles, if available, are shown as a comma-separated list. For
  57. human-readability there should always be a space after that comma. It's optional.
  58. reply-format: WHO_RE <name> ROLES: <role1>[, more-roles]
  59. reply-example:
  60. WHO_RE paul_eggdrop ROLES: everyone, broadcast
  61. WHO_RE paul_specbot ROLES: everyone, broadcast, specbot
  62. ------------------------------------------------------------------------------------------------------------------------
  63. Server Commands
  64. Aside from the above replies from central to you, central can send you commands _initially_, that you, as a client, need
  65. to understand and react or reply to. And, some commands are just "informational", which means, that you don't need to
  66. reply. You can act on them optionally.
  67. ------------------------------------------------------------------------------------------------------------------------
  68. HELLO <hello message>
  69. example: HELLO Hi user 'paul_specbot'! How are you? I'm '0.6em_specservers_dupe_election'
  70. Central says hello to you. It's supposed to be the very first message upon connection. If it's not the first. Well,
  71. either it's missing :), or something is very wrong. It normally carries the server version. But it is not required.
  72. ------------------------------------------------------------------------------------------------------------------------
  73. ROLES <role1>[, more-roles]
  74. example: ROLES everyone, broadcast, specbot
  75. Central tells you what roles you possess. Depending on the role it will tell you what commands or replies you may send.
  76. This is part of letting the client know his authorization.
  77. ------------------------------------------------------------------------------------------------------------------------
  78. COMMANDS <command1>[, more-commands]
  79. example: COMMANDS PING, WHO, C, PART, REQ_BC, BC_RE, ASSIGN_RE, UNASSIGN_RE, ASSIGNMENTS_RE, REQ_DNS, MAXSERVERS_RE
  80. Central tells you what commands or replies you may send. Other commands will trigger a command help.
  81. ------------------------------------------------------------------------------------------------------------------------
  82. REQ_MAXSERVERS <request info text>
  83. example: REQ_MAXSERVERS how many can you do?
  84. You have a specbot role and central wants to know, how many servers you want to observe at maximum. So you answer with a
  85. max server count.
  86. reply-format: MAXSERVERS_RE <max server count>
  87. reply-example: MAXSERVERS_RE 50
  88. ------------------------------------------------------------------------------------------------------------------------
  89. REQ_ASSIGNMENTS [info text about the request]
  90. example: REQ_ASSIGNMENTS gimme all your servers
  91. Central wants to know your current servers that you observe. Thus, central determines your current server count and
  92. may assign or unassign you more or less servers depending on your maximum server count. The reply is a multi-line reply
  93. as there normally are many servers that are assigned to one specbot.
  94. Central is not yet intelligent enough to do that. So this feature is not yet implemented.
  95. reply-format: ASSIGNMENTS_RE <serverip>:<serverport>,<s-p>,<ping>
  96. reply-example:
  97. ASSIGNMENTS_RE 123.123.13.13:27500,1,32
  98. ASSIGNMENTS_RE 234.234.24.24:27501,0,35
  99. ------------------------------------------------------------------------------------------------------------------------
  100. REQ_ASSIGN <serverip>:<serverport>[,s-p] (NYI)
  101. example: REQ_ASSIGN 46.41.133.108:27502
  102. Central wants you to monitor this server. You normally reply with an OK-message. If you use any other word than 'OK' it
  103. failed. If it failed, it's not a bad thing. Central will just know, 'ok, this bot won't take any more servers from me'.
  104. reply-format: ASSIGN_RE <serverip>:<serverport> <OK|fail> <reason>
  105. reply-example:
  106. ASSIGN_RE 46.41.133.108:27502 OK all good, I take it
  107. ASSIGN_RE 46.41.133.108:27502 blah I hate you
  108. ------------------------------------------------------------------------------------------------------------------------
  109. REQ_UNASSIGN <serverip>:<serverport> (NYI)
  110. example: REQ_UNASSIGN 46.41.133.108:27502
  111. Central wants you to stop monitoring this server. If you received the unassign-command by error, and you currently don't
  112. monitor that server, then always reply with OK, since the wanted status is that you don't monitor it. Central wants to
  113. know you achieved that status. If you use any other word than 'OK' it failed.
  114. reply-format: UNASSIGN_RE <serverip>:<serverport> <OK|fail> <reason>
  115. reply-example:
  116. UNASSIGN_RE 46.41.133.108:27502 OK all good, I'm leaving
  117. UNASSIGN_RE 46.41.133.108:27502 yadda no way, I can't take it off
  118. ------------------------------------------------------------------------------------------------------------------------
  119. BC <req-md5hash> <network>,<frequency>,<source/channel>,'<nickname>','<message>'
  120. example: BC cbb8aa4a9fdce0c8c3f811f19d716d22 QWalt,-qw-,qw://qw.foppa.dk:27501 1/2,'f4t833','1v1 here'
  121. Central wants you to write this message, with given request md5-hash, to your users in the specified network and
  122. frequency. Of course, request md5-hash, network and frequency are identifiers which are to be taken seriously. Whereas,
  123. the source/channel may be a free text. So, after you sent out the message, you shall instantly reply with counts of how
  124. many people this message reached. Central will take those counts and forward it to the originating network client which
  125. issued the REQ_BC command. The originating network client will have a small timeout (3s), after which it interpretes
  126. those key-value-pairs and calculates the final counts.
  127. reply-format: BC_RE <req-md5hash> <Key1>=<Count1>[,<Key2>=<Count2>][,<Key3>=<Count3>]
  128. reply-example:
  129. BC_RE cbb8aa4a9fdce0c8c3f811f19d716d22 Players=37,Servers=10
  130. BC_RE cbb8aa4a9fdce0c8c3f811f19d716d22 Users=12,Channels=2
  131. ------------------------------------------------------------------------------------------------------------------------
  132. PING [info text about the request]
  133. example: PING alive?
  134. Central will issue a PING command if your client has not issued a PING command within the last 180 seconds. There is no
  135. need to answer. By writing the message to the socket of your client it will certainly fail if the connection died
  136. earlier. There is no consequence of not replying. It's just a measure to find broken connections. We still encourage
  137. your client to send PING (see above) to central on a regular basis of about 90 seconds. So your clients will notice
  138. broken connections to begin reconnecting. We want a robust network. All clients need to find their connections by
  139. themselves.
  140. ------------------------------------------------------------------------------------------------------------------------