b8b6c55822e4a86d4154b039a5ad1f91f0a4ea49
[platform/core/security/key-manager.git] / src / manager / service / ckm-service.h
1 /*
2  *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License
15  *
16  *
17  * @file        ckm-service.h
18  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version     1.0
20  * @brief       CKM service implementation.
21  */
22 #pragma once
23
24 #include <thread-service.h>
25 #include <message-buffer.h>
26 #include <dpl/exception.h>
27
28 namespace CKM {
29
30 class CKMLogic;
31
32 class CKMService : public CKM::ThreadService
33 {
34 public:
35     CKMService();
36     CKMService(const CKMService &) = delete;
37     CKMService(CKMService &&) = delete;
38     CKMService& operator=(const CKMService &) = delete;
39     CKMService& operator=(CKMService &&) = delete;
40
41     virtual void Start(void);
42     virtual void Stop(void);
43
44     virtual ~CKMService();
45
46     ServiceDescriptionVector GetServiceDescription();
47
48 private:
49     class Exception {
50     public:
51         DECLARE_EXCEPTION_TYPE(CKM::Exception, Base)
52         DECLARE_EXCEPTION_TYPE(Base, BrokenProtocol)
53     };
54
55     bool ProcessOne(
56         const ConnectionID &conn,
57         ConnectionInfo &info);
58
59     RawBuffer ProcessControl(
60         MessageBuffer &buffer);
61
62     RawBuffer ProcessStorage(
63         Credentials &cred,
64         MessageBuffer &buffer);
65
66     CKMLogic *m_logic;
67 };
68
69 } // namespace CKM
70