2 libmapiserver - MAPI library for Server side
6 Copyright (C) Julien Kerihuel 2010
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 \file libmapiserver_oxcdata.c
25 \brief OXCDATA Data Structures
28 #include "libmapiserver.h"
31 \details Calculate the size of a TypedString structure
33 \param typedstring TypedString structure
35 \return Size of typedstring structure
37 _PUBLIC_ uint16_t libmapiserver_TypedString_size(struct TypedString typedstring)
41 size += sizeof (uint8_t);
43 switch (typedstring.StringType) {
45 case StringType_EMPTY:
47 case StringType_STRING8:
48 if (typedstring.String.lpszA) {
49 size += strlen(typedstring.String.lpszA) + 1;
52 case StringType_UNICODE_REDUCED:
53 if (typedstring.String.lpszW_reduced) {
54 size += strlen(typedstring.String.lpszW_reduced) + 1;
57 case StringType_UNICODE:
58 if (typedstring.String.lpszW) {
59 size += strlen(typedstring.String.lpszW) * 2 + 2;
69 \details Calculate the size of a RecipientRow structure
71 \param recipientrow RecipientRow structure
73 \return Size of RecipientRow structure
75 _PUBLIC_ uint16_t libmapiserver_RecipientRow_size(struct RecipientRow recipientrow)
80 size += sizeof (uint16_t);
83 if (recipientrow.RecipientFlags & 0x1) {
84 size += sizeof (uint8_t) * 2; /* AddressPrefixUsed + DisplayType */
85 size += strlen(recipientrow.X500DN.recipient_x500name) + 1;
88 /* recipient_EmailAddress */
89 switch (recipientrow.RecipientFlags & 0x208) {
91 size += strlen(recipientrow.EmailAddress.lpszA);
94 size += strlen(recipientrow.EmailAddress.lpszW) * 2 + 2;
100 /* recipient_DisplayName */
101 switch (recipientrow.RecipientFlags & 0x210) {
103 size += strlen(recipientrow.DisplayName.lpszA);
106 size += strlen(recipientrow.DisplayName.lpszW) * 2 + 2;
112 /* recipient_SimpleDisplayName */
113 switch (recipientrow.RecipientFlags & 0x600) {
115 size += strlen(recipientrow.SimpleDisplayName.lpszA);
118 size += strlen(recipientrow.SimpleDisplayName.lpszW) * 2 + 2;
124 /* recipient_TransmittableDisplayName */
125 switch (recipientrow.RecipientFlags & 0x260) {
127 size += strlen(recipientrow.TransmittableDisplayName.lpszA);
130 size += strlen(recipientrow.TransmittableDisplayName.lpszW) * 2 + 2;
137 size += sizeof (uint16_t);
140 size += sizeof (uint8_t);
143 size += sizeof (uint16_t);
144 size += recipientrow.prop_values.length;
151 \details Calculate the size of a LongTermId structure
153 \return Size of LongTermId structure
155 _PUBLIC_ uint16_t libmapiserver_LongTermId_size(void)
157 return SIZE_DFLT_LONGTERMID;