视频笔记1
TLV教师结构的编码和解码:
链表的节点
链表的节点
write_Inter()
writeprintable(ANYBUF *String, )
整形
编码:
writeSequence()
释放空间:
Free_Queue()
Free_Queue()
int EnCodeChar(char *pData,unit dataLen, ANYBUF** outbut)
TeacherEnode()
TeacherDecode()
TeacherFree()
strudentEncode()
StudentDecode()
StudentFree()
StudentDecode()
StudentFree()
nurseEncode()
nurseDecode()
nurseFree();
nurseDecode()
nurseFree();
封装
int MsgEncode(void *teacher, unsigned char **out,int *outlen, int type);
int MsgDecode(unsigned char* out, int outlen, void** teacher, int *type);
int MsgFree(void **teacher, int type);
int MsgEncode(void *teacher, unsigned char **out,int *outlen, int type);
int MsgDecode(unsigned char* out, int outlen, void** teacher, int *type);
int MsgFree(void **teacher, int type);
#define
请求结构体 应答结构体
typedef struct _MsgReq{
int cmType;
char client[16];
char server[32];
char AuthenCode[14];
char ri[64];
int cmType;
char client[16];
char server[32];
char AuthenCode[14];
char ri[64];
}
/*
对结构体 编码 参数 结构体指针, 类型, 传出参数, 长度
*/
int MsgEncode(
void *pStruct,
int type,
unsigned char **outdata,
int *outLen)
{
/*
对结构体 编码 参数 结构体指针, 类型, 传出参数, 长度
*/
int MsgEncode(
void *pStruct,
int type,
unsigned char **outdata,
int *outLen)
{
}
添加现有项, visual studio 添加文件
typedef struct_Teacher
{
char name[64];
int age;
char *p;
int len;
}
typedfy struct ANBUF{
unsigned char *pData; T
unit32 dataLen; L
unit unusedBites; V
unit memoryType;
unit dataType;
struct ANBUF *next;
struct ANYBUF *prev;
}
{
char name[64];
int age;
char *p;
int len;
}
typedfy struct ANBUF{
unsigned char *pData; T
unit32 dataLen; L
unit unusedBites; V
unit memoryType;
unit dataType;
struct ANBUF *next;
struct ANYBUF *prev;
}
string_to_anybuf(anybuf **poriginbuf, unsigned char* strorigin,int stroriginlen);
int TeacherEncode(Teacher *pTeacher,unsigned char **out,int *outLen)
{
int ret = 0;
ANYBUF *pTem = NULL,*pHeadBuf = NULL;
ANYBUF *pTmpBuf = NULL;
ANYBUF *pOutData = NULL;
int TeacherEncode(Teacher *pTeacher,unsigned char **out,int *outLen)
{
int ret = 0;
ANYBUF *pTem = NULL,*pHeadBuf = NULL;
ANYBUF *pTmpBuf = NULL;
ANYBUF *pOutData = NULL;
unsigned char *tmpout = NULL;
int tmpoutlen = 0;
将char * 类型的name 装化成ANYBUF 参数teacher结构体 string name 长度
ret = string_to_anybuf(&TmpBuf,pTeachet->name,strlen(pTeacher->name));
if(ret !=0)
{
int tmpoutlen = 0;
将char * 类型的name 装化成ANYBUF 参数teacher结构体 string name 长度
ret = string_to_anybuf(&TmpBuf,pTeachet->name,strlen(pTeacher->name));
if(ret !=0)
{
printf("error\n");
}
编码:
writePrintableString(printableString *printString, printbleString **ppDerPrintSting)
ret = writePrintableString(pTmpbuf, &pHeadbuf); 第一个节点
ptem = pHead;
}
编码:
writePrintableString(printableString *printString, printbleString **ppDerPrintSting)
ret = writePrintableString(pTmpbuf, &pHeadbuf); 第一个节点
ptem = pHead;
//编码age
ret = writeInteger(ptembuf,)
ret = writeInteger(ptembuf,)
}
转码unsigend char* 转化转化成tlv
解码大结构体:
解码name
解码age
解码p
解码plen
解码name
解码age
解码p
解码plen
动态库创建:
win. xxx.dll xxx.lib xxx.h
Linux xxx.so xxx.h
-L 路径 -l 库名 ldd keymngserver ===>
连接器: 编译期间 -L -l 给连接器指定 路径文件
动态连接器: 运行期间
动态连接器: 运行期间
动态库二进制文件
环境加载器
导出:
使用_declspce(dllexpert)
使用_declspce(dllexpert)