1/* 2 * Copyright (c) 2013 Apple Inc. 3 * All rights reserved. 4 */ 5#ifndef __VPN_FD_EXCHANGE_H__ 6#define __VPN_FD_EXCHANGE_H__ 7 8struct fd_exchange; 9 10typedef void (^FDExchangeMsgHandler)(int fd, const void *data, size_t data_len); 11 12struct fd_exchange *fd_exchange_create(int exchange_socket, CFRunLoopRef cb_runloop); 13void fd_exchange_destroy(struct fd_exchange *exchange); 14void fd_exchange_set_request_handler(struct fd_exchange *exchange, int type, FDExchangeMsgHandler handler); 15bool fd_exchange_send_response(struct fd_exchange *exchange, int type, int fd, const void *data, size_t data_len); 16bool fd_exchange_send_request(struct fd_exchange *exchange, int type, int fd, const void *data, size_t data_len, FDExchangeMsgHandler handler); 17 18#endif /* __VPN_FD_EXCHANGE_H__ */ 19