Skip to content

Commit

Permalink
[API] Renamed macro MN to SRT_EMN, MJ to SRT_EMJ.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Aug 25, 2022
1 parent 293a677 commit daf838e
Showing 1 changed file with 50 additions and 51 deletions.
101 changes: 50 additions & 51 deletions srtcore/srt.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,66 +477,65 @@ enum CodeMinor


// Stupid, but effective. This will be #undefined, so don't worry.
#define MJ(major) (1000 * MJ_##major)
#define MN(major, minor) (1000 * MJ_##major + MN_##minor)
#define SRT_EMJ(major) (1000 * MJ_##major)
#define SRT_EMN(major, minor) (1000 * MJ_##major + MN_##minor)

// Some better way to define it, and better for C language.
typedef enum SRT_ERRNO
{
SRT_EUNKNOWN = -1,
SRT_SUCCESS = MJ_SUCCESS,

SRT_ECONNSETUP = MJ(SETUP),
SRT_ENOSERVER = MN(SETUP, TIMEOUT),
SRT_ECONNREJ = MN(SETUP, REJECTED),
SRT_ESOCKFAIL = MN(SETUP, NORES),
SRT_ESECFAIL = MN(SETUP, SECURITY),
SRT_ESCLOSED = MN(SETUP, CLOSED),

SRT_ECONNFAIL = MJ(CONNECTION),
SRT_ECONNLOST = MN(CONNECTION, CONNLOST),
SRT_ENOCONN = MN(CONNECTION, NOCONN),

SRT_ERESOURCE = MJ(SYSTEMRES),
SRT_ETHREAD = MN(SYSTEMRES, THREAD),
SRT_ENOBUF = MN(SYSTEMRES, MEMORY),
SRT_ESYSOBJ = MN(SYSTEMRES, OBJECT),

SRT_EFILE = MJ(FILESYSTEM),
SRT_EINVRDOFF = MN(FILESYSTEM, SEEKGFAIL),
SRT_ERDPERM = MN(FILESYSTEM, READFAIL),
SRT_EINVWROFF = MN(FILESYSTEM, SEEKPFAIL),
SRT_EWRPERM = MN(FILESYSTEM, WRITEFAIL),

SRT_EINVOP = MJ(NOTSUP),
SRT_EBOUNDSOCK = MN(NOTSUP, ISBOUND),
SRT_ECONNSOCK = MN(NOTSUP, ISCONNECTED),
SRT_EINVPARAM = MN(NOTSUP, INVAL),
SRT_EINVSOCK = MN(NOTSUP, SIDINVAL),
SRT_EUNBOUNDSOCK = MN(NOTSUP, ISUNBOUND),
SRT_ENOLISTEN = MN(NOTSUP, NOLISTEN),
SRT_ERDVNOSERV = MN(NOTSUP, ISRENDEZVOUS),
SRT_ERDVUNBOUND = MN(NOTSUP, ISRENDUNBOUND),
SRT_EINVALMSGAPI = MN(NOTSUP, INVALMSGAPI),
SRT_EINVALBUFFERAPI = MN(NOTSUP, INVALBUFFERAPI),
SRT_EDUPLISTEN = MN(NOTSUP, BUSY),
SRT_ELARGEMSG = MN(NOTSUP, XSIZE),
SRT_EINVPOLLID = MN(NOTSUP, EIDINVAL),
SRT_EPOLLEMPTY = MN(NOTSUP, EEMPTY),
SRT_EBINDCONFLICT = MN(NOTSUP, BUSYPORT),

SRT_EASYNCFAIL = MJ(AGAIN),
SRT_EASYNCSND = MN(AGAIN, WRAVAIL),
SRT_EASYNCRCV = MN(AGAIN, RDAVAIL),
SRT_ETIMEOUT = MN(AGAIN, XMTIMEOUT),
SRT_ECONGEST = MN(AGAIN, CONGESTION),

SRT_EPEERERR = MJ(PEERERROR)
SRT_ECONNSETUP = SRT_EMJ(SETUP),
SRT_ENOSERVER = SRT_EMN(SETUP, TIMEOUT),
SRT_ECONNREJ = SRT_EMN(SETUP, REJECTED),
SRT_ESOCKFAIL = SRT_EMN(SETUP, NORES),
SRT_ESECFAIL = SRT_EMN(SETUP, SECURITY),
SRT_ESCLOSED = SRT_EMN(SETUP, CLOSED),

SRT_ECONNFAIL = SRT_EMJ(CONNECTION),
SRT_ECONNLOST = SRT_EMN(CONNECTION, CONNLOST),
SRT_ENOCONN = SRT_EMN(CONNECTION, NOCONN),

SRT_ERESOURCE = SRT_EMJ(SYSTEMRES),
SRT_ETHREAD = SRT_EMN(SYSTEMRES, THREAD),
SRT_ENOBUF = SRT_EMN(SYSTEMRES, MEMORY),
SRT_ESYSOBJ = SRT_EMN(SYSTEMRES, OBJECT),

SRT_EFILE = SRT_EMJ(FILESYSTEM),
SRT_EINVRDOFF = SRT_EMN(FILESYSTEM, SEEKGFAIL),
SRT_ERDPERM = SRT_EMN(FILESYSTEM, READFAIL),
SRT_EINVWROFF = SRT_EMN(FILESYSTEM, SEEKPFAIL),
SRT_EWRPERM = SRT_EMN(FILESYSTEM, WRITEFAIL),

SRT_EINVOP = SRT_EMJ(NOTSUP),
SRT_EBOUNDSOCK = SRT_EMN(NOTSUP, ISBOUND),
SRT_ECONNSOCK = SRT_EMN(NOTSUP, ISCONNECTED),
SRT_EINVPARAM = SRT_EMN(NOTSUP, INVAL),
SRT_EINVSOCK = SRT_EMN(NOTSUP, SIDINVAL),
SRT_EUNBOUNDSOCK = SRT_EMN(NOTSUP, ISUNBOUND),
SRT_ENOLISTEN = SRT_EMN(NOTSUP, NOLISTEN),
SRT_ERDVNOSERV = SRT_EMN(NOTSUP, ISRENDEZVOUS),
SRT_ERDVUNBOUND = SRT_EMN(NOTSUP, ISRENDUNBOUND),
SRT_EINVALMSGAPI = SRT_EMN(NOTSUP, INVALMSGAPI),
SRT_EINVALBUFFERAPI = SRT_EMN(NOTSUP, INVALBUFFERAPI),
SRT_EDUPLISTEN = SRT_EMN(NOTSUP, BUSY),
SRT_ELARGEMSG = SRT_EMN(NOTSUP, XSIZE),
SRT_EINVPOLLID = SRT_EMN(NOTSUP, EIDINVAL),
SRT_EPOLLEMPTY = SRT_EMN(NOTSUP, EEMPTY),
SRT_EBINDCONFLICT = SRT_EMN(NOTSUP, BUSYPORT),

SRT_EASYNCFAIL = SRT_EMJ(AGAIN),
SRT_EASYNCSND = SRT_EMN(AGAIN, WRAVAIL),
SRT_EASYNCRCV = SRT_EMN(AGAIN, RDAVAIL),
SRT_ETIMEOUT = SRT_EMN(AGAIN, XMTIMEOUT),
SRT_ECONGEST = SRT_EMN(AGAIN, CONGESTION),

SRT_EPEERERR = SRT_EMJ(PEERERROR)
} SRT_ERRNO;


#undef MJ
#undef MN
#undef SRT_EMJ
#undef SRT_EMN

enum SRT_REJECT_REASON
{
Expand Down

0 comments on commit daf838e

Please sign in to comment.