/*********************************************************************
* Copyright (c) Intel Corporation 2011 - 2020
* SPDX-License-Identifier: Apache-2.0
**********************************************************************/

#ifndef _MINCORE

#ifndef _LMS_IF_CONSTANTS_H_
#define _LMS_IF_CONSTANTS_H_

#define LMS_PROTOCOL_VERSION 4

//
// messages opcodes
//
typedef enum {
	APF_DISCONNECT		= 1,
	APF_SERVICE_REQUEST	= 5,
	APF_SERVICE_ACCEPT	= 6,
	APF_USERAUTH_REQUEST	= 50,
	APF_USERAUTH_FAILURE	= 51,
	APF_USERAUTH_SUCCESS	= 52,
	APF_GLOBAL_REQUEST	= 80,
	APF_REQUEST_SUCCESS	= 81,
	APF_REQUEST_FAILURE	= 82,
	APF_CHANNEL_OPEN		= 90,
	APF_CHANNEL_OPEN_CONFIRMATION	= 91,
	APF_CHANNEL_OPEN_FAILURE	= 92,
	APF_CHANNEL_WINDOW_ADJUST	= 93,
	APF_CHANNEL_DATA		= 94,
	APF_CHANNEL_CLOSE		= 97,
	APF_PROTOCOLVERSION	= 192
} APF_MESSAGE_TYPE;

typedef enum {
	APF_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT             = 1,
	APF_DISCONNECT_PROTOCOL_ERROR                          = 2,
	APF_DISCONNECT_KEY_EXCHANGE_FAILED                     = 3,
	APF_DISCONNECT_RESERVED                                = 4,
	APF_DISCONNECT_MAC_ERROR                               = 5,
	APF_DISCONNECT_COMPRESSION_ERROR                       = 6,
	APF_DISCONNECT_SERVICE_NOT_AVAILABLE                   = 7,
	APF_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED          = 8,
	APF_DISCONNECT_HOST_KEY_NOT_VERIFIABLE                 = 9,
	APF_DISCONNECT_CONNECTION_LOST                        = 10,
	APF_DISCONNECT_BY_APPLICATION                         = 11,
	APF_DISCONNECT_TOO_MANY_CONNECTIONS                   = 12,
	APF_DISCONNECT_AUTH_CANCELLED_BY_USER                 = 13,
	APF_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE         = 14,
	APF_DISCONNECT_ILLEGAL_USER_NAME                      = 15
} APF_DISCONNECT_REASON_CODE;

//
//strings used in global messages
//
#define APF_GLOBAL_REQUEST_STR_TCP_FORWARD_REQUEST "tcpip-forward"
#define APF_GLOBAL_REQUEST_STR_TCP_FORWARD_CANCEL_REQUEST "cancel-tcpip-forward"
#define APF_GLOBAL_REQUEST_STR_UDP_SEND_TO "udp-send-to@amt.intel.com"
#define APF_OPEN_CHANNEL_REQUEST_FORWARDED "forwarded-tcpip"
#define APF_OPEN_CHANNEL_REQUEST_DIRECT "direct-tcpip"

// APF service names
#define APF_SERVICE_PFWD "pfwd@amt.intel.com"
#define APF_SERVICE_AUTH "auth@amt.intel.com"

// APF Authentication method
#define APF_AUTH_NONE "none"
#define APF_AUTH_PASSWORD "password"

//calculate string length without the NULL terminator
#define APF_STR_SIZE_OF(s) (sizeof(s)-1)

// Trigger reason code
typedef enum {
	USER_INITIATED_REQUEST		= 1,
	ALERT_REQUEST			= 2,
	HIT_PROVISIONING_REQUEST	= 3,
	PERIODIC_REQUEST		= 4,
	LME_REQUEST			= 254
} APF_TRIGGER_REASON;

typedef enum {
	OPEN_FAILURE_REASON_ADMINISTRATIVELY_PROHIBITED = 1,
	OPEN_FAILURE_REASON_CONNECT_FAILED = 2,
	OPEN_FAILURE_REASON_UNKNOWN_CHANNEL_TYPE = 3,
	OPEN_FAILURE_REASON_RESOURCE_SHORTAGE = 4
} OPEN_FAILURE_REASON;

#endif

#endif
