Updated c stuff to be more usable while we port

This commit is contained in:
saxon 2018-08-14 22:59:58 +09:30
parent bd4131e974
commit 11798bb9ff
2 changed files with 77 additions and 42 deletions

View File

@ -113,13 +113,13 @@ int HandShake(RTMP *r, int FP9HandShake);
int SocksNegotiate(RTMP *r); int SocksNegotiate(RTMP *r);
int SendConnectPacket(RTMP *r, RTMPPacket *cp); int SendConnectPacket(RTMP *r, RTMPPacket *cp);
static int SendCheckBW(RTMP *r); int SendCheckBW(RTMP *r);
static int SendCheckBWResult(RTMP *r, double txn); int SendCheckBWResult(RTMP *r, double txn);
int SendDeleteStream(RTMP *r, double dStreamId); int SendDeleteStream(RTMP *r, double dStreamId);
static int SendFCSubscribe(RTMP *r, AVal *subscribepath); int SendFCSubscribe(RTMP *r, AVal *subscribepath);
static int SendPlay(RTMP *r); int SendPlay(RTMP *r);
int SendBytesReceived(RTMP *r); int SendBytesReceived(RTMP *r);
static int SendUsherToken(RTMP *r, AVal *usherToken); int SendUsherToken(RTMP *r, AVal *usherToken);
#if 0 /* unused */ #if 0 /* unused */
static int SendBGHasStream(RTMP *r, double dId, AVal *playpath); static int SendBGHasStream(RTMP *r, double dId, AVal *playpath);
@ -137,7 +137,7 @@ void HandleClientBW(RTMP *r, const RTMPPacket *packet);
int ReadN(RTMP *r, char *buffer, int n); int ReadN(RTMP *r, char *buffer, int n);
int WriteN(RTMP *r, const char *buffer, int n); int WriteN(RTMP *r, const char *buffer, int n);
static void DecodeTEA(AVal *key, AVal *text); void DecodeTEA(AVal *key, AVal *text);
int HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len); int HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len);
static int HTTP_read(RTMP *r, int fill); static int HTTP_read(RTMP *r, int fill);
@ -1748,7 +1748,7 @@ RTMP_SendCreateStream(RTMP *r)
SAVC(FCSubscribe); SAVC(FCSubscribe);
static int int
SendFCSubscribe(RTMP *r, AVal *subscribepath) SendFCSubscribe(RTMP *r, AVal *subscribepath)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -1780,7 +1780,7 @@ SendFCSubscribe(RTMP *r, AVal *subscribepath)
/* Justin.tv specific authentication */ /* Justin.tv specific authentication */
static const AVal av_NetStream_Authenticate_UsherToken = AVC("NetStream.Authenticate.UsherToken"); static const AVal av_NetStream_Authenticate_UsherToken = AVC("NetStream.Authenticate.UsherToken");
static int int
SendUsherToken(RTMP *r, AVal *usherToken) SendUsherToken(RTMP *r, AVal *usherToken)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -1812,7 +1812,7 @@ SendUsherToken(RTMP *r, AVal *usherToken)
SAVC(releaseStream); SAVC(releaseStream);
static int int
SendReleaseStream(RTMP *r) SendReleaseStream(RTMP *r)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -1842,7 +1842,7 @@ SendReleaseStream(RTMP *r)
SAVC(FCPublish); SAVC(FCPublish);
static int int
SendFCPublish(RTMP *r) SendFCPublish(RTMP *r)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -1904,7 +1904,7 @@ SAVC(publish);
SAVC(live); SAVC(live);
SAVC(record); SAVC(record);
static int int
SendPublish(RTMP *r) SendPublish(RTMP *r)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -2101,7 +2101,7 @@ SendBytesReceived(RTMP *r)
SAVC(_checkbw); SAVC(_checkbw);
static int int
SendCheckBW(RTMP *r) SendCheckBW(RTMP *r)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -2129,7 +2129,7 @@ SendCheckBW(RTMP *r)
SAVC(_result); SAVC(_result);
static int int
SendCheckBWResult(RTMP *r, double txn) SendCheckBWResult(RTMP *r, double txn)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -2158,7 +2158,7 @@ SendCheckBWResult(RTMP *r, double txn)
SAVC(ping); SAVC(ping);
SAVC(pong); SAVC(pong);
static int int
SendPong(RTMP *r, double txn) SendPong(RTMP *r, double txn)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -2185,7 +2185,7 @@ SendPong(RTMP *r, double txn)
SAVC(play); SAVC(play);
static int int
SendPlay(RTMP *r) SendPlay(RTMP *r)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -2253,7 +2253,7 @@ SendPlay(RTMP *r)
SAVC(set_playlist); SAVC(set_playlist);
SAVC(0); SAVC(0);
static int int
SendPlaylist(RTMP *r) SendPlaylist(RTMP *r)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -2291,7 +2291,7 @@ SendPlaylist(RTMP *r)
return RTMP_SendPacket(r, &packet, TRUE); return RTMP_SendPacket(r, &packet, TRUE);
} }
static int int
SendSecureTokenResponse(RTMP *r, AVal *resp) SendSecureTokenResponse(RTMP *r, AVal *resp)
{ {
RTMPPacket packet; RTMPPacket packet;
@ -2389,7 +2389,7 @@ RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime)
return RTMP_SendPacket(r, &packet, FALSE); return RTMP_SendPacket(r, &packet, FALSE);
} }
static void void
AV_erase(RTMP_METHOD *vals, int *num, int i, int freeit) AV_erase(RTMP_METHOD *vals, int *num, int i, int freeit)
{ {
if (freeit) if (freeit)
@ -2907,6 +2907,9 @@ static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start");
static const AVal av_NetConnection_Connect_Rejected = static const AVal av_NetConnection_Connect_Rejected =
AVC("NetConnection.Connect.Rejected"); AVC("NetConnection.Connect.Rejected");
void sp(int n){
printf("%d\n",n);fflush(stdout);
}
/* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */ /* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */
int int
HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize) HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
@ -2917,6 +2920,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
int ret = 0, nRes; int ret = 0, nRes;
if (body[0] != 0x02) /* make sure it is a string method name we start with */ if (body[0] != 0x02) /* make sure it is a string method name we start with */
{ {
sp(1);
RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet", RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
__FUNCTION__); __FUNCTION__);
return 0; return 0;
@ -2925,6 +2929,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
nRes = AMF_Decode(&obj, body, nBodySize, FALSE); nRes = AMF_Decode(&obj, body, nBodySize, FALSE);
if (nRes < 0) if (nRes < 0)
{ {
sp(2);
RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__); RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
return 0; return 0;
} }
@ -2936,17 +2941,20 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
if (AVMATCH(&method, &av__result)) if (AVMATCH(&method, &av__result))
{ {
sp(3);
AVal methodInvoked = {0}; AVal methodInvoked = {0};
int i; int i;
for (i=0; i<r->m_numCalls; i++) { for (i=0; i<r->m_numCalls; i++) {
if (r->m_methodCalls[i].num == (int)txn) { if (r->m_methodCalls[i].num == (int)txn) {
sp(4);
methodInvoked = r->m_methodCalls[i].name; methodInvoked = r->m_methodCalls[i].name;
AV_erase(r->m_methodCalls, &r->m_numCalls, i, FALSE); AV_erase(r->m_methodCalls, &r->m_numCalls, i, FALSE);
break; break;
} }
} }
if (!methodInvoked.av_val) { if (!methodInvoked.av_val) {
sp(5);
RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request", RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request",
__FUNCTION__, txn); __FUNCTION__, txn);
goto leave; goto leave;
@ -2957,22 +2965,27 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
if (AVMATCH(&methodInvoked, &av_connect)) if (AVMATCH(&methodInvoked, &av_connect))
{ {
sp(6);
if (r->Link.token.av_len) if (r->Link.token.av_len)
{ {
sp(7);
AMFObjectProperty p; AMFObjectProperty p;
if (RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p)) if (RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p))
{ {
sp(8);
DecodeTEA(&r->Link.token, &p.p_vu.p_aval); DecodeTEA(&r->Link.token, &p.p_vu.p_aval);
SendSecureTokenResponse(r, &p.p_vu.p_aval); SendSecureTokenResponse(r, &p.p_vu.p_aval);
} }
} }
if (r->Link.protocol & RTMP_FEATURE_WRITE) if (r->Link.protocol & RTMP_FEATURE_WRITE)
{ {
sp(9);
SendReleaseStream(r); SendReleaseStream(r);
SendFCPublish(r); SendFCPublish(r);
} }
else else
{ {
sp(10);
RTMP_SendServerBW(r); RTMP_SendServerBW(r);
RTMP_SendCtrl(r, 3, 0, 300); RTMP_SendCtrl(r, 3, 0, 300);
} }
@ -2980,6 +2993,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
if (!(r->Link.protocol & RTMP_FEATURE_WRITE)) if (!(r->Link.protocol & RTMP_FEATURE_WRITE))
{ {
sp(11);
/* Authenticate on Justin.tv legacy servers before sending FCSubscribe */ /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */
if (r->Link.usherToken.av_len) if (r->Link.usherToken.av_len)
SendUsherToken(r, &r->Link.usherToken); SendUsherToken(r, &r->Link.usherToken);
@ -2992,14 +3006,17 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
} }
else if (AVMATCH(&methodInvoked, &av_createStream)) else if (AVMATCH(&methodInvoked, &av_createStream))
{ {
sp(12);
r->m_stream_id = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3)); r->m_stream_id = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3));
if (r->Link.protocol & RTMP_FEATURE_WRITE) if (r->Link.protocol & RTMP_FEATURE_WRITE)
{ {
sp(13);
SendPublish(r); SendPublish(r);
} }
else else
{ {
sp(14);
if (r->Link.lFlags & RTMP_LF_PLST) if (r->Link.lFlags & RTMP_LF_PLST)
SendPlaylist(r); SendPlaylist(r);
SendPlay(r); SendPlay(r);
@ -3009,44 +3026,53 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
else if (AVMATCH(&methodInvoked, &av_play) || else if (AVMATCH(&methodInvoked, &av_play) ||
AVMATCH(&methodInvoked, &av_publish)) AVMATCH(&methodInvoked, &av_publish))
{ {
sp(15);
r->m_bPlaying = TRUE; r->m_bPlaying = TRUE;
} }
free(methodInvoked.av_val); free(methodInvoked.av_val);
} }
else if (AVMATCH(&method, &av_onBWDone)) else if (AVMATCH(&method, &av_onBWDone))
{ {
sp(16);
if (!r->m_nBWCheckCounter) if (!r->m_nBWCheckCounter)
SendCheckBW(r); SendCheckBW(r);
} }
else if (AVMATCH(&method, &av_onFCSubscribe)) else if (AVMATCH(&method, &av_onFCSubscribe))
{ {
sp(17);
/* SendOnFCSubscribe(); */ /* SendOnFCSubscribe(); */
} }
else if (AVMATCH(&method, &av_onFCUnsubscribe)) else if (AVMATCH(&method, &av_onFCUnsubscribe))
{ {
sp(18);
RTMP_Close(r); RTMP_Close(r);
ret = 1; ret = 1;
} }
else if (AVMATCH(&method, &av_ping)) else if (AVMATCH(&method, &av_ping))
{ {
sp(19);
SendPong(r, txn); SendPong(r, txn);
} }
else if (AVMATCH(&method, &av__onbwcheck)) else if (AVMATCH(&method, &av__onbwcheck))
{ {
sp(20);
SendCheckBWResult(r, txn); SendCheckBWResult(r, txn);
} }
else if (AVMATCH(&method, &av__onbwdone)) else if (AVMATCH(&method, &av__onbwdone))
{ {
sp(21);
int i; int i;
for (i = 0; i < r->m_numCalls; i++) for (i = 0; i < r->m_numCalls; i++)
if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw)) if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw))
{ {
sp(22);
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
break; break;
} }
} }
else if (AVMATCH(&method, &av__error)) else if (AVMATCH(&method, &av__error))
{ {
sp(23);
#ifdef CRYPTO #ifdef CRYPTO
AVal methodInvoked = {0}; AVal methodInvoked = {0};
int i; int i;
@ -3096,16 +3122,19 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
} }
free(methodInvoked.av_val); free(methodInvoked.av_val);
#else #else
sp(24);
RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); RTMP_Log(RTMP_LOGERROR, "rtmp server sent error");
#endif #endif
} }
else if (AVMATCH(&method, &av_close)) else if (AVMATCH(&method, &av_close))
{ {
sp(25);
RTMP_Log(RTMP_LOGERROR, "rtmp server requested close"); RTMP_Log(RTMP_LOGERROR, "rtmp server requested close");
RTMP_Close(r); RTMP_Close(r);
} }
else if (AVMATCH(&method, &av_onStatus)) else if (AVMATCH(&method, &av_onStatus))
{ {
sp(26);
AMFObject obj2; AMFObject obj2;
AVal code, level; AVal code, level;
AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2); AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2);
@ -3118,6 +3147,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|| AVMATCH(&code, &av_NetStream_Play_StreamNotFound) || AVMATCH(&code, &av_NetStream_Play_StreamNotFound)
|| AVMATCH(&code, &av_NetConnection_Connect_InvalidApp)) || AVMATCH(&code, &av_NetConnection_Connect_InvalidApp))
{ {
sp(27);
r->m_stream_id = -1; r->m_stream_id = -1;
RTMP_Close(r); RTMP_Close(r);
RTMP_Log(RTMP_LOGERROR, "Closing connection: %s", code.av_val); RTMP_Log(RTMP_LOGERROR, "Closing connection: %s", code.av_val);
@ -3126,12 +3156,14 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
else if (AVMATCH(&code, &av_NetStream_Play_Start) else if (AVMATCH(&code, &av_NetStream_Play_Start)
|| AVMATCH(&code, &av_NetStream_Play_PublishNotify)) || AVMATCH(&code, &av_NetStream_Play_PublishNotify))
{ {
sp(28);
int i; int i;
r->m_bPlaying = TRUE; r->m_bPlaying = TRUE;
for (i = 0; i < r->m_numCalls; i++) for (i = 0; i < r->m_numCalls; i++)
{ {
if (AVMATCH(&r->m_methodCalls[i].name, &av_play)) if (AVMATCH(&r->m_methodCalls[i].name, &av_play))
{ {
sp(29);
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
break; break;
} }
@ -3140,12 +3172,14 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
else if (AVMATCH(&code, &av_NetStream_Publish_Start)) else if (AVMATCH(&code, &av_NetStream_Publish_Start))
{ {
sp(30);
int i; int i;
r->m_bPlaying = TRUE; r->m_bPlaying = TRUE;
for (i = 0; i < r->m_numCalls; i++) for (i = 0; i < r->m_numCalls; i++)
{ {
if (AVMATCH(&r->m_methodCalls[i].name, &av_publish)) if (AVMATCH(&r->m_methodCalls[i].name, &av_publish))
{ {
sp(31);
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
break; break;
} }
@ -3157,19 +3191,23 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
|| AVMATCH(&code, &av_NetStream_Play_Stop) || AVMATCH(&code, &av_NetStream_Play_Stop)
|| AVMATCH(&code, &av_NetStream_Play_UnpublishNotify)) || AVMATCH(&code, &av_NetStream_Play_UnpublishNotify))
{ {
sp(32);
RTMP_Close(r); RTMP_Close(r);
ret = 1; ret = 1;
} }
else if (AVMATCH(&code, &av_NetStream_Seek_Notify)) else if (AVMATCH(&code, &av_NetStream_Seek_Notify))
{ {
sp(33);
r->m_read.flags &= ~RTMP_READ_SEEKING; r->m_read.flags &= ~RTMP_READ_SEEKING;
} }
else if (AVMATCH(&code, &av_NetStream_Pause_Notify)) else if (AVMATCH(&code, &av_NetStream_Pause_Notify))
{ {
sp(34);
if (r->m_pausing == 1 || r->m_pausing == 2) if (r->m_pausing == 1 || r->m_pausing == 2)
{ {
sp(35);
RTMP_SendPause(r, FALSE, r->m_pauseStamp); RTMP_SendPause(r, FALSE, r->m_pauseStamp);
r->m_pausing = 3; r->m_pausing = 3;
} }
@ -3177,11 +3215,13 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
} }
else if (AVMATCH(&method, &av_playlist_ready)) else if (AVMATCH(&method, &av_playlist_ready))
{ {
sp(36);
int i; int i;
for (i = 0; i < r->m_numCalls; i++) for (i = 0; i < r->m_numCalls; i++)
{ {
if (AVMATCH(&r->m_methodCalls[i].name, &av_set_playlist)) if (AVMATCH(&r->m_methodCalls[i].name, &av_set_playlist))
{ {
sp(37);
AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE);
break; break;
} }
@ -3189,9 +3229,11 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
} }
else else
{ {
sp(38);
} }
sp(39);
leave: leave:
sp(40);
AMF_Reset(&obj); AMF_Reset(&obj);
return ret; return ret;
} }
@ -4333,7 +4375,7 @@ RTMPSockBuf_Close(RTMPSockBuf *sb)
#define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf)) #define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf))
static void void
DecodeTEA(AVal *key, AVal *text) DecodeTEA(AVal *key, AVal *text)
{ {
uint32_t *v, k[4] = { 0 }, u; uint32_t *v, k[4] = { 0 }, u;

View File

@ -292,23 +292,14 @@ extern "C"
void AV_clear(RTMP_METHOD *vals, int num); void AV_clear(RTMP_METHOD *vals, int num);
void SocksSetup(RTMP *r, AVal *sockshost); void SocksSetup(RTMP *r, AVal *sockshost);
int SocksNegotiate(RTMP *r); int SocksNegotiate(RTMP *r);
int SendFCUnpublish(RTMP *r); int SendFCUnpublish(RTMP *r);
int HandShake(RTMP *r, int FP9HandShake); int HandShake(RTMP *r, int FP9HandShake);
int DecodeInt32LE(const char *data); int DecodeInt32LE(const char *data);
int SendBytesReceived(RTMP *r); int SendBytesReceived(RTMP *r);
int SendConnectPacket(RTMP *r, RTMPPacket *cp); int SendConnectPacket(RTMP *r, RTMPPacket *cp);
int SendDeleteStream(RTMP *r, double dStreamId); int SendDeleteStream(RTMP *r, double dStreamId);
int ReadN(RTMP *r, char *buffer, int n); int ReadN(RTMP *r, char *buffer, int n);
int HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize); int HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize);
int HandleMetadata(RTMP *r, char *body, unsigned int len); int HandleMetadata(RTMP *r, char *body, unsigned int len);
void HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet); void HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet);
@ -317,8 +308,6 @@ extern "C"
void HandleCtrl(RTMP *r, const RTMPPacket *packet); void HandleCtrl(RTMP *r, const RTMPPacket *packet);
void HandleServerBW(RTMP *r, const RTMPPacket *packet); void HandleServerBW(RTMP *r, const RTMPPacket *packet);
void HandleClientBW(RTMP *r, const RTMPPacket *packet); void HandleClientBW(RTMP *r, const RTMPPacket *packet);
int RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg); int RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg);
int RTMP_SetupURL(RTMP *r, char *url); int RTMP_SetupURL(RTMP *r, char *url);
void RTMP_SetupStream(RTMP *r, int protocol, void RTMP_SetupStream(RTMP *r, int protocol,
@ -338,14 +327,19 @@ extern "C"
AVal *usherToken, AVal *usherToken,
int dStart, int dStart,
int dStop, int bLiveStream, long int timeout); int dStop, int bLiveStream, long int timeout);
int RTMP_Connect(RTMP *r, RTMPPacket *cp); int RTMP_Connect(RTMP *r, RTMPPacket *cp);
struct sockaddr; struct sockaddr;
int RTMP_Connect0(RTMP *r, struct sockaddr *svc); int RTMP_Connect0(RTMP *r, struct sockaddr *svc);
int RTMP_Connect1(RTMP *r, RTMPPacket *cp); int RTMP_Connect1(RTMP *r, RTMPPacket *cp);
int RTMP_Serve(RTMP *r); int RTMP_Serve(RTMP *r);
int RTMP_TLS_Accept(RTMP *r, void *ctx); int RTMP_TLS_Accept(RTMP *r, void *ctx);
int SendCheckBW(RTMP *r);
int SendCheckBWResult(RTMP *r, double txn);
int SendDeleteStream(RTMP *r, double dStreamId);
int SendFCSubscribe(RTMP *r, AVal *subscribepath);
int SendPlay(RTMP *r);
int SendBytesReceived(RTMP *r);
int SendUsherToken(RTMP *r, AVal *usherToken);
int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet); int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet);
int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue); int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue);
int RTMP_SendChunk(RTMP *r, RTMPChunk *chunk); int RTMP_SendChunk(RTMP *r, RTMPChunk *chunk);
@ -354,25 +348,20 @@ extern "C"
int RTMP_IsTimedout(RTMP *r); int RTMP_IsTimedout(RTMP *r);
double RTMP_GetDuration(RTMP *r); double RTMP_GetDuration(RTMP *r);
int RTMP_ToggleStream(RTMP *r); int RTMP_ToggleStream(RTMP *r);
int RTMP_ConnectStream(RTMP *r, int seekTime); int RTMP_ConnectStream(RTMP *r, int seekTime);
int RTMP_ReconnectStream(RTMP *r, int seekTime); int RTMP_ReconnectStream(RTMP *r, int seekTime);
void RTMP_DeleteStream(RTMP *r); void RTMP_DeleteStream(RTMP *r);
int RTMP_GetNextMediaPacket(RTMP *r, RTMPPacket *packet); int RTMP_GetNextMediaPacket(RTMP *r, RTMPPacket *packet);
int RTMP_ClientPacket(RTMP *r, RTMPPacket *packet); int RTMP_ClientPacket(RTMP *r, RTMPPacket *packet);
void RTMP_Init(RTMP *r); void RTMP_Init(RTMP *r);
void RTMP_Close(RTMP *r); void RTMP_Close(RTMP *r);
RTMP *RTMP_Alloc(void); RTMP *RTMP_Alloc(void);
void RTMP_Free(RTMP *r); void RTMP_Free(RTMP *r);
void RTMP_EnableWrite(RTMP *r); void RTMP_EnableWrite(RTMP *r);
void *RTMP_TLS_AllocServerContext(const char* cert, const char* key); void *RTMP_TLS_AllocServerContext(const char* cert, const char* key);
void RTMP_TLS_FreeServerContext(void *ctx); void RTMP_TLS_FreeServerContext(void *ctx);
int RTMP_LibVersion(void); int RTMP_LibVersion(void);
void RTMP_UserInterrupt(void); /* user typed Ctrl-C */ void RTMP_UserInterrupt(void); /* user typed Ctrl-C */
int RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, int RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject,
unsigned int nTime); unsigned int nTime);
@ -381,14 +370,11 @@ extern "C"
*/ */
int RTMP_SendPause(RTMP *r, int DoPause, int dTime); int RTMP_SendPause(RTMP *r, int DoPause, int dTime);
int RTMP_Pause(RTMP *r, int DoPause); int RTMP_Pause(RTMP *r, int DoPause);
int RTMP_FindFirstMatchingProperty(AMFObject *obj, const AVal *name, int RTMP_FindFirstMatchingProperty(AMFObject *obj, const AVal *name,
AMFObjectProperty * p); AMFObjectProperty * p);
int RTMPSockBuf_Fill(RTMPSockBuf *sb); int RTMPSockBuf_Fill(RTMPSockBuf *sb);
int RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len); int RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len);
int RTMPSockBuf_Close(RTMPSockBuf *sb); int RTMPSockBuf_Close(RTMPSockBuf *sb);
int RTMP_SendCreateStream(RTMP *r); int RTMP_SendCreateStream(RTMP *r);
int RTMP_SendSeek(RTMP *r, int dTime); int RTMP_SendSeek(RTMP *r, int dTime);
int RTMP_SendServerBW(RTMP *r); int RTMP_SendServerBW(RTMP *r);
@ -396,7 +382,14 @@ extern "C"
void RTMP_DropRequest(RTMP *r, int i, int freeit); void RTMP_DropRequest(RTMP *r, int i, int freeit);
int RTMP_Read(RTMP *r, char *buf, int size); int RTMP_Read(RTMP *r, char *buf, int size);
int RTMP_Write(RTMP *r, const char *buf, int size); int RTMP_Write(RTMP *r, const char *buf, int size);
void AV_erase(RTMP_METHOD *vals, int *num, int i, int freeit);
void DecodeTEA(AVal *key, AVal *text);
int SendFCPublish(RTMP *r);
int SendPlaylist(RTMP *r);
int SendPong(RTMP *r, double txn);
int SendPublish(RTMP *r);
int SendReleaseStream(RTMP *r);
int SendSecureTokenResponse(RTMP *r, AVal *resp);
/* hashswf.c */ /* hashswf.c */
int RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash, int RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash,
int age); int age);