presence-op.h 2.43 KB
Newer Older
1
/*
2
 * presence-op.h
3
 * Copyright (C) 2010-2018 Belledonne Communications SARL
4
 *
Ghislain MARY's avatar
Ghislain MARY committed
5 6 7 8
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
9 10 11 12 13 14 15
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
Ghislain MARY's avatar
Ghislain MARY committed
16 17
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
 */
19

20 21
#ifndef _L_SAL_PRESENCE_OP_H_
#define _L_SAL_PRESENCE_OP_H_
22

23
#include "sal/event-op.h"
24 25 26

LINPHONE_BEGIN_NAMESPACE

27
class SalPresenceOp : public SalSubscribeOp {
28
public:
Ghislain MARY's avatar
Ghislain MARY committed
29
	SalPresenceOp (Sal *sal);
30

Ghislain MARY's avatar
Ghislain MARY committed
31
	int subscribe (int expires);
32 33 34
	int unsubscribe () { return SalOp::unsubscribe(); }
	int notifyPresence (SalPresenceModel *presence);
	int notifyPresenceClose ();
35 36

private:
Ghislain MARY's avatar
Ghislain MARY committed
37
	void fillCallbacks () override;
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
	void handleNotify (belle_sip_request_t *request, belle_sip_dialog_t *dialog);
	SalPresenceModel *processPresenceNotification (belle_sip_request_t *request);
	int checkDialogState ();
	belle_sip_request_t *createPresenceNotify ();
	void addPresenceInfo (belle_sip_message_t *notify, SalPresenceModel *presence);

	static SalSubscribeStatus getSubscriptionState (const belle_sip_message_t *message);

	static void presenceProcessIoErrorCb (void *userCtx, const belle_sip_io_error_event_t *event);
	static void presenceResponseEventCb (void *userCtx, const belle_sip_response_event_t *event);
	static void presenceRefresherListenerCb (belle_sip_refresher_t *refresher, void *userCtx, unsigned int statusCode, const char *reasonPhrase, int willRetry);
	static void presenceProcessTimeoutCb (void *userCtx, const belle_sip_timeout_event_t *event);
	static void presenceProcessTransactionTerminatedCb (void *userCtx, const belle_sip_transaction_terminated_event_t *event);
	static void presenceProcessRequestEventCb (void *userCtx, const belle_sip_request_event_t *event);
	static void presenceProcessDialogTerminatedCb (void *userCtx, const belle_sip_dialog_terminated_event_t *event);
	static void releaseCb (SalOp *op);
54 55 56 57
};

LINPHONE_END_NAMESPACE

58
#endif // ifndef _L_SAL_PRESENCE_OP_H_