Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Security.SecureRepository / Tizen.Security.SecureRepository / SafeAliasListHandle.cs
1 /*
2  *  Copyright (c) 2016 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 using System;
18 using System.Collections.Generic;
19 using System.Runtime.InteropServices;
20 using static Interop;
21
22 namespace Tizen.Security.SecureRepository
23 {
24     internal class SafeAliasListHandle
25     {
26         public SafeAliasListHandle(IntPtr ptr)
27         {
28             var cur = ptr;
29             var aliases = new List<string>();
30             while (cur != IntPtr.Zero)
31             {
32                 var ckmcAliasList = Marshal.PtrToStructure<Interop.CkmcAliasList>(cur);
33                 aliases.Add(Marshal.PtrToStringAnsi(ckmcAliasList.alias));
34                 cur = ckmcAliasList.next;
35             }
36
37             this.Aliases = aliases;
38         }
39
40         public List<string> Aliases
41         {
42             get; set;
43         }
44     }
45 }