use TCP to connect to mbed connector
Fork of mbedConnectorInterfaceWithDM by
mbed-connector-interface/Authenticator.h@13:9edad7677211, 2016-06-08 (annotated)
- Committer:
- ansond
- Date:
- Wed Jun 08 22:32:08 2016 +0000
- Revision:
- 13:9edad7677211
- Child:
- 41:8bfdf9cec934
updated to latest revision with new DM functions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 13:9edad7677211 | 1 | /** |
ansond | 13:9edad7677211 | 2 | * @file Authenticator.h |
ansond | 13:9edad7677211 | 3 | * @brief mbed CoAP Endpoint Device Management Authenticator class |
ansond | 13:9edad7677211 | 4 | * @author Doug Anson |
ansond | 13:9edad7677211 | 5 | * @version 1.0 |
ansond | 13:9edad7677211 | 6 | * @see |
ansond | 13:9edad7677211 | 7 | * |
ansond | 13:9edad7677211 | 8 | * Copyright (c) 2016 |
ansond | 13:9edad7677211 | 9 | * |
ansond | 13:9edad7677211 | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ansond | 13:9edad7677211 | 11 | * you may not use this file except in compliance with the License. |
ansond | 13:9edad7677211 | 12 | * You may obtain a copy of the License at |
ansond | 13:9edad7677211 | 13 | * |
ansond | 13:9edad7677211 | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
ansond | 13:9edad7677211 | 15 | * |
ansond | 13:9edad7677211 | 16 | * Unless required by applicable law or agreed to in writing, software |
ansond | 13:9edad7677211 | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
ansond | 13:9edad7677211 | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ansond | 13:9edad7677211 | 19 | * See the License for the specific language governing permissions and |
ansond | 13:9edad7677211 | 20 | * limitations under the License. |
ansond | 13:9edad7677211 | 21 | */ |
ansond | 13:9edad7677211 | 22 | |
ansond | 13:9edad7677211 | 23 | #ifndef __DM_AUTHENTICATOR_H__ |
ansond | 13:9edad7677211 | 24 | #define __DM_AUTHENTICATOR_H__ |
ansond | 13:9edad7677211 | 25 | |
ansond | 13:9edad7677211 | 26 | // Logger |
ansond | 13:9edad7677211 | 27 | #include "mbed-connector-interface/Logger.h" |
ansond | 13:9edad7677211 | 28 | |
ansond | 13:9edad7677211 | 29 | class Authenticator { |
ansond | 13:9edad7677211 | 30 | public: |
ansond | 13:9edad7677211 | 31 | /** |
ansond | 13:9edad7677211 | 32 | Default constructor |
ansond | 13:9edad7677211 | 33 | @param logger input logger instance |
ansond | 13:9edad7677211 | 34 | @param secret input secret |
ansond | 13:9edad7677211 | 35 | */ |
ansond | 13:9edad7677211 | 36 | Authenticator(const Logger *logger,const void *secret = NULL); |
ansond | 13:9edad7677211 | 37 | |
ansond | 13:9edad7677211 | 38 | /** |
ansond | 13:9edad7677211 | 39 | Copy constructor |
ansond | 13:9edad7677211 | 40 | @param resource input the Authenticator that is to be deep copied |
ansond | 13:9edad7677211 | 41 | */ |
ansond | 13:9edad7677211 | 42 | Authenticator(const Authenticator &manager); |
ansond | 13:9edad7677211 | 43 | |
ansond | 13:9edad7677211 | 44 | /** |
ansond | 13:9edad7677211 | 45 | Destructor |
ansond | 13:9edad7677211 | 46 | */ |
ansond | 13:9edad7677211 | 47 | virtual ~Authenticator(); |
ansond | 13:9edad7677211 | 48 | |
ansond | 13:9edad7677211 | 49 | /** |
ansond | 13:9edad7677211 | 50 | Set the secret |
ansond | 13:9edad7677211 | 51 | @param secret input the secret |
ansond | 13:9edad7677211 | 52 | */ |
ansond | 13:9edad7677211 | 53 | virtual void setSecret(void *secret); |
ansond | 13:9edad7677211 | 54 | |
ansond | 13:9edad7677211 | 55 | /** |
ansond | 13:9edad7677211 | 56 | Authenticate |
ansond | 13:9edad7677211 | 57 | @param challenge input the challenge to authenticate with |
ansond | 13:9edad7677211 | 58 | @return true - authenciated successfully, false - otherwise |
ansond | 13:9edad7677211 | 59 | */ |
ansond | 13:9edad7677211 | 60 | virtual bool authenticate(void *challenge); |
ansond | 13:9edad7677211 | 61 | |
ansond | 13:9edad7677211 | 62 | protected: |
ansond | 13:9edad7677211 | 63 | Logger *m_logger; |
ansond | 13:9edad7677211 | 64 | void *m_secret; |
ansond | 13:9edad7677211 | 65 | }; |
ansond | 13:9edad7677211 | 66 | |
ansond | 13:9edad7677211 | 67 | #endif // __DM_AUTHENTICATOR_H__ |