luat_iotauth.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef LUAT_LCD
  2. #define LUAT_LCD
  3. #define CLIENT_ID_LEN 192
  4. #define USER_NAME_LEN 192
  5. #define PASSWORD_LEN 256
  6. typedef struct iotauth_ctx
  7. {
  8. char client_id[CLIENT_ID_LEN];
  9. char user_name[USER_NAME_LEN];
  10. char password[PASSWORD_LEN];
  11. }iotauth_ctx_t;
  12. typedef struct iotauth_onenet {
  13. const char* product_id;
  14. const char* device_name;
  15. const char* device_secret;
  16. long long cur_timestamp;
  17. const char* method;
  18. const char* version;
  19. const char* res;
  20. }iotauth_onenet_t;
  21. /**
  22. *@brief 阿里云获取三元组信息
  23. *@param ctx iotauth_ctx_t 获取的三元组信息
  24. *@param product_key 产品密钥
  25. *@param device_name 设备名称
  26. *@param device_secret 设备秘钥
  27. *@param cur_timestamp 时间戳
  28. *@param method 加密方式
  29. *@param is_tls 是否 tls
  30. *@return 成功为0,其他值失败
  31. */
  32. int luat_aliyun_token(iotauth_ctx_t* ctx,const char* product_key,const char* device_name,const char* device_secret,long long cur_timestamp,const char* method,uint8_t is_tls);
  33. /**
  34. *@brief onenet获取三元组信息
  35. *@param ctx iotauth_ctx_t 获取的三元组信息
  36. *@param onenet onenet传入结构体信息
  37. *@return 成功为0,其他值失败
  38. */
  39. int luat_onenet_token(iotauth_ctx_t* ctx,const iotauth_onenet_t* onenet);
  40. /**
  41. *@brief 华为物联网获取三元组信息
  42. *@param ctx iotauth_ctx_t 获取的三元组信息
  43. *@param device_id 设备id
  44. *@param device_secret 设备秘钥
  45. *@param cur_timestamp 时间戳
  46. *@param ins_timestamp 是否校验时间戳
  47. *@return 成功为0,其他值失败
  48. */
  49. int luat_iotda_token(iotauth_ctx_t* ctx,const char* device_id,const char* device_secret,long long cur_timestamp,int ins_timestamp);
  50. /**
  51. *@brief 腾讯获取三元组信息
  52. *@param ctx iotauth_ctx_t 获取的三元组信息
  53. *@param product_id 产品id
  54. *@param device_name 设备名称
  55. *@param device_secret 设备秘钥
  56. *@param cur_timestamp 时间戳
  57. *@param method 加密方式
  58. *@param sdk_appid appid
  59. *@return 成功为0,其他值失败
  60. */
  61. int luat_qcloud_token(iotauth_ctx_t* ctx,const char* product_id,const char* device_name,const char* device_secret,long long cur_timestamp,const char* method,const char* sdk_appid);
  62. /**
  63. *@brief 涂鸦获取三元组信息
  64. *@param ctx iotauth_ctx_t 获取的三元组信息
  65. *@param device_id 设备id
  66. *@param device_secret 设备秘钥
  67. *@param cur_timestamp 时间戳
  68. *@return 成功为0,其他值失败
  69. */
  70. int luat_tuya_token(iotauth_ctx_t* ctx,const char* device_id,const char* device_secret,long long cur_timestamp);
  71. /**
  72. *@brief 腾讯获取三元组信息
  73. *@param ctx iotauth_ctx_t 获取的三元组信息
  74. *@param iot_core_id iot_core_idid
  75. *@param device_key 设备key
  76. *@param device_secret 设备秘钥
  77. *@param method 加密方式
  78. *@param cur_timestamp 时间戳
  79. *@return 成功为0,其他值失败
  80. */
  81. int luat_baidu_token(iotauth_ctx_t* ctx,const char* iot_core_id,const char* device_key,const char* device_secret,const char* method,long long cur_timestamp);
  82. #endif