summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/private/SDLProtocolReceivedMessageProcessor.h
blob: ac98ecac9256a97e5c0d9ed12f13b9fd8047c7d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
//  SDLProtocolReceivedMessageProcessor.h
//  SmartDeviceLink
//
//  Created by George Miller on 7/13/22.
//  Copyright © 2022 smartdevicelink. All rights reserved.
//

#import <Foundation/Foundation.h>

@class SDLProtocolHeader;

/**
 * Handles decryption and creation of the message from header and payload.  Decryption needed to be handled outside of the MessageProcessor because of access to the securitymanager.
 * @param header Pointer to the header for the message
 * @param payload Pointer to the payload of the message
 */
typedef void (^StateMachineMessageReadyBlock)(SDLProtocolHeader *header, NSData *payload);

/// Class for processing received byte data into protocol messages
@interface SDLProtocolReceivedMessageProcessor : NSObject

/**
 * Processes a data buffer into the state machine.
 * Loop through the given bytes and call the state machine to process each byte.
 * @param receiveBuffer The data to process
 * @param messageReadyBlock Passes back a completed protocol message when one has been assembled
 */
- (void)processReceiveBuffer:(NSData *)receiveBuffer withMessageReadyBlock:(StateMachineMessageReadyBlock)messageReadyBlock;

@end