示例#1
0
MS_SYSTEM_INFO_REQ_1600 Packets::SystemInfoRequestPacket_1600(int UserId)
{
    MS_SYSTEM_INFO_REQ_1600 obj;
    memset(&obj,0,70);

    obj.Header.TransactionCode=ntohs(1600);

	obj.Header.LogTime=0;
	memset(obj.Header.TimeStamp ,0,8);
	memset(obj.Header.TimeStamp1 ,0,8);
	memset(obj.Header.TimeStamp2 ,0,8);
	obj.Header.MessageLength=ntohs(44);
	obj.Header.TraderId=ntohl(UserId);
	obj.LastUpdatePortfolioTime=0;

    obj.SendPF.Length=ntohs(70);
    obj.SendPF.Messae_Count=ntohs(1);
    obj.SendPF.SeqNumber=ntohl(2);

    md5_byte_t check1[16];

    md5CheckSum((const unsigned char*)&obj+24,46,check1);
    memcpy(&obj.SendPF.Checksum,&check1,16);

    return obj;

}
示例#2
0
MS_SIGN_ON_2300 Packets::LoginPacket_2300(int UserId, char pwd1[8], char NewPwd[8], char BrokerId[], short BranchId,
	int VersionNumber, short UserType, char WsClassName[14], char BrokerName[25])
{
   /* static char pwd[]="Sq@020;1";
    static char bid[]="12468";
	static char wcn[14]="1234567";
	static char bname[25]="DIVYA PORTFOLIO PVT LTD";
*/
    MS_SIGN_ON_2300  obj;

    memset(&obj,0,sizeof(MS_SIGN_ON_2300));

	obj.Header.TransactionCode=ntohs(2300);
	obj.Header.LogTime=0;
	memset(obj.Header.AlphaChar ,' ',2);
	obj.Header.TraderId=ntohl(UserId);

	obj.Header.ErrorCode=0;
	memset(obj.Header.TimeStamp ,0,8);
	memset(obj.Header.TimeStamp1 ,0,8);
	memset(obj.Header.TimeStamp2 ,0,8);
	obj.Header.MessageLength=ntohs(214);
	obj.UserId=ntohl(UserId);
	memcpy(obj.Password,pwd1,8);
	memset(obj.TraderName ,' ',26);
	obj.LastPasswordChangeDate=ntohl(0);
	memcpy(obj.BrokerId  ,BrokerId,5);

	if(NewPwd=="")
        memcpy(obj.NewPassword,NewPwd,8);
    else
        memset(obj.NewPassword,' ',8);

    obj.BranchId=ntohs(BranchId);
    obj.VersionNumber=ntohl(VersionNumber);
	obj.Batch2StartTime=0;
	obj.HostSwitchContext=' ';
	memset(obj.Colour,' ',50);
	obj.UserType=ntohs(UserType);
	obj.SequenceNumber=ntohs(0);
	memcpy(obj.WsClassName,WsClassName,14);
    obj.BrokerStatus=' ';
	obj.ShowIndex=' ';
	obj.MemberType=0;
	obj.ClearingStatus=' ';
	memcpy(obj.BrokerName,BrokerName,sizeof(obj.BrokerName));
	obj.StMkt.reserved_1=' ';

    obj.SendPF.Length=ntohs(240);
    obj.SendPF.Messae_Count=ntohs(1);
    obj.SendPF.SeqNumber=ntohl(1);

    md5_byte_t check[16];
    md5CheckSum((const unsigned char*)&obj+24,sizeof( MS_SIGN_ON_2300 )-24,check);
    memcpy(&obj.SendPF.Checksum,&check,16);

return obj;
}
示例#3
0
FeedRecord* UCHome_Main_SiteConst::parse_friend(void *state_data, TidyDoc doc, TidyNode node) 
{
    FeedRecord * rec = NULL;
    QString note;
    TidyBuffer tbuf;
    TidyNode node2 = NULL;
    TidyNode node3 = NULL;
    TidyNode node4 = NULL;
    TidyNode node5 = NULL;
    TidyAttr attr = NULL;
    ctmbstr fuid = NULL;
    ctmbstr fusername = NULL;

    tidyBufInit(&tbuf);

    tidyNodeGetText(doc, node, &tbuf);
    note = this->u8codec->toUnicode(QByteArray((char*)tbuf.bp));    
    rec = new FeedRecord();
    rec->content = this->rewrite_relative_link(note);
    rec->content = "<table>" + rec->content + "</table>";
    md5CheckSum((char*)tbuf.bp, tbuf.size, rec->md5sum);
    tidyBufFree(&tbuf);    
    //q_debug()<<"Orig:"<<note;

    node2 = tidyGetChild(node);
    node3 = tidyGetChild(node2);
    attr = tidyAttrGetById(node3, TidyAttr_VALUE);
    fuid = tidyAttrValue(attr);
    
    node4 = tidyGetNext(node2);
    node3 = tidyGetChild(node4); // A
    node5 = tidyGetChild(node3); //IMG
    attr = tidyAttrGetById(node5, TidyAttr_ALT);
    fusername = tidyAttrValue(attr);

    rec->fuid = fuid;
    rec->fusername = this->u8codec->toUnicode(QByteArray(fusername));
    q_debug()<<"USER:"<<fuid<<rec->fusername;
    md5CheckSum(fuid, strlen(fuid), rec->md5sum);//使用uid的md5值肯定不会出现冲突
    
    return rec;
}
示例#4
0
FeedRecord* UCHome_Main_SiteConst::parse_feed(void *state_data, TidyDoc doc, TidyNode node)
{
    FeedRecord *rec = NULL;
    QString feed_text ;
    QByteArray feed_bytes;
    int nid = 0;
    ctmbstr  fid = NULL;
    TidyAttr attr = NULL;
    TidyBuffer tbuf = {0};
    tidyBufInit(&tbuf);
    
    nid = tidyNodeGetId(node);    
    this->get_node_text(doc, node, &tbuf);
    feed_bytes = QByteArray((char*)tbuf.bp);
    feed_text = this->u8codec->toUnicode(feed_bytes);

    tidyBufFree(&tbuf);

    rec = new FeedRecord();
    rec->content = feed_text;

    //<li class="type_1006780" id="feed_685697_li">
    //这个id是唯一的,用这个做标识
    attr = tidyAttrGetById(node, TidyAttr_ID);
    fid = tidyAttrValue(attr);
    //q_debug()<<attr<<fid;
    if(fid == NULL) {
        q_debug()<<"Warning: invalid fid"<<fid<<feed_text;
        return NULL;
    }else if(strstr(fid, " 1000 ") != NULL) {
        feed_bytes = fid;
        feed_bytes = feed_bytes.replace(" 1000 ", "");
        fid = feed_bytes.data();
        q_debug()<<"Warning: invalid fid"<<tidyAttrValue(attr);
        md5CheckSum(fid, strlen(fid), rec->md5sum);
    }else{
        md5CheckSum(fid, strlen(fid), rec->md5sum);
    }
    return rec;
}
示例#5
0
FeedRecord* UCHome_Main_SiteConst::parse_note(void *state_data, TidyDoc doc, TidyNode node)
{
    FeedRecord * rec = NULL;
    QString note;
    TidyBuffer tbuf;
    
    tidyBufInit(&tbuf);

    tidyNodeGetText(doc, node, &tbuf);
    note = this->u8codec->toUnicode(QByteArray((char*)tbuf.bp));    
    rec = new FeedRecord();
    rec->content = this->rewrite_relative_link(note);
    md5CheckSum((char*)tbuf.bp, tbuf.size, rec->md5sum);
    tidyBufFree(&tbuf);    
    //q_debug()<<"Orig:"<<note;
    
    return rec;
}
示例#6
0
SignOutRequest_2320 Packets:: Fun_SignOut_2320(short UserId, int sequanceNumber)
{
	SignOutRequest_2320 SignOut;
	memset(&SignOut, 0, sizeof(SignOutRequest_2320));

	SignOut.Header.TransactionCode = ntohs((short)2320);
	SignOut.Header.LogTime = ntohl(0);
	memset(SignOut.Header.AlphaChar, ' ', 2);
	SignOut.Header.TraderId = ntohl(UserId);
	SignOut.Header.ErrorCode = ntohs((short)0);
	memset(SignOut.Header.TimeStamp, ' ', 8);
	memset(SignOut.Header.TimeStamp1, ' ', 8);
	memset(SignOut.Header.TimeStamp2, ' ', 8);
	SignOut.Header.MessageLength = ntohs(40);

	SignOut.SendPF.Length = ntohs(sizeof(SignOutRequest_2320));
	SignOut.SendPF.Messae_Count = ntohs(1);
	SignOut.SendPF.SeqNumber = ntohl(3);
	md5_byte_t check[16];
	md5CheckSum((const unsigned char*)&SignOut + 24, sizeof(SignOutRequest_2320)-24, check);
	memcpy(&SignOut.SendPF.Checksum, &check, 16);
	return SignOut;
}