51Degrees Common C/C++  4.1

A shared functionality library that is used by 51Degrees products

component.h

1 /* *********************************************************************
2  * This Source Code Form is copyright of 51 Degrees Mobile Experts Limited.
3  * Copyright 2019 51 Degrees Mobile Experts Limited, 5 Charlotte Close,
4  * Caversham, Reading, Berkshire, United Kingdom RG4 7BY
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0.
8  *
9  * If a copy of the MPL was not distributed with this file, You can obtain
10  * one at http://mozilla.org/MPL/2.0/.
11  *
12  * This Source Code Form is "Incompatible With Secondary Licenses", as
13  * defined by the Mozilla Public License, v. 2.0.
14  * ******************************************************************** */
15 
16 #ifndef FIFTYONE_DEGREES_COMPONENT_H_INCLUDED
17 #define FIFTYONE_DEGREES_COMPONENT_H_INCLUDED
18 
42 #include <stdint.h>
43 #ifdef _MSC_VER
44 #include <windows.h>
45 #endif
46 #include "data.h"
47 #include "exceptions.h"
48 #include "collection.h"
49 #include "list.h"
50 #include "string.h"
51 
52 #ifdef __cplusplus
53 #define EXTERNAL extern "C"
54 #else
55 #define EXTERNAL
56 #endif
57 
62 #pragma pack(push, 1)
63 typedef struct fiftyoneDegrees_component_t {
64  const byte componentId;
65  const int32_t nameOffset;
67  const int32_t defaultProfileOffset;
69  const uint16_t httpHeaderCount;
71  const uint32_t httpHeaderFirstOffset;
74 #pragma pack(pop)
75 
88  fiftyoneDegreesCollection *stringsCollection,
89  fiftyoneDegreesComponent *component,
91  fiftyoneDegreesException *exception);
92 
105  fiftyoneDegreesComponent *component,
106  uint16_t index,
107  fiftyoneDegreesCollection *strings,
109  fiftyoneDegreesException *exception);
110 
121  fiftyoneDegreesCollection *components,
122  fiftyoneDegreesList *list,
123  uint32_t count,
124  fiftyoneDegreesException *exception);
125 
126 #ifndef FIFTYONE_DEGREES_MEMORY_ONLY
127 
139  const fiftyoneDegreesCollectionFile *file,
140  uint32_t offset,
141  fiftyoneDegreesData *data,
142  fiftyoneDegreesException *exception);
143 
144 #endif
145 
155  fiftyoneDegreesCollection *profiles,
156  fiftyoneDegreesComponent *component,
157  fiftyoneDegreesException *exception);
158 
163 #endif
A component of a data set.
Definition: component.h:63
void * fiftyoneDegreesComponentReadFromFile(const fiftyoneDegreesCollectionFile *file, uint32_t offset, fiftyoneDegreesData *data, fiftyoneDegreesException *exception)
Read a component from the file collection provided and store in the data pointer.
Definition: component.c:78
const int32_t nameOffset
Offset in the strings data structure to the name.
Definition: component.h:65
Used to store a handle to the underlying item that could be used to release the item when it's finish...
Definition: collection.h:302
Type of collection where the collection is streamed from file.
Definition: collection.h:437
const uint16_t httpHeaderCount
The number of HTTP header offsets at httpHeaderFirstOffset.
Definition: component.h:69
String structure containing its value and size.
Definition: string.h:80
Data structure used for reusing memory which may have been allocated in a previous operation.
Definition: data.h:99
uint32_t fiftyoneDegreesComponentGetHttpHeader(fiftyoneDegreesComponent *component, uint16_t index, fiftyoneDegreesCollection *strings, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Get the offset in the strings collection for the name of the HTTP header at the specified index withi...
Definition: component.c:58
const byte componentId
The unique Id of the component.
Definition: component.h:64
void fiftyoneDegreesComponentInitList(fiftyoneDegreesCollection *components, fiftyoneDegreesList *list, uint32_t count, fiftyoneDegreesException *exception)
Initialises the list of components.
Definition: component.c:96
List structure which contains a list of collection items.
Definition: list.h:110
EXTERNAL uint32_t fiftyoneDegreesComponentGetDefaultProfileId(fiftyoneDegreesCollection *profiles, fiftyoneDegreesComponent *component, fiftyoneDegreesException *exception)
Get the default profile id for the component provided.
Definition: component.c:26
const uint32_t httpHeaderFirstOffset
The first HTTP header string offset.
Definition: component.h:71
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:109
EXTERNAL fiftyoneDegreesString * fiftyoneDegreesComponentGetName(fiftyoneDegreesCollection *stringsCollection, fiftyoneDegreesComponent *component, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Returns the string name of the component using the item provided.
Definition: component.c:46
const int32_t defaultProfileOffset
Offset in the profiles data structure to the default profile.
Definition: component.h:67
All the shared methods and fields required by file, memory and cached collections.
Definition: collection.h:400