Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello..

I have the working rtsp server code.now I need to implement authentication,that to provide username and password.here im using live555 libraries.can anyone help me out? to proceed how to implement it.

Thanks and Regards
Bhavana

What I have tried:

C++
// Check whether "<username>[:<password>]@" occurs next.
    // We do this by checking whether '@' appears before the end of the URL, or before the first '/'.
    username = password = NULL; // default return values
    char const* colonPasswordStart = NULL;
    char const* p;
    for (p = from; *p != '\0' && *p != '/'; ++p) {
      if (*p == ':' && colonPasswordStart == NULL) {
	colonPasswordStart = p;
      } else if (*p == '@') {
	// We found <username> (and perhaps <password>).  Copy them into newly-allocated result strings:
	if (colonPasswordStart == NULL) colonPasswordStart = p;

	char const* usernameStart = from;
	unsigned usernameLen = colonPasswordStart - usernameStart;
	username = new char[usernameLen + 1] ; // allow for the trailing '\0'
	copyUsernameOrPasswordStringFromURL(username, usernameStart, usernameLen);

	char const* passwordStart = colonPasswordStart;
	if (passwordStart < p) ++passwordStart; // skip over the ':'
	unsigned passwordLen = p - passwordStart;
	password = new char[passwordLen + 1]; // allow for the trailing '\0'
	copyUsernameOrPasswordStringFromURL(password, passwordStart, passwordLen);

	from = p + 1; // skip over the '@'
	break;
      }
    }
Posted
Updated 25-Jun-20 21:50pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900