mirror of
https://github.com/CHN-beta/xmurp-ua.git
synced 2026-01-11 01:09:25 +08:00
我也忘了我写了啥,暂存
This commit is contained in:
13
src/rkpMap.h
13
src/rkpMap.h
@@ -24,15 +24,16 @@ void rkpMap_insert_begin(struct rkpMap**, struct rkpMap*);
|
||||
void rkpMap_insert_end(struct rkpMap**, struct rkpMap*);
|
||||
// 在指定位置插入映射,假定要插入的映射的前后指针已经置零
|
||||
|
||||
void rkpMap_refresh(struct rkpMap**, int32_t); // 对于一列序列号递增的映射,删除已经回应的映射
|
||||
void rkpMap_refresh(struct rkpMap**, uint32_t);
|
||||
// 对于一列序列号递增的映射,删除已经回应的映射。
|
||||
|
||||
struct rkpMap* rkpMap_new(int32_t seql, int32_t seqr)
|
||||
struct rkpMap* rkpMap_new(uint32_t begin, uint32_t length)
|
||||
{
|
||||
struct rkpMap* rkpm = (struct rkpMap*)rkpMalloc(sizeof(struct rkpMap));
|
||||
if(rkpm == 0)
|
||||
return 0;
|
||||
rkpm -> begin = seql;
|
||||
rkpm -> length = seqr - seql;
|
||||
rkpm->begin = begin;
|
||||
rkpm->length = length;
|
||||
rkpm->prev = rkpm->next = 0;
|
||||
return rkpm;
|
||||
}
|
||||
@@ -41,7 +42,7 @@ void rkpMap_delete(struct rkpMap* rkpm)
|
||||
rkpFree(rkpm);
|
||||
}
|
||||
|
||||
unsigned char __rkpMap_map(const struct rkpMap* rkpm, int32_t seq)
|
||||
unsigned char __rkpMap_ua(uint32_t seq)
|
||||
{
|
||||
if(seq < strlen(str_uaRkp))
|
||||
return str_uaRkp[seq];
|
||||
@@ -55,7 +56,7 @@ void rkpMap_modify(struct rkpMap** rkpml, struct rkpPacket** rkppl)
|
||||
{
|
||||
struct rkpPacket* rkpp;
|
||||
unsigned char* p = 0;
|
||||
int32_t seq;
|
||||
uint32_t seq;
|
||||
|
||||
// 尝试确定第一个需要修改的包以及需要修改的开始处
|
||||
for(rkpp = *rkppl; rkpp != 0; rkpp = rkpp->next)
|
||||
|
||||
@@ -135,11 +135,11 @@ unsigned rkpPacket_appLen(const struct rkpPacket* rkpp)
|
||||
{
|
||||
return ntohs(ip_hdr(rkpp->skb)->tot_len) - ip_hdr(rkpp->skb)->ihl * 4 - tcp_hdr(rkpp->skb)->doff * 4;
|
||||
}
|
||||
int32_t rkpPacket_seq(const struct rkpPacket* rkpp, const int32_t offset)
|
||||
int32_t rkpPacket_seq(const struct rkpPacket* rkpp)
|
||||
{
|
||||
return (int32_t)ntohl(tcp_hdr(rkpp->skb)->seq) - offset;
|
||||
}
|
||||
int32_t rkpPacket_seqAck(const struct rkpPacket* rkpp, const int32_t offset)
|
||||
int32_t rkpPacket_seqAck(const struct rkpPacket* rkpp)
|
||||
{
|
||||
return (int32_t)ntohl(tcp_hdr(rkpp->skb)->ack_seq) - offset;
|
||||
}
|
||||
@@ -210,12 +210,7 @@ bool __rkpPacket_makeWriteable(struct rkpPacket* rkpp)
|
||||
return true;
|
||||
}
|
||||
|
||||
void rkpPacket_makeOffset(const struct rkpPacket* rkpp, int32_t* offsetp)
|
||||
{
|
||||
*offsetp = rkpPacket_seq(rkpp, 0) + rkpPacket_appLen(rkpp);
|
||||
}
|
||||
|
||||
void rkpPacket_insert_auto(struct rkpPacket** buff, struct rkpPacket* rkpp, int32_t offset)
|
||||
void rkpPacket_insert_auto(struct rkpPacket** buff, struct rkpPacket* rkpp)
|
||||
{
|
||||
// 如果链表是空的,那么就直接加进去
|
||||
if(*buff == 0)
|
||||
|
||||
Reference in New Issue
Block a user