Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Diff: tcp/https/https.c
- Revision:
- 145:206bf0d073c7
- Parent:
- 144:6bd5c54efc7d
- Child:
- 146:0fc66d610fd6
--- a/tcp/https/https.c Sun May 12 17:17:49 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-#include <stdbool.h>
-
-#include "http.h"
-#include "tcpbuf.h"
-#include "action.h"
-#include "net.h"
-#include "log.h"
-#include "led.h"
-#include "restart.h"
-#include "mstimer.h"
-
-#define TLS_CONTENT_TYPE_ChangeCipher 20
-#define TLS_CONTENT_TYPE_Alert 21
-#define TLS_CONTENT_TYPE_Handshake 22
-#define TLS_CONTENT_TYPE_Application 23
-#define TLS_CONTENT_TYPE_Heartbeat 24
-
-#define TLS_HANDSHAKE_HelloRequest 0
-#define TLS_HANDSHAKE_ClientHello 1
-#define TLS_HANDSHAKE_ServerHello 2
-#define TLS_HANDSHAKE_NewSessionTicket 4
-#define TLS_HANDSHAKE_EncryptedExtensions 8
-#define TLS_HANDSHAKE_Certificate 11
-#define TLS_HANDSHAKE_ServerKeyExchange 12
-#define TLS_HANDSHAKE_CertificateRequest 13
-#define TLS_HANDSHAKE_ServerHelloDone 14
-#define TLS_HANDSHAKE_CertificateVerify 15
-#define TLS_HANDSHAKE_ClientKeyExchange 16
-#define TLS_HANDSHAKE_Finished 20
-
-#define DO_SERVER_HELLO 100
-
-/*static void logHandshakeType(char handshakeType)
-{
- switch (handshakeType)
- {
- case TLS_HANDSHAKE_HelloRequest: Log ("Hello request"); break;
- case TLS_HANDSHAKE_ClientHello: Log ("Client hello"); break;
- case TLS_HANDSHAKE_ServerHello: Log ("Server hello"); break;
- case TLS_HANDSHAKE_NewSessionTicket: Log ("New session ticket"); break;
- case TLS_HANDSHAKE_EncryptedExtensions: Log ("Encrypted extensions"); break;
- case TLS_HANDSHAKE_Certificate: Log ("Certificate"); break;
- case TLS_HANDSHAKE_ServerKeyExchange: Log ("Server key exchange"); break;
- case TLS_HANDSHAKE_CertificateRequest: Log ("Certificate request"); break;
- case TLS_HANDSHAKE_ServerHelloDone: Log ("Server hello done"); break;
- case TLS_HANDSHAKE_CertificateVerify: Log ("Certificate verify"); break;
- case TLS_HANDSHAKE_ClientKeyExchange: Log ("Client key exchange"); break;
- case TLS_HANDSHAKE_Finished: Log ("Finished"); break;
- default: LogF("%02hX", handshakeType); break;
- }
-}
-static void logContentType(char contentType)
-{
- switch (contentType)
- {
- case TLS_CONTENT_TYPE_ChangeCipher: Log ("Change cipher"); break;
- case TLS_CONTENT_TYPE_Alert: Log ("Alert"); break;
- case TLS_CONTENT_TYPE_Handshake: Log ("Handshake"); break;
- case TLS_CONTENT_TYPE_Application: Log ("Application"); break;
- case TLS_CONTENT_TYPE_Heartbeat: Log ("Heartbeat"); break;
- default: LogF("%02hX", contentType); break;
- }
-}
-*/
-bool HttpsTrace = true;
-
-void HttpsHandleRequest(int size, char* pRequestStream, uint32_t positionInRequestStream, void* pData)
-{
- /*
- if (HttpsTrace)
- {
- LogF("HTTPS <<< %d (%u)\r\n", size, positionInRequestStream);
- }
- //Handle request for the first packet of data received but leave todo the same after that.
- if (size == 0) return;
- if (positionInRequestStream != 0) return;
- char contentType = pRequestStream[0];
- if (HttpsTrace) Log(" content type: "); logContentType(contentType); Log("\r\n");
- switch (contentType)
- {
- case TLS_CONTENT_TYPE_Handshake:
- {
- char handshakeType = pRequestStream[5];
- if (HttpsTrace) Log(" handshake type: "); logHandshakeType(handshakeType); Log("\r\n");
- *pToDo = DO_SERVER_HELLO;
- return;
- }
- default:
- Log("HTTPS - ignoring untreated content type\r\n");
- *pToDo = 0;
- return;
- }
- //ECDHE-RSA-AES128-GCM-SHA256
- */
-}
-/*static void sendServerHello()
-{
- Log(" sending server hello\r\n");
-}
-*/
-bool HttpsSendReply(int* pSize, char* pReplyStream, uint32_t positionInReplyStream, uint16_t mss, void* pData)
-{
- /*
- TcpBufStart(positionInReplyStream, mss, pReplyStream);
- if (todo == DO_SERVER_HELLO) sendServerHello();
- *pSize = TcpBufLength();
-
- if (HttpsTrace)
- {
- LogF("HTTPS >>> %d (%d)\r\n", *pSize, positionInReplyStream);
- }
- */
- return TCP_APP_FINISHED; //0: not started; +1: started; -1: finished
-}