Exemple #1
0
/* Process incoming SETUP/DESCRIBE request */
static rtsp_server_session_t* rtsp_server_session_setup_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message)
{
	rtsp_server_session_t *session = NULL;
	if(message->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
		/* create new session */
		session = rtsp_server_session_create(server);
		if(!session) {
			return NULL;
		}
		session->connection = rtsp_connection;
		apt_log(RTSP_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session " APT_SID_FMT,session->id.buf);
		apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session);
	}
	else if(message->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) {
		/* create new session as a communication object */
		session = rtsp_server_session_create(server);
		if(!session) {
			return NULL;
		}
		session->connection = rtsp_connection;
		apt_log(RTSP_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session " APT_SID_FMT,session->id.buf);
		apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session);
	}
	else {
		/* error case */
		apt_log(RTSP_LOG_MARK,APT_PRIO_WARNING,"Missing RTSP Session-ID");
		rtsp_server_error_respond(server,rtsp_connection,message,
								RTSP_STATUS_CODE_BAD_REQUEST,
								RTSP_REASON_PHRASE_BAD_REQUEST);
	}
	return session;
}
Exemple #2
0
static void rtsp_server_onrecv(void* ptr, void* session, const char* ip, int port, void* parser, void** user)
{
	struct rtsp_server_context_t *ctx;
	struct rtsp_server_request_t *req;
	ctx = (struct rtsp_server_context_t*)ptr;

	req = rtsp_server_session_create(ctx);
	req->session = session;
	req->transport = ctx->tcptransport;
	req->cseq = (unsigned int)-1;
	strncpy(req->ip, ip, sizeof(req->ip)-1);
	req->port = (unsigned short)port;

	*user = req;
	rtsp_server_handle(req, parser);
}