예제 #1
0
파일: hi_si.c 프로젝트: dddddrrrr/Snort
/**
**  Initialize the session and server configurations for this packet/stream.
**
**  It is important to note in stateless mode that we assume no knowledge of the
**  state of a connection, other than the knowledge that we can glean from an
**  individual packet.  So in essence, each packet is it's own session and there
**  is no knowledge retained from one packet to another.  If you want to track
**  an HTTP session for real, use stateful mode.
**
**  In this function, we set the Session pointer (which includes the correct
**  server configuration).  The actual processing to find which IP is the
**  server and which is the client, is done in the InitServerConf() function.
**
**  @param GlobalConf    pointer to the global configuration
**  @param Session       double pointer to the Session structure
**  @param SiInput       pointer to the session information
**  @param piInspectMode pointer so the inspection mode can be set
**
**  @return integer
**
**  @retval HI_SUCCESS function successful
*/
static int StatelessSessionInspection(HTTPINSPECT_GLOBAL_CONF *GlobalConf,
        HI_SESSION **Session, HI_SI_INPUT *SiInput, int *piInspectMode,
        Packet *p)
{
    static HI_SESSION StaticSession;
    HTTPINSPECT_CONF *ServerConf = NULL;
    HTTPINSPECT_CONF *ClientConf = NULL;
    int iRet;

    ResetSession(&StaticSession);

    iRet = InitServerConf(GlobalConf, &ServerConf, &ClientConf, SiInput, piInspectMode, p);
    if (iRet)
    {
        return iRet;
    }

    StaticSession.server_conf = ServerConf;
    StaticSession.client_conf = ClientConf;
    StaticSession.global_conf = GlobalConf;

    *Session = &StaticSession;

    return HI_SUCCESS;
}
예제 #2
0
bool LobbyServer::Init(const char* pConfPath)
{
	if (!InitLog4cpp())
	{
		return false;
	}
	if (!InitServerConf(pConfPath))
	{
		return false;
	}
	if (!InitServerApp())
	{
		return false;
	}
	return true;
}