
230 Flash Media Server Security
Sample Adaptor.cpp file
Here is an excerpt from the Adaptor.cpp file that you can modify to fit your local
authentication profile. Adaptor.cpp is a C++ file that contains the code for the Access DLL
module.
The corresponding file on Linux systems is called Makefile.access.
void SampleAdaptor::onAccess(IFCAccess* pAccess)
{
switch(pAccess->getType())
{
case IFCAccess::CONNECT:
{
fprintf( stderr, "SampleAdaptor [Connect] referrer:
%s\n", safestr(pAccess->getValue("c-referrer")) );
fprintf( stderr, "SampleAdaptor [Connect] uri: %s\n",
safestr(pAccess->getValue("s-uri")) );
fprintf( stderr, "SampleAdaptor [Connect] user agent:
%s\n", safestr(pAccess->getValue("c-user-agent")) );
fprintf( stderr, "SampleAdaptor [Connect] client ip:
%s\n", safestr(pAccess->getValue("c-ip")) );
char *strValue = (char
*)malloc(STRING_VALUE_BUFFER_LEN);
memset((void *)strValue, 0, STRING_VALUE_BUFFER_LEN);
m_pCtx->getStats("s-connected", strValue);
fprintf( stderr, "SampleAdaptor [Connect] getStats,
connected %s\n", safestr(strValue) );
m_pCtx->getStats("s-bytes-in", strValue);
fprintf( stderr, "SampleAdaptor [Connect] getStats,
bytes-in %s\n", safestr(strValue) );
m_pCtx->getStats("s-bytes-out", strValue);
fprintf( stderr, "SampleAdaptor [Connect] getStats,
bytes-out %s\n", safestr(strValue) );
// Reset the uri string.
pAccess->setValue("s-uri", "rtmp://this.somewhere-
else.com");
//fprintf( stderr, "Adjusted [Connect] uri: %s\n",
safestr(pAccess->getValue("s-uri")) );
pAccess->setValue("c-referrer", "new referrer");
pAccess->setValue("c-user-agent", "other user agent");
pAccess->setReadAccess("/", false);
pAccess->setWriteAccess("/", true);
break;
Commenti su questo manuale