mirror of https://github.com/F-Stack/f-stack.git
299 lines
7.1 KiB
C
299 lines
7.1 KiB
C
|
|
|||
|
/**
|
|||
|
* Tencent is pleased to support the open source community by making MSEC available.
|
|||
|
*
|
|||
|
* Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
|
|||
|
*
|
|||
|
* Licensed under the GNU General Public License, Version 2.0 (the "License");
|
|||
|
* you may not use this file except in compliance with the License. You may
|
|||
|
* obtain a copy of the License at
|
|||
|
*
|
|||
|
* https://opensource.org/licenses/GPL-2.0
|
|||
|
*
|
|||
|
* Unless required by applicable law or agreed to in writing, software distributed under the
|
|||
|
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|||
|
* either express or implied. See the License for the specific language governing permissions
|
|||
|
* and limitations under the License.
|
|||
|
*/
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @filename mt_cache.h
|
|||
|
* @info TCP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>buffer<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
|
|||
|
#ifndef ___MT_BUFFER_CACHE_H
|
|||
|
#define ___MT_BUFFER_CACHE_H
|
|||
|
|
|||
|
#include <stdint.h>
|
|||
|
#include <sys/queue.h>
|
|||
|
|
|||
|
|
|||
|
namespace NS_MICRO_THREAD {
|
|||
|
|
|||
|
|
|||
|
// Ĭ<>ϵ<EFBFBD>buff<66><66>С
|
|||
|
#define SK_DFLT_BUFF_SIZE 64*1024
|
|||
|
#define SK_DFLT_ALIGN_SIZE 8
|
|||
|
|
|||
|
#define SK_ERR_NEED_CLOSE 10000
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD>û<EFBFBD>̬ buffer <EFBFBD>ṹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
typedef struct _sk_buffer_tag
|
|||
|
{
|
|||
|
TAILQ_ENTRY(_sk_buffer_tag) entry; // list entry buffer LRU<52><55>
|
|||
|
uint32_t last_time; // <20>ϴ<EFBFBD>ʹ<EFBFBD><CAB9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|||
|
uint32_t size; // buffer<65>ڵ<EFBFBD><DAB5>Ŀռ<C4BF><D5BC><EFBFBD>С
|
|||
|
uint8_t* head; // buff<66><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷָ<CDB7><D6B8>
|
|||
|
uint8_t* end; // buff<66><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
uint8_t* data; // <20><>Ч<EFBFBD><D0A7><EFBFBD>ݵ<EFBFBD>ͷָ<CDB7><D6B8>
|
|||
|
uint32_t data_len; // <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
|||
|
uint8_t buff[0]; // ԭʼָ<CABC><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
} TSkBuffer;
|
|||
|
typedef TAILQ_HEAD(__sk_buff_list, _sk_buffer_tag) TSkBuffList; // multi <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>buff<EFBFBD><EFBFBD>
|
|||
|
* @param size <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|||
|
* @return <EFBFBD><EFBFBD>NULLΪ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>buffָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
TSkBuffer* new_sk_buffer(uint32_t size = SK_DFLT_BUFF_SIZE);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD>ͷ<EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>buff<EFBFBD><EFBFBD>
|
|||
|
* @param <EFBFBD><EFBFBD><EFBFBD>ͷŵ<EFBFBD>buffָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void delete_sk_buffer(TSkBuffer* buff);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD>buff,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ)
|
|||
|
* @param buff -<EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>buffָ<EFBFBD><EFBFBD>
|
|||
|
* @param size -<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ճ<EFBFBD><EFBFBD>ȴ<EFBFBD>С
|
|||
|
* @return ʵ<EFBFBD>ʵ<EFBFBD>buff<EFBFBD><EFBFBD>Ϣ
|
|||
|
*/
|
|||
|
TSkBuffer* reserve_sk_buffer(TSkBuffer* buff, uint32_t size);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief buffer cache <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
typedef struct _sk_buff_mng_tag
|
|||
|
{
|
|||
|
TSkBuffList free_list; // buff<66><66><EFBFBD><EFBFBD>
|
|||
|
uint32_t expired; // <20><>ʱʱ<CAB1><CAB1>
|
|||
|
uint32_t size; // buff<66><66>С
|
|||
|
uint32_t count; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
} TSkBuffMng;
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief cache <EFBFBD>صij<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
|||
|
* @param mng -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param expired -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>, <EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
|||
|
* @param size -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵĿ<EFBFBD><EFBFBD><EFBFBD>С
|
|||
|
*/
|
|||
|
void sk_buffer_mng_init(TSkBuffMng* mng, uint32_t expired, uint32_t size = SK_DFLT_BUFF_SIZE);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief cache <EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٽӿ<EFBFBD>
|
|||
|
* @param mng -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void sk_buffer_mng_destroy(TSkBuffMng * mng);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>buff
|
|||
|
* @param mng -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @return <EFBFBD><EFBFBD>NULLΪ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>buff<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
TSkBuffer* alloc_sk_buffer(TSkBuffMng* mng);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD>ͷ<EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>buff<EFBFBD><EFBFBD>
|
|||
|
* @param mng -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param buff -<EFBFBD><EFBFBD><EFBFBD>ͷŵ<EFBFBD>buffָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void free_sk_buffer(TSkBuffMng* mng, TSkBuffer* buff);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD>ڵ<EFBFBD>buff<EFBFBD><EFBFBD>
|
|||
|
* @param mng -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param now -<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>, <EFBFBD>뼶<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void recycle_sk_buffer(TSkBuffMng* mng, uint32_t now);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief ԭʼ<EFBFBD><EFBFBD> buffer cache <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
typedef struct _sk_rw_cache_tag
|
|||
|
{
|
|||
|
TSkBuffList list; // buff<66><66><EFBFBD><EFBFBD>
|
|||
|
uint32_t len; // <20><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
|||
|
uint32_t count; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
TSkBuffMng *pool; // ȫ<><C8AB>buff<66><66>ָ<EFBFBD><D6B8>
|
|||
|
} TRWCache;
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param pool -buff<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void rw_cache_init(TRWCache* cache, TSkBuffMng* pool);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void rw_cache_destroy(TRWCache* cache);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cacheɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param len -<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void cache_skip_data(TRWCache* cache, uint32_t len);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
TSkBuffer* cache_skip_first_buffer(TRWCache* cache);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param data -<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param len -<EFBFBD><EFBFBD><EFBFBD>ӵij<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
int32_t cache_append_data(TRWCache* cache, const void* data, uint32_t len);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param buff -<EFBFBD><EFBFBD><EFBFBD>ӵĿ<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void cache_append_buffer(TRWCache* cache, TSkBuffer* buff);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cacheɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param buff -<EFBFBD><EFBFBD><EFBFBD><EFBFBD>buff<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param len -<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return ʵ<EFBFBD>ʿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
uint32_t cache_copy_out(TRWCache* cache, void* buff, uint32_t len);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>UDP<EFBFBD>ձ<EFBFBD><EFBFBD>ӿ<EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>Ƚ϶<EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>32λʹ<EFBFBD><EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param fd - <EFBFBD><EFBFBD><EFBFBD>ձ<EFBFBD><EFBFBD><EFBFBD>fd<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param remote_addr -<EFBFBD>Զ<EFBFBD>ip<EFBFBD><EFBFBD>ַ
|
|||
|
* @return ʵ<EFBFBD>ʽ<EFBFBD><EFBFBD>ճ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
int32_t cache_udp_recv(TRWCache* cache, uint32_t fd, struct sockaddr_in* remote_addr);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>TCP<EFBFBD>ձ<EFBFBD><EFBFBD>ӿ<EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param fd - <EFBFBD><EFBFBD><EFBFBD>ձ<EFBFBD><EFBFBD><EFBFBD>fd<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return ʵ<EFBFBD>ʽ<EFBFBD><EFBFBD>ճ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
int32_t cache_tcp_recv(TRWCache* cache, uint32_t fd);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>TCP<EFBFBD><EFBFBD><EFBFBD>ͽӿ<EFBFBD>
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param fd - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>fd<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return ʵ<EFBFBD>ʷ<EFBFBD><EFBFBD>ͳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
int32_t cache_tcp_send(TRWCache* cache, uint32_t fd);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief Cache<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>TCP<EFBFBD><EFBFBD><EFBFBD>ͽӿ<EFBFBD>, δʹ<EFBFBD><EFBFBD>IOVEC
|
|||
|
* @param cache -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param fd - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>fd<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param data -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cache<EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>buff
|
|||
|
* @param len -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>buff<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return ʵ<EFBFBD>ʷ<EFBFBD><EFBFBD>ͳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
int32_t cache_tcp_send_buff(TRWCache* cache, uint32_t fd, const void* data, uint32_t len);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// interface
|
|||
|
typedef void* TBuffVecPtr; ///< <20><><EFBFBD><EFBFBD>block<63><6B>cache<68><65><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
typedef void* TBuffBlockPtr; ///< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡcache<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param multi -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @return ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
uint32_t get_data_len(TBuffVecPtr multi);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡcache<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param multi -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @return ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
uint32_t get_block_count(TBuffVecPtr multi);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡcache<EFBFBD>ĵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param multi -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @return <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
TBuffBlockPtr get_first_block(TBuffVecPtr multi);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡcache<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param multi -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param block -<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @return <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
TBuffBlockPtr get_next_block(TBuffVecPtr multi, TBuffBlockPtr block);
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param block -<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param data -<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>-modify<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param len -<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD> modify<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
void get_block_data(TBuffBlockPtr block, const void** data, int32_t* len);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param multi -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param data -<EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param len -<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return <EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
uint32_t read_cache_data(TBuffVecPtr multi, void* data, uint32_t len);
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @param multi -<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param data -<EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|||
|
* @param len -<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @return <EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
uint32_t read_cache_begin(TBuffVecPtr multi, uint32_t begin, void* data, uint32_t len);
|
|||
|
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
#endif
|