mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine code for hooks and http core.
This commit is contained in:
parent
79fdc4e766
commit
f516636448
12 changed files with 144 additions and 43 deletions
|
@ -213,6 +213,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
///////////////////////////////////////////////////////////
|
||||
// HTTP consts values
|
||||
///////////////////////////////////////////////////////////
|
||||
// the default http port.
|
||||
#define SRS_CONSTS_HTTP_DEFAULT_PORT 80
|
||||
// linux path seprator
|
||||
#define SRS_CONSTS_HTTP_PATH_SEP '/'
|
||||
// query string seprator
|
||||
|
|
3
trunk/src/kernel/srs_kernel_error.hpp
Executable file → Normal file
3
trunk/src/kernel/srs_kernel_error.hpp
Executable file → Normal file
|
@ -102,6 +102,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define ERROR_SYSTEM_CONFIG_RAW_DISABLED 1061
|
||||
#define ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED 1062
|
||||
#define ERROR_SYSTEM_CONFIG_RAW_PARAMS 1063
|
||||
#define ERROR_SYSTEM_FILE_NOT_EXISTS 1064
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// RTMP protocol error.
|
||||
|
@ -234,6 +235,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define ERROR_RESPONSE_CODE 3064
|
||||
#define ERROR_RESPONSE_DATA 3065
|
||||
#define ERROR_REQUEST_DATA 3066
|
||||
#define ERROR_EDGE_PORT_INVALID 3067
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// HTTP/StreamCaster/KAFKA protocol error.
|
||||
|
@ -276,6 +278,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define ERROR_KAFKA_CODEC_METADATA 4035
|
||||
#define ERROR_KAFKA_CODEC_MESSAGE 4036
|
||||
#define ERROR_KAFKA_CODEC_PRODUCER 4037
|
||||
#define ERROR_HTTP_302_INVALID 4038
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// HTTP API error.
|
||||
|
|
|
@ -178,6 +178,20 @@ void SrsCommonMessage::create_payload(int size)
|
|||
#endif
|
||||
}
|
||||
|
||||
int SrsCommonMessage::create(SrsMessageHeader* pheader, char* body, int size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// drop previous payload.
|
||||
srs_freepa(payload);
|
||||
|
||||
this->header = *pheader;
|
||||
this->payload = body;
|
||||
this->size = size;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SrsSharedPtrMessage::SrsSharedPtrPayload::SrsSharedPtrPayload()
|
||||
{
|
||||
payload = NULL;
|
||||
|
|
|
@ -289,6 +289,14 @@ public:
|
|||
* alloc the payload to specified size of bytes.
|
||||
*/
|
||||
virtual void create_payload(int size);
|
||||
public:
|
||||
/**
|
||||
* create common message,
|
||||
* from the header and body.
|
||||
* @remark user should never free the body.
|
||||
* @param pheader, the header to copy to the message. NULL to ignore.
|
||||
*/
|
||||
virtual int create(SrsMessageHeader* pheader, char* body, int size);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue