WiFi101 library - class Client

Hello

I'm using the wifi101 library in conjunction with the mqtt samples for connecting to google cloud platform. The example code fails to connect. While talking to the esp32 users in their thread on the same failure, they pointed me to a routine for setting root CA cert.

When I went to look for how to add the api, I noticed the two code bases use different networking stacks. I'm using the MKR1000 and it uses the wifi101.h and creates a Client *netClient. Later this pointer is instantiated with a netClient = new WiFiSSLClient();

So here is the problem. I'm trying to find the setcacert() or setRootCA() call the esp32/esp8266 code uses to fix the similar problem I have encountered. Looking at libraries/WiFi101/src, I examine WiFiSSLClient.h and notice it has a base class of WiFiClient. I examine the peer file WiFiClient in WiFiClient.h and notice it has a base class of Client. This file
also has a #include<Client.h>.

Now, when I look for Client.h, I don't find it in ~/Arduino/libraries. I do find a Client.h in the ~/arduino-1.8.13/hardware/arduino/avr/cores/arduino/Client.h Immediatly, I'm thinking the MKR1000 uses a samd core and not an 8-bit AVR core so this is problably not used. Then when I examine the class in that file, i notice it has a connect(host,port) routine. The connect routines in the wifi101 libs are a wrapper around connect() from the client base class. However the wifi101 classes use a connect routine where a third parameter is specified. ie connect(host,port,sock options). This does not match the one in the arduino sdk dir.

So, my question is where is the Client.h this code is including?

Hmm. Ok I've looked a little more

~/Arduino/libraries/WiFi101/src/WiFiClient.h
...
class WiFiClient : public Client {
connectSSL(ip, port)
....

~/Arduino/libraries/WiFi101/src/WiFiClient.cpp

// connectSSL calls connect(4 params)
int WiFiClient::connectSSL(IPAddress ip, uint16_t port) {
// This is connect(1,2,3,4 params) which is in this class
return connect(ip, port, SOCKET_FLAGS_SSL, 0);
}
...

// This is called from above
int WiFiClient::connect(const char* host, uint16_t port, uint8_t opt)
{
IPAddress remote_addr;
if (WiFi.hostByName(host, remote_addr)) {
// this connect is in this file as the connnect(4 params but host is last)
return connect(remote_addr, port, opt, (const uint8_t *)host);
}
return 0;
}
...

// the above calls this wrapper
int WiFiClient::connect(IPAddress ip, uint16_t port, uint8_t opt, const uint8_t *hostname) {

This file includes the "untility/WifiSocket.h" file. The routine above uses the WifiSocket class and its member function to implement the connect with SSL options.

Looking at the WiFiSocket.h file/class I don't see any setroot() calls. I also don't see any SSL related settings or switches. Hmm. I am currently at a lost.

On the upside, I found the Client.h file. Its in ~/.arduino15/packages/arduino/hardware/samd/1.8.11

Client is a common base class for network clients

A6pRZ