Method: Mosquitto::Client#tls_psk_set
- Defined in:
- ext/mosquitto/client.c
#tls_psk_set("deadbeef", "psk-id", nil) ⇒ Boolean
Note:
This must be called before calling Mosquitto::Client#connect
Configure the client for pre-shared-key based TLS support.
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
# File 'ext/mosquitto/client.c', line 887
static VALUE rb_mosquitto_client_tls_psk_set(VALUE obj, VALUE psk, VALUE identity, VALUE ciphers)
{
int ret;
MosquittoGetClient(obj);
Check_Type(psk, T_STRING);
Check_Type(identity, T_STRING);
if (!NIL_P(ciphers)) {
Check_Type(ciphers, T_STRING);
MosquittoEncode(ciphers);
}
ret = mosquitto_tls_psk_set(client->mosq, StringValueCStr(psk), StringValueCStr(identity), (NIL_P(ciphers) ? NULL : StringValueCStr(ciphers)));
switch (ret) {
case MOSQ_ERR_INVAL:
MosquittoError("invalid input params");
break;
case MOSQ_ERR_NOMEM:
rb_memerror();
break;
case MOSQ_ERR_NOT_SUPPORTED:
MosquittoError("TLS support is not available");
default:
return Qtrue;
}
}
|