Blame view

trunk/src/kernel/srs_kernel_error.hpp 7.4 KB
winlin authored
1 2 3
/*
The MIT License (MIT)
4
Copyright (c) 2013-2014 winlin
winlin authored
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
24 25
#ifndef SRS_KERNEL_ERROR_HPP
#define SRS_KERNEL_ERROR_HPP
winlin authored
26 27

/*
28
#include <srs_kernel_error.hpp>
winlin authored
29 30 31 32
*/

#include <srs_core.hpp>
winlin authored
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
#define ERROR_SUCCESS                       0

#define ERROR_ST_SET_EPOLL                  100
#define ERROR_ST_INITIALIZE                 101
#define ERROR_ST_OPEN_SOCKET                102
#define ERROR_ST_CREATE_LISTEN_THREAD       103
#define ERROR_ST_CREATE_CYCLE_THREAD        104
#define ERROR_ST_CONNECT                    105

#define ERROR_SOCKET_CREATE                 200
#define ERROR_SOCKET_SETREUSE               201
#define ERROR_SOCKET_BIND                   202
#define ERROR_SOCKET_LISTEN                 203
#define ERROR_SOCKET_CLOSED                 204
#define ERROR_SOCKET_GET_PEER_NAME          205
#define ERROR_SOCKET_GET_PEER_IP            206
#define ERROR_SOCKET_READ                   207
#define ERROR_SOCKET_READ_FULLY             208
#define ERROR_SOCKET_WRITE                  209
#define ERROR_SOCKET_WAIT                   210
#define ERROR_SOCKET_TIMEOUT                211
#define ERROR_SOCKET_GET_LOCAL_IP           212

#define ERROR_RTMP_PLAIN_REQUIRED           300
#define ERROR_RTMP_CHUNK_START              301
#define ERROR_RTMP_MSG_INVLIAD_SIZE         302
#define ERROR_RTMP_AMF0_DECODE              303
#define ERROR_RTMP_AMF0_INVALID             304
#define ERROR_RTMP_REQ_CONNECT              305
#define ERROR_RTMP_REQ_TCURL                306
#define ERROR_RTMP_MESSAGE_DECODE           307
#define ERROR_RTMP_MESSAGE_ENCODE           308
#define ERROR_RTMP_AMF0_ENCODE              309
#define ERROR_RTMP_CHUNK_SIZE               310
#define ERROR_RTMP_TRY_SIMPLE_HS            311
#define ERROR_RTMP_CH_SCHEMA                312
#define ERROR_RTMP_PACKET_SIZE              313
#define ERROR_RTMP_VHOST_NOT_FOUND          314
#define ERROR_RTMP_ACCESS_DENIED            315
#define ERROR_RTMP_HANDSHAKE                316
#define ERROR_RTMP_NO_REQUEST               317
74 75 76
// if user use complex handshake, but without ssl,
// 1. srs is ok, ignore and turn to simple handshake.
// 2. srs-librtmp return error, to terminate the program.
winlin authored
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
#define ERROR_RTMP_HS_SSL_REQUIRE           318

#define ERROR_SYSTEM_STREAM_INIT            400
#define ERROR_SYSTEM_PACKET_INVALID         401
#define ERROR_SYSTEM_CLIENT_INVALID         402
#define ERROR_SYSTEM_ASSERT_FAILED          403
#define ERROR_SYSTEM_SIZE_NEGATIVE          404
#define ERROR_SYSTEM_CONFIG_INVALID         405
#define ERROR_SYSTEM_CONFIG_DIRECTIVE       406
#define ERROR_SYSTEM_CONFIG_BLOCK_START     407
#define ERROR_SYSTEM_CONFIG_BLOCK_END       408
#define ERROR_SYSTEM_CONFIG_EOF             409
#define ERROR_SYSTEM_STREAM_BUSY            410
#define ERROR_SYSTEM_IP_INVALID             411
#define ERROR_SYSTEM_FORWARD_LOOP           412
#define ERROR_SYSTEM_WAITPID                413
#define ERROR_SYSTEM_BANDWIDTH_KEY          414
#define ERROR_SYSTEM_BANDWIDTH_DENIED       415
#define ERROR_SYSTEM_PID_ACQUIRE            416
#define ERROR_SYSTEM_PID_ALREADY_RUNNING    417
#define ERROR_SYSTEM_PID_LOCK               418
#define ERROR_SYSTEM_PID_TRUNCATE_FILE      419
#define ERROR_SYSTEM_PID_WRITE_FILE         420
#define ERROR_SYSTEM_PID_GET_FILE_INFO      421
#define ERROR_SYSTEM_PID_SET_FILE_INFO      422
winlin authored
102 103 104

// see librtmp.
// failed when open ssl create the dh
winlin authored
105
#define ERROR_OpenSslCreateDH               500
winlin authored
106
// failed when open ssl create the Private key.
winlin authored
107
#define ERROR_OpenSslCreateP                501
winlin authored
108
// when open ssl create G.
winlin authored
109
#define ERROR_OpenSslCreateG                502
winlin authored
110
// when open ssl parse P1024
winlin authored
111
#define ERROR_OpenSslParseP1024             503
winlin authored
112
// when open ssl set G
winlin authored
113
#define ERROR_OpenSslSetG                   504
winlin authored
114
// when open ssl generate DHKeys
winlin authored
115
#define ERROR_OpenSslGenerateDHKeys         505
winlin authored
116
// when open ssl share key already computed.
winlin authored
117
#define ERROR_OpenSslShareKeyComputed       506
winlin authored
118
// when open ssl get shared key size.
winlin authored
119
#define ERROR_OpenSslGetSharedKeySize       507
winlin authored
120
// when open ssl get peer public key.
winlin authored
121
#define ERROR_OpenSslGetPeerPublicKey       508
winlin authored
122
// when open ssl compute shared key.
winlin authored
123
#define ERROR_OpenSslComputeSharedKey       509
winlin authored
124
// when open ssl is invalid DH state.
winlin authored
125
#define ERROR_OpenSslInvalidDHState         510
winlin authored
126
// when open ssl copy key
winlin authored
127
#define ERROR_OpenSslCopyKey                511
winlin authored
128
// when open ssl sha256 digest key invalid size.
winlin authored
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
#define ERROR_OpenSslSha256DigestSize       512

#define ERROR_HLS_METADATA                  600
#define ERROR_HLS_DECODE_ERROR              601
#define ERROR_HLS_CREATE_DIR                602
#define ERROR_HLS_OPEN_FAILED               603
#define ERROR_HLS_WRITE_FAILED              604
#define ERROR_HLS_AAC_FRAME_LENGTH          605
#define ERROR_HLS_AVC_SAMPLE_SIZE           606

#define ERROR_ENCODER_VCODEC                700
#define ERROR_ENCODER_OUTPUT                701
#define ERROR_ENCODER_ACHANNELS             702
#define ERROR_ENCODER_ASAMPLE_RATE          703
#define ERROR_ENCODER_ABITRATE              704
#define ERROR_ENCODER_ACODEC                705
#define ERROR_ENCODER_VPRESET               706
#define ERROR_ENCODER_VPROFILE              707
#define ERROR_ENCODER_VTHREADS              708
#define ERROR_ENCODER_VHEIGHT               709
#define ERROR_ENCODER_VWIDTH                710
#define ERROR_ENCODER_VFPS                  711
#define ERROR_ENCODER_VBITRATE              712
#define ERROR_ENCODER_FORK                  713
#define ERROR_ENCODER_LOOP                  714
#define ERROR_ENCODER_OPEN                  715
#define ERROR_ENCODER_DUP2                  716
156 157
#define ERROR_ENCODER_PARSE                 717
#define ERROR_ENCODER_NO_INPUT              718
158 159
#define ERROR_ENCODER_NO_OUTPUT             719
#define ERROR_ENCODER_INPUT_TYPE            720
winlin authored
160 161 162 163

#define ERROR_HTTP_PARSE_URI                800
#define ERROR_HTTP_DATA_INVLIAD             801
#define ERROR_HTTP_PARSE_HEADER             802
winlin authored
164
#define ERROR_HTTP_HANDLER_MATCH_URL        803
165
#define ERROR_HTTP_HANDLER_INVALID          804
166 167
#define ERROR_HTTP_OPEN_FILE                805
#define ERROR_HTTP_READ_FILE                806
winlin authored
168
169 170 171
// system control message, 
// not an error, but special control logic.
// sys ctl: rtmp close stream, support replay.
winlin authored
172
#define ERROR_CONTROL_RTMP_CLOSE            900
173
// FMLE stop publish and republish.
winlin authored
174
#define ERROR_CONTROL_REPUBLISH             901
175 176 177 178 179

/**
* whether the error code is an system control error.
*/
extern bool srs_is_system_control_error(int error_code);
180
extern bool srs_is_client_gracefully_close(int error_code);
181 182

#endif