Andrew Boyson / net

Dependents:   oldheating gps motorhome heating

Files at this revision

API Documentation at this revision

Comitter:
andrewboyson
Date:
Sun Sep 01 18:14:13 2019 +0000
Parent:
156:be12b8fd5b21
Child:
158:3adf725c0804
Commit message:
Tidied parameter order in HttpShim

Changed in this revision

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/tcprecv.c 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/httpshim/httpshim.c	Wed Aug 28 07:11:58 2019 +0000
+++ b/tcp/http/httpshim/httpshim.c	Sun Sep 01 18:14:13 2019 +0000
@@ -10,19 +10,19 @@
 It means HTTP does not need to know if it is talking directly to TCP as HTTP or via TLS in the form of HTTPS.
 It means TCP  does not need to know if it is talking directly to HTTP or via TLS.
 */
-void HttpShimReset(int connection, bool secure)
+void HttpShimReset(bool secure, int connection)
 {
     if (secure) TlsReset(connection); //Only reset TLS if appropriate
     HttpFunctionReset(connection);    //Always reset Http
 }
-void HttpShimRequest(int connection, bool secure, int size, char* pRequestStream, uint32_t positionInRequestStream)
+void HttpShimRequest(bool secure, int connection, int size, char* pRequestStream, uint32_t positionInRequestStream)
 {
     if (secure) TlsRequest         (connection, size, (uint8_t*)pRequestStream, positionInRequestStream);
     else        HttpFunctionRequest(connection, size,           pRequestStream, positionInRequestStream);
 }
 
 static bool tlsRequired;
-bool HttpShimPoll (int connection, bool secure, bool clientFinished)
+bool HttpShimPoll (bool secure, int connection, bool clientFinished)
 {
     tlsRequired = secure;
     if (tlsRequired) return TlsPoll         (connection, clientFinished);
@@ -38,8 +38,8 @@
 {
     return TcpBufFilled();
 }
-bool HttpShimGetTrace()
+bool HttpShimGetTrace(bool secure)
 {
-    if (tlsRequired) return  TlsTrace;
-    else             return HttpTrace;
+    if (secure) return HttpTrace || TlsTrace;
+    else        return HttpTrace;
 }
\ No newline at end of file
--- a/tcp/http/httpshim/httpshim.h	Wed Aug 28 07:11:58 2019 +0000
+++ b/tcp/http/httpshim/httpshim.h	Sun Sep 01 18:14:13 2019 +0000
@@ -1,9 +1,10 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-extern void HttpShimReset    (int connection, bool secure);
-extern void HttpShimRequest  (int connection, bool secure, int size, char* pRequestStream, uint32_t positionInRequestStream);
-extern bool HttpShimPoll     (int connection, bool secure, bool clientFinished);
+extern bool HttpShimGetTrace (bool secure);
+extern void HttpShimReset    (bool secure, int connection);
+extern void HttpShimRequest  (bool secure, int connection, int size, char* pRequestStream, uint32_t positionInRequestStream);
+extern bool HttpShimPoll     (bool secure, int connection, bool clientFinished);
+
 extern void HttpShimAddChar  (char c);
-extern bool HttpShimBufFilled(void);
-extern bool HttpShimGetTrace (void);
\ No newline at end of file
+extern bool HttpShimBufFilled(void);
\ No newline at end of file
--- a/tcp/tcprecv.c	Wed Aug 28 07:11:58 2019 +0000
+++ b/tcp/tcprecv.c	Sun Sep 01 18:14:13 2019 +0000
@@ -50,8 +50,8 @@
     pTcb->bytesSentToRem      = 0;
     switch (pTcb->locPort) //Reset the application
     {
-        case  80: HttpShimReset(TcbGetId(pTcb), false); break;
-        case 443: HttpShimReset(TcbGetId(pTcb), true ); break;
+        case  80: HttpShimReset(false, TcbGetId(pTcb)); break;
+        case 443: HttpShimReset(true,  TcbGetId(pTcb)); break;
     }
 }
 static void handleReceivedData(void* pPacket, int dataLength, uint32_t position, struct tcb* pTcb)
@@ -60,8 +60,8 @@
     char* pData = (char*)pPacket + TcpHdrSizeGet();
     switch (pTcb->locPort)
     {
-        case  80: HttpShimRequest(TcbGetId(pTcb), false, dataLength, pData, position); break;
-        case 443: HttpShimRequest(TcbGetId(pTcb), true,  dataLength, pData, position); break;
+        case  80: HttpShimRequest(false, TcbGetId(pTcb), dataLength, pData, position); break;
+        case 443: HttpShimRequest(true,  TcbGetId(pTcb), dataLength, pData, position); break;
     }
 }
 static int sendResetFromPacket(int* pSizeTx, void* pPacketTx, int ipType, int remArIndex, int locIpScope, int seqLengthRcvd)
@@ -135,7 +135,7 @@
     switch (TcpHdrDstPort)
     {
         case 80:
-            if (HttpShimGetTrace())
+            if (HttpShimGetTrace(false))
             {
                 if (NetTraceNewLine) Log("\r\n");
                 LogTime("HTTP server request\r\n");
@@ -144,7 +144,7 @@
             break;
             
         case 443:
-            if (HttpShimGetTrace())
+            if (HttpShimGetTrace(true))
             {
                 if (NetTraceNewLine) Log("\r\n");
                 LogTime("HTTPS server request\r\n");
--- a/tcp/tcpsend.c	Wed Aug 28 07:11:58 2019 +0000
+++ b/tcp/tcpsend.c	Sun Sep 01 18:14:13 2019 +0000
@@ -38,8 +38,8 @@
 {
     switch (port)
     {
-        case  80:
-        case 443: return HttpShimGetTrace();
+        case  80: return HttpShimGetTrace(false);
+        case 443: return HttpShimGetTrace(true );
         default:  return false;
     }    
 }
@@ -51,8 +51,8 @@
     bool finished = false;
     switch (port)
     {
-        case  80: finished = HttpShimPoll(connection, clientFinished, false); break;
-        case 443: finished = HttpShimPoll(connection, clientFinished, true ); break;
+        case  80: finished = HttpShimPoll(false, connection, clientFinished); break;
+        case 443: finished = HttpShimPoll(true,  connection, clientFinished); break;
     }
     *pDataLength = TcpBufLength();
     return finished;