Andrew Boyson / net

Dependents:   oldheating gps motorhome heating

Files at this revision

API Documentation at this revision

Comitter:
andrewboyson
Date:
Wed Jul 31 15:10:53 2019 +0000
Parent:
153:638c21b06d3e
Child:
155:22f249751106
Commit message:
Amalgamated Reply into Poll function

Changed in this revision

tcp/http/http.c Show annotated file Show diff for this revision Revisions of this file
tcp/http/http.h Show annotated file Show diff for this revision Revisions of this file
tcp/http/httpshim/httpshim.c Show annotated file Show diff for this revision Revisions of this file
tcp/http/httpshim/httpshim.h Show annotated file Show diff for this revision Revisions of this file
tcp/tcb.h Show annotated file Show diff for this revision Revisions of this file
tcp/tcpsend.c Show annotated file Show diff for this revision Revisions of this file
--- a/tcp/http/http.c	Fri Jul 26 13:51:14 2019 +0000
+++ b/tcp/http/http.c	Wed Jul 31 15:10:53 2019 +0000
@@ -6,4 +6,3 @@
 //Plumb into these from your html server
 void (*HttpRequestFunction)(char* pState, int size, char* pRequestStream, uint32_t positionInRequestStream);
 bool (*HttpPollFunction   )(char* pState, bool clientFinished);
-bool (*HttpReplyFunction  )(char* pState);
--- a/tcp/http/http.h	Fri Jul 26 13:51:14 2019 +0000
+++ b/tcp/http/http.h	Wed Jul 31 15:10:53 2019 +0000
@@ -49,6 +49,5 @@
 #define HTTP_DATE_LENGTH 30
 
 extern void (*HttpRequestFunction)(char* pState, int size, char* pRequestStream, uint32_t positionInRequestStream);
-extern int  (*HttpPollFunction   )(char* pState, bool clientFinished);
-extern bool (*HttpReplyFunction  )(char* pState);
+extern bool (*HttpPollFunction   )(char* pState, bool clientFinished);
 
--- a/tcp/http/httpshim/httpshim.c	Fri Jul 26 13:51:14 2019 +0000
+++ b/tcp/http/httpshim/httpshim.c	Wed Jul 31 15:10:53 2019 +0000
@@ -24,11 +24,6 @@
     if (tlsRequired) return TlsPoll         (pTlsState, pWebState, clientFinished);
     else             return HttpPollFunction(           pWebState, clientFinished);
 }
-bool HttpShimReply(char* pWebState, char* pTlsState)
-{
-    if (tlsRequired) return TlsReply         (pTlsState, pWebState);
-    else             return HttpReplyFunction(           pWebState);
-}
 void HttpShimAddChar  (char c)
 {
     if (tlsRequired) TlsAddChar(c);
--- a/tcp/http/httpshim/httpshim.h	Fri Jul 26 13:51:14 2019 +0000
+++ b/tcp/http/httpshim/httpshim.h	Wed Jul 31 15:10:53 2019 +0000
@@ -3,7 +3,6 @@
 
 extern void HttpShimRequest  (int size, char* pRequestStream, uint32_t positionInRequestStream, char* pWebState, char* pTlsState, bool secure);
 extern bool HttpShimPoll     (bool clientFinished,                                              char* pWebState, char* pTlsState, bool secure);
-extern bool HttpShimReply    (                                                                  char* pWebState, char* pTlsState);
 extern void HttpShimAddChar  (char c);
 extern bool HttpShimBufFilled(void);
 extern bool HttpShimGetTrace (void);
\ No newline at end of file
--- a/tcp/tcb.h	Fri Jul 26 13:51:14 2019 +0000
+++ b/tcp/tcb.h	Wed Jul 31 15:10:53 2019 +0000
@@ -38,7 +38,7 @@
     
     bool     appStarted;                   //Set when data has been sent to the app.
     char     appData[TCB_APP_STATE_BYTES]; //This is just a place for the app to hold state information - it has no function in TCP.
-    char     tlsData[TCB_TLS_STATE_BYTES]; //This is just a place for the app to hold state information - it has no function in TCP.
+    char     tlsData[TCB_TLS_STATE_BYTES]; //This is just a place for TLS     to hold state information - it has no function in TCP.
 };
 
 extern uint32_t    TcbGetIsn(void);
--- a/tcp/tcpsend.c	Fri Jul 26 13:51:14 2019 +0000
+++ b/tcp/tcpsend.c	Wed Jul 31 15:10:53 2019 +0000
@@ -46,26 +46,13 @@
 
 static bool addAppData(int *pDataLength, void* pPacket, uint16_t port, uint32_t start, int mss, char* pAppState, char* pTlsState, bool clientFinished)
 {
-    *pDataLength = 0;
-    int todo = 0;
-    switch (port)
-    {
-        case  80: todo = HttpShimPoll(clientFinished, pAppState, pTlsState, false); break;
-        case 443: todo = HttpShimPoll(clientFinished, pAppState, pTlsState, true ); break;
-    }
-    switch (todo)
-    {
-        case -1: return true;
-        case  0: return false;
-        case  1: break;
-    }
     char* pData = (char*)pPacket + TcpHdrSizeGet();
     TcpBufStart(start, mss, pData);
     bool finished = false;
     switch (port)
     {
-        case  80: finished = HttpShimReply(pAppState, pTlsState); break;
-        case 443: finished = HttpShimReply(pAppState, pTlsState); break;
+        case  80: finished = HttpShimPoll(clientFinished, pAppState, pTlsState, false); break;
+        case 443: finished = HttpShimPoll(clientFinished, pAppState, pTlsState, true ); break;
     }
     *pDataLength = TcpBufLength();
     return finished;