libsyncml  0.5.4
sml_session_internals.h
1 /*
2  * libsyncml - A syncml protocol implementation
3  * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
4  * Copyright (C) 2007-2008 Michael Bell <michael.bell@opensync.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 #ifndef _SML_SESSION_INTERNALS_H_
23 #define _SML_SESSION_INTERNALS_H_
24 
25 #include "sml_queue_internals.h"
26 
27 struct SmlSession {
28  gint refCount;
29  SmlProtocolVersion version;
30  SmlProtocolType protocol;
31  SmlSessionType sessionType;
32  SmlAssembler *assembler;
33  SmlBool onlyReplace;
34 
35  SmlSessionEventCallback eventCallback;
36  void *eventCallbackUserdata;
37 
38  SmlSessionDataCallback dataCallback;
39  void *dataCallbackUserdata;
40 
41  char *sessionID;
42 
43  SmlLocation *target;
44  SmlLocation *orgTarget;
45  SmlLocation *source;
46  char *responseURI;
47  SmlChal *chal;
48  SmlCred *cred;
49 
50  /* These are the local limits of MaxMsgSize and MaxObjSize.
51  * These are the limits which are send to the remote peer
52  * but they are not the remote limits.
53  */
54  unsigned int localMaxMsgSize;
55  unsigned int localMaxObjSize;
56 
57  GList *pendingReplies;
58 
59  unsigned long lastMessageID;
60  unsigned long lastReceivedMessageID;
61  unsigned long lastCommandID;
62 
63  GList *commands;
64  SmlBool final;
65  SmlBool authenticate;
66  SmlBool established;
67 
68  SmlMimeType type;
69 
70  SmlQueue *command_queue;
71  SmlBool waiting;
72  SmlBool sending;
73  GList *commandStack;
74  SmlBool hasCommand;
75  SmlBool assmHasHeader;
76 
77  SmlBool end;
78  GMutex *reportEnd;
79  SmlBool reportedEnd;
80 
81  SmlCommand *parentCommand;
82 
83  /* The buffer that holds the incoming command which has
84  * an item with a large object. */
85  SmlCommand *incomingBuffer;
86 
87  /* The outgoing command that gets fragmented */
88  SmlCommand *frag_command;
89  /* How much of the item of the frag_command already
90  * got sent */
91  unsigned int frag_size;
92  SmlStatusReplyCb frag_callback;
93  void *frag_userdata;
94 
95  SmlBool active;
96  GMutex *dispatch_mutex;
97 };
98 
100  unsigned int cmdID;
101  unsigned int msgID;
102  SmlStatusReplyCb callback;
103  void *userdata;
104 };
105 
106 SmlBool smlSessionTryLock(SmlSession *session);
107 void smlSessionLock(SmlSession *session);
108 void smlSessionUnlock(SmlSession *session);
109 
110 void smlSessionRestoreTargetURI(SmlSession *session);
111 SmlBool smlSessionSetResponseURI(
112  SmlSession *session,
113  const char *responseURI,
114  SmlError **error);
115 
116 #endif //_SML_SESSION_INTERNALS_H_
Represents a Queue which can be used to receive messages.
Represent an error.