winlin

refine utility of protocol, add comments

@@ -39,27 +39,50 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -39,27 +39,50 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39 // the default chunk size for system. 39 // the default chunk size for system.
40 #define SRS_CONF_DEFAULT_CHUNK_SIZE 60000 40 #define SRS_CONF_DEFAULT_CHUNK_SIZE 60000
41 41
42 -// parse the tcUrl, output the schema, host, vhost, app and port. 42 +/**
  43 +* parse the tcUrl, output the schema, host, vhost, app and port.
  44 +* @param tcUrl, the input tcUrl, for example,
  45 +* rtmp://192.168.1.10:19350/live?vhost=vhost.ossrs.net
  46 +* @param schema, for example, rtmp
  47 +* @param host, for example, 192.168.1.10
  48 +* @param vhost, for example, vhost.ossrs.net.
  49 +* vhost default to host, when user not set vhost in query of app.
  50 +* @param app, for example, live
  51 +* @param port, for example, 19350
  52 +* default to 1935 if not specified.
  53 +*/
43 extern void srs_discovery_tc_url( 54 extern void srs_discovery_tc_url(
44 std::string tcUrl, 55 std::string tcUrl,
45 std::string& schema, std::string& host, std::string& vhost, 56 std::string& schema, std::string& host, std::string& vhost,
46 std::string& app, std::string& port 57 std::string& app, std::string& port
47 ); 58 );
48 59
49 -// resolve the vhost in query string  
50 -// @param app, may contains the vhost in query string format:  
51 -// app?vhost=request_vhost  
52 -// app...vhost...request_vhost 60 +/**
  61 +* resolve the vhost in query string
  62 +* @param app, may contains the vhost in query string format:
  63 +* app?vhost=request_vhost
  64 +* app...vhost...request_vhost
  65 +*/
53 extern void srs_vhost_resolve(std::string& vhost, std::string& app); 66 extern void srs_vhost_resolve(std::string& vhost, std::string& app);
54 67
55 -// generate ramdom data for handshake. 68 +/**
  69 +* generate ramdom data for handshake.
  70 +*/
56 extern void srs_random_generate(char* bytes, int size); 71 extern void srs_random_generate(char* bytes, int size);
57 72
58 -// generate the tcUrl.  
59 -extern std::string srs_generate_tc_url(std::string ip, std::string vhost, std::string app, std::string port); 73 +/**
  74 +* generate the tcUrl.
  75 +* @return the tcUrl generated from ip/vhost/app/port.
  76 +* @remark when vhost equals to __defaultVhost__, use ip as vhost.
  77 +* @remark ignore port if port equals to default port 1935.
  78 +*/
  79 +extern std::string srs_generate_tc_url(
  80 + std::string ip, std::string vhost, std::string app, std::string port
  81 +);
60 82
61 /** 83 /**
62 * compare the memory in bytes. 84 * compare the memory in bytes.
  85 +* @return true if completely equal; otherwise, false.
63 */ 86 */
64 extern bool srs_bytes_equals(void* pa, void* pb, int size); 87 extern bool srs_bytes_equals(void* pa, void* pb, int size);
65 88