Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions | Variables
MRJNetworking.cpp File Reference
#include <TextCommon.h>
#include <JManager.h>
#include "JMURLConnection.h"
#include "MRJNetworking.h"
#include "MRJContext.h"
#include "MRJPlugin.h"
#include "MRJSession.h"
#include "MRJMonitor.h"
#include "nsIPluginManager2.h"
#include <vector>

Go to the source code of this file.

Classes

class  MRJInputStream
class  MRJURLConnection

Functions

static char * JMTextToEncoding (JMTextRef textRef, JMTextEncoding encoding)
static OSStatus openConnection (JMTextRef url, JMTextRef requestMethod, JMURLConnectionOptions options, JMAppletViewerRef appletViewer, JMURLConnectionRef *urlConnectionRef)
static OSStatus closeConnection (JMURLConnectionRef urlConnectionRef)
static Boolean usingProxy (JMURLConnectionRef urlConnectionRef)
static OSStatus getCookie (JMURLConnectionRef urlConnectionRef, JMTextRef *cookie)
static OSStatus setCookie (JMURLConnectionRef urlConnectionRef, JMTextRef cookie)
static OSStatus setRequestProperties (JMURLConnectionRef urlConnectionRef, int numberOfProperties, JMTextRef *keys, JMTextRef *value)
static OSStatus getResponsePropertiesCount (JMURLInputStreamRef urlInputStreamRef, int *numberOfProperties)
static OSStatus getResponseProperties (JMURLInputStreamRef urlInputStreamRef, int numberOfProperties, JMTextRef *keys, JMTextRef *values)
static OSStatus openInputStream (JMURLConnectionRef urlConnectionRef, JMURLInputStreamRef *urlInputStreamRef)
static OSStatus openOutputStream (JMURLConnectionRef urlConnectionRef, JMURLOutputStreamRef *urlOutputStreamRef)
static OSStatus closeInputStream (JMURLInputStreamRef urlInputStreamRef)
static OSStatus closeOutputStream (JMURLOutputStreamRef urlOutputStreamRef)
static OSStatus readInputStream (JMURLInputStreamRef urlInputStreamRef, void *buffer, UInt32 bufferSize, SInt32 *bytesRead)
static OSStatus writeOutputStream (JMURLOutputStreamRef oStreamRef, void *buffer, SInt32 bytesToWrite)
OSStatus OpenMRJNetworking (MRJSession *session)
OSStatus CloseMRJNetworking (MRJSession *session)

Variables

nsIPluginManagerthePluginManager
nsIPluginManager2thePluginManager2
static JMURLCallbacks theURLCallbacks

Function Documentation

static OSStatus closeConnection ( JMURLConnectionRef  urlConnectionRef) [static]

Definition at line 265 of file MRJNetworking.cpp.

{
    MRJURLConnection* connection = reinterpret_cast<MRJURLConnection*>(urlConnectionRef);
    delete connection;
    return noErr;
}
static OSStatus closeInputStream ( JMURLInputStreamRef  urlInputStreamRef) [static]

Definition at line 357 of file MRJNetworking.cpp.

{
    MRJInputStream* inputStream = reinterpret_cast<MRJInputStream*>(urlInputStreamRef);
    inputStream->Release();
    return noErr;
}

Definition at line 417 of file MRJNetworking.cpp.

{
    return noErr;
}

Here is the caller graph for this function:

static OSStatus closeOutputStream ( JMURLOutputStreamRef  urlOutputStreamRef) [static]

Definition at line 366 of file MRJNetworking.cpp.

{
    return paramErr;
}
static OSStatus getCookie ( JMURLConnectionRef  urlConnectionRef,
JMTextRef *  cookie 
) [static]

Definition at line 282 of file MRJNetworking.cpp.

{
    return paramErr;
}
static OSStatus getResponseProperties ( JMURLInputStreamRef  urlInputStreamRef,
int  numberOfProperties,
JMTextRef *  keys,
JMTextRef *  values 
) [static]

Definition at line 319 of file MRJNetworking.cpp.

{
    return noErr;
}
static OSStatus getResponsePropertiesCount ( JMURLInputStreamRef  urlInputStreamRef,
int numberOfProperties 
) [static]

Definition at line 308 of file MRJNetworking.cpp.

{
    if (numberOfProperties == NULL)
        return paramErr;
    *numberOfProperties = 0;
    return noErr;
}
static char* JMTextToEncoding ( JMTextRef  textRef,
JMTextEncoding  encoding 
) [static]

Definition at line 59 of file MRJNetworking.cpp.

{
       UInt32 length = 0;
    OSStatus status = ::JMGetTextLengthInBytes(textRef, encoding, &length);
    if (status != noErr)
        return NULL;
    char* text = new char[length + 1];
    if (text != NULL) {
        UInt32 actualLength;
       status = ::JMGetTextBytes(textRef, encoding, text, length, &actualLength);
           if (status != noErr) {
               delete text;
               return NULL;
           }
           text[length] = '\0';
    }
    return text;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static OSStatus openConnection ( JMTextRef  url,
JMTextRef  requestMethod,
JMURLConnectionOptions  options,
JMAppletViewerRef  appletViewer,
JMURLConnectionRef urlConnectionRef 
) [static]

Definition at line 251 of file MRJNetworking.cpp.

{
    MRJURLConnection* connection = new MRJURLConnection(url, requestMethod,
                                                        options, appletViewer);
    *urlConnectionRef = connection;
    return noErr;
}
static OSStatus openInputStream ( JMURLConnectionRef  urlConnectionRef,
JMURLInputStreamRef urlInputStreamRef 
) [static]

Definition at line 329 of file MRJNetworking.cpp.

{
    MRJURLConnection* connection = reinterpret_cast<MRJURLConnection*>(urlConnectionRef);
    MRJInputStream* inputStream = new MRJInputStream(connection->getInstance()->getSession());
    if (!inputStream)
        return memFullErr;

    inputStream->AddRef();
    *urlInputStreamRef = inputStream;

    nsIPluginInstance* pluginInstance = connection->getInstance();
    nsIPluginStreamListener* listener = inputStream;
    nsresult rv = thePluginManager->GetURL(pluginInstance, connection->getURL(), NULL, listener);

    return noErr;
}

Here is the call graph for this function:

Definition at line 405 of file MRJNetworking.cpp.

{
    OSStatus rv = paramErr;
    if (&::JMURLSetCallbacks != 0) {
        rv = ::JMURLSetCallbacks(session->getSessionRef(),
                                 "http", &theURLCallbacks);
        rv = ::JMURLSetCallbacks(session->getSessionRef(),
                                 "https", &theURLCallbacks);
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static OSStatus openOutputStream ( JMURLConnectionRef  urlConnectionRef,
JMURLOutputStreamRef urlOutputStreamRef 
) [static]

Definition at line 349 of file MRJNetworking.cpp.

{
    return paramErr;
}
static OSStatus readInputStream ( JMURLInputStreamRef  urlInputStreamRef,
void buffer,
UInt32  bufferSize,
SInt32 *  bytesRead 
) [static]

Definition at line 373 of file MRJNetworking.cpp.

{
    MRJInputStream* inputStream = reinterpret_cast<MRJInputStream*>(urlInputStreamRef);
    return inputStream->read(buffer, bufferSize, bytesRead);
}

Here is the call graph for this function:

static OSStatus setCookie ( JMURLConnectionRef  urlConnectionRef,
JMTextRef  cookie 
) [static]

Definition at line 290 of file MRJNetworking.cpp.

{
    return paramErr;
}

Here is the caller graph for this function:

static OSStatus setRequestProperties ( JMURLConnectionRef  urlConnectionRef,
int  numberOfProperties,
JMTextRef *  keys,
JMTextRef *  value 
) [static]

Definition at line 298 of file MRJNetworking.cpp.

{
    return paramErr;
}
static Boolean usingProxy ( JMURLConnectionRef  urlConnectionRef) [static]

Definition at line 274 of file MRJNetworking.cpp.

{
    MRJURLConnection* connection = reinterpret_cast<MRJURLConnection*>(urlConnectionRef);
    return connection->getUsingProxy();
}

Here is the call graph for this function:

static OSStatus writeOutputStream ( JMURLOutputStreamRef  oStreamRef,
void buffer,
SInt32  bytesToWrite 
) [static]

Definition at line 384 of file MRJNetworking.cpp.

{
    return paramErr;
}

Variable Documentation

Definition at line 538 of file badapter.cpp.

Definition at line 74 of file MRJPlugin.cpp.