本文整理汇总了C++中GETBYTE函数的典型用法代码示例。如果您正苦于以下问题:C++ GETBYTE函数的具体用法?C++ GETBYTE怎么用?C++ GETBYTE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GETBYTE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: v2_attr_rply
static int v2_attr_rply(int flags) {
int auth_cnt, i;
unsigned short errcode;
if (flags & F_SUM) {
GETSHORT(errcode);
if (errcode != OK) {
strcat(msgbuf, slpv2_error(errcode));
msglength = 0; /* skip rest of message */
return (0);
} else {
GETFIELD; /* attr list */
#ifdef VERIFYSLP
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
if (skip_v2authblock() < 0)
return (0);
#endif
}
} else if (flags & F_DTAIL) {
V2_DOERRCODE;
DOFIELD("Attribute list", FIELD_DEFAULT);
/* auth */
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
V2_DOAUTH(i);
}
return (1);
}
开发者ID:jasonbking,项目名称:illumos-gate,代码行数:31,代码来源:snoop_slp.c
示例2: v2_srv_reg
static int v2_srv_reg(int flags) {
int i, auth_cnt;
if (flags & F_SUM) {
SKIPBYTE; /* reserved */
SKIPSHORT; /* lifetime */
GETFIELD; /* URL */
#ifdef VERIFYSLP
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
if (skip_v2authblock() < 0)
return (0);
SKIPFIELD(FIELD_DEFAULT); /* type */
SKIPFIELD(FIELD_DEFAULT); /* scopes */
SKIPFIELD(FIELD_DEFAULT); /* attrs */
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
if (skip_v2authblock() < 0)
return (0);
#endif
} if (flags & F_DTAIL) {
V2_DOURL(-1);
DOFIELD("Service type", FIELD_DEFAULT);
DOFIELD("Scopes", FIELD_DEFAULT);
DOFIELD("Attribute list", FIELD_DEFAULT);
/* auth */
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
V2_DOAUTH(i);
}
return (1);
}
开发者ID:jasonbking,项目名称:illumos-gate,代码行数:33,代码来源:snoop_slp.c
示例3: v2_daadvert
static int v2_daadvert(int flags) {
int auth_cnt, i;
unsigned short errcode;
unsigned int timestamp;
if (flags & F_SUM) {
SKIPSHORT; /* error code */
SKIPSHORT; SKIPSHORT; /* timestamp */
GETFIELD; /* URL */
#ifdef VERIFYSLP
SKIPFIELD(FIELD_DEFAULT); /* scopes */
SKIPFIELD(FIELD_DEFAULT); /* attrs */
SKIPFIELD(FIELD_DEFAULT); /* SPIs */
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
if (skip_v2authblock() < 0)
return (0);
#endif
} else if (flags & F_DTAIL) {
V2_DOERRCODE;
V2_DOTIMESTAMP;
DOFIELD("URL", FIELD_DEFAULT);
DOFIELD("Scope list", FIELD_DEFAULT);
DOFIELD("Attribute list", FIELD_DEFAULT);
DOFIELD("Configured SPIs", FIELD_DEFAULT);
/* auth */
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
V2_DOAUTH(i);
}
return (1);
}
开发者ID:jasonbking,项目名称:illumos-gate,代码行数:35,代码来源:snoop_slp.c
示例4: v2_saadvert
static int v2_saadvert(int flags) {
int auth_cnt, i;
if (flags & F_SUM) {
GETFIELD; /* URL */
#ifdef VERIFYSLP
SKIPFIELD(FIELD_DEFAULT); /* scopes */
SKIPFIELD(FIELD_DEFAULT); /* attrs */
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
if (skip_v2authblock() < 0)
return (0);
#endif
} else if (flags & F_DTAIL) {
DOFIELD("URL", FIELD_DEFAULT);
DOFIELD("Scopes", FIELD_DEFAULT);
DOFIELD("Attribute list", FIELD_DEFAULT);
/* auth */
GETBYTE(auth_cnt);
for (i = 0; i < auth_cnt; i++)
V2_DOAUTH(i);
}
return (1);
}
开发者ID:jasonbking,项目名称:illumos-gate,代码行数:27,代码来源:snoop_slp.c
示例5: GetUserKey
void Twofish::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
{
unsigned int len = (keylen <= 16 ? 2 : (keylen <= 24 ? 3 : 4));
word32 key[8];
GetUserKey(LittleEndianOrder, key, len*2, userKey, keylen);
unsigned int i;
for (i=0; i<40; i+=2) {
word32 a = h(i, key, len);
word32 b = rotlFixed(h(i+1, key+1, len), 8);
k_[i] = a+b;
k_[i+1] = rotlFixed(a+2*b, 9);
}
word32 svec[8];
for (i=0; i<len; i++)
svec[2*(len-i-1)] = ReedSolomon(key[2*i+1], key[2*i]);
for (i=0; i<256; i++) {
word32 t = h0(i, svec, len);
s_[0][i] = mds_[0][GETBYTE(t, 0)];
s_[1][i] = mds_[1][GETBYTE(t, 1)];
s_[2][i] = mds_[2][GETBYTE(t, 2)];
s_[3][i] = mds_[3][GETBYTE(t, 3)];
}
}
开发者ID:0x00xw,项目名称:mysql-2,代码行数:26,代码来源:twofish.cpp
示例6: pgp_s2k_read
int
pgp_s2k_read(PullFilter *src, PGP_S2K *s2k)
{
int res = 0;
GETBYTE(src, s2k->mode);
GETBYTE(src, s2k->digest_algo);
switch (s2k->mode)
{
case 0:
break;
case 1:
res = pullf_read_fixed(src, 8, s2k->salt);
break;
case 3:
res = pullf_read_fixed(src, 8, s2k->salt);
if (res < 0)
break;
GETBYTE(src, s2k->iter);
break;
default:
res = PXE_PGP_BAD_S2K_MODE;
}
return res;
}
开发者ID:0x0FFF,项目名称:postgres,代码行数:25,代码来源:pgp-s2k.c
示例7: GETBYTE
void DataOutputStream::writeUInt16(UINT16 data)
{
UINT8 buf[2];
buf[0] = GETBYTE(data, 1);
buf[1] = GETBYTE(data, 0);
writeFully((char *)buf, sizeof(buf));
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:9,代码来源:DataOutputStream.cpp
示例8: crypt_block
// this version is only used to make pbox and sbox
void Blowfish::crypt_block(const word32 in[2], word32 out[2]) const
{
word32 left = in[0];
word32 right = in[1];
const word32 *const s=sbox;
const word32 *p=pbox;
left ^= p[0];
for (unsigned i=0; i<ROUNDS/2; i++)
{
right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
^ p[2*i+1];
left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
^ p[2*i+2];
}
right ^= p[ROUNDS+1];
out[0] = right;
out[1] = left;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:27,代码来源:blowfish.cpp
示例9: ProcessAndXorBlock
void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out)
const
{
word32 left, right;
const word32 *const s = sbox_;
const word32* p = pbox_;
gpBlock::Get(in)(left)(right);
left ^= p[0];
// roll back up and use s and p index instead of just p
for (unsigned i = 0; i < ROUNDS / 2; i++) {
right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
^ p[2*i+1];
left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
^ p[2*i+2];
}
right ^= p[ROUNDS + 1];
gpBlock::Put(xOr, out)(right)(left);
}
开发者ID:0x00xw,项目名称:mysql-2,代码行数:25,代码来源:blowfish.cpp
示例10: BlowfishEncryptLE
void BlowfishEncryptLE (unsigned char *inBlock, unsigned char *outBlock, BF_KEY *key, int encrypt)
{
word32 left = LE32 (((word32 *) inBlock)[0]);
word32 right = LE32 (((word32 *) inBlock)[1]);
const word32 *const s = key->sbox;
const word32 * p = encrypt ? key->pbox : key->pbox_dec;
unsigned i;
left ^= p[0];
for (i=0; i<ROUNDS/2; i++)
{
right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
^ p[2*i+1];
left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
^ p[2*i+2];
}
right ^= p[ROUNDS+1];
((word32 *) outBlock)[0] = LE32 (right);
((word32 *) outBlock)[1] = LE32 (left);
}
开发者ID:4nt1m0n,项目名称:truecrypt,代码行数:28,代码来源:Blowfish.c
示例11: crypt_block
// this version is only used to make pbox and sbox
static void crypt_block(BF_KEY *key, const word32 in[2], word32 out[2])
{
word32 left = in[0];
word32 right = in[1];
const word32 *const s=key->sbox;
const word32 *p=key->pbox;
unsigned i;
left ^= p[0];
for (i=0; i<ROUNDS/2; i++)
{
right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
^ p[2*i+1];
left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
^ p[2*i+2];
}
right ^= p[ROUNDS+1];
out[0] = right;
out[1] = left;
}
开发者ID:4nt1m0n,项目名称:truecrypt,代码行数:29,代码来源:Blowfish.c
示例12: GetBlockBigEndian
void Blowfish::ProcessBlock(const byte *in, byte *out) const
{
word32 left, right;
GetBlockBigEndian(in, left, right);
const word32 *const s=sbox;
const word32 *p=pbox;
left ^= p[0];
for (unsigned i=0; i<ROUNDS/2; i++)
{
right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
^ p[2*i+1];
left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
^ p[2*i+2];
}
right ^= p[ROUNDS+1];
PutBlockBigEndian(out, right, left);
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:25,代码来源:blowfish.cpp
示例13: return
byte LC_RNG::GenerateByte()
{
word32 hi = seed/q;
word32 lo = seed%q;
long test = a*lo - r*hi;
if (test > 0)
seed = test;
else
seed = test+ m;
return (GETBYTE(seed, 0) ^ GETBYTE(seed, 1) ^ GETBYTE(seed, 2) ^ GETBYTE(seed, 3));
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:14,代码来源:rng.cpp
示例14: archive_fetch_data
uint64_t archive_fetch_data(int fd, int size)
{
unsigned char data[8] = { 0 };
uint64_t val = 0;
if (read(fd, data, size) != size) {
DPRINTF("Invalid data block\n");
return (uint64_t)-1;
}
switch (size) {
case 1: val = GETBYTE(data);
break;
case 2: val = GETWORD(data);
break;
case 4: val = GETUINT32(data);
break;
case 8: val = GETUINT64(data);
break;
default:val = (uint64_t)-1;
DPRINTF("Cannot get %d bytes: Not implemented\n", size);
break;
}
return val;
}
开发者ID:MigNov,项目名称:archiver,代码行数:26,代码来源:archive.c
示例15: GETDWORD
// Disconnect client from char/world server
bool CCharServer::pakLoginDSClient( CCharClient* thisclient, CPacket* P )
{
unsigned int userid = GETDWORD((*P), 1 );
CCharClient* otherclient = GetClientByUserID( userid );
BYTE action = GETBYTE((*P),0);
switch(action)
{
case 1:
{
if(otherclient==NULL)
{
Log( MSG_WARNING, "Userid '%u' is not online", userid );
return true;
}
otherclient->isLoggedIn = false;
otherclient->isActive = false;
BEGINPACKET( pak, 0x502 );
ADDBYTE ( pak, 1 );
ADDDWORD ( pak, userid );
//ADDBYTE ( pak, 0x00 );
//cryptPacket( (char*)&pak, NULL );
CChanels* thischannel = GetChannelByID( otherclient->channel );
if(thischannel!=NULL)
send( thischannel->sock, (char*)&pak, pak.Size, 0 );
}
break;
}
return true;
}
开发者ID:boermansjo,项目名称:KTRose_Server,代码行数:30,代码来源:charpackets.cpp
示例16: GETWORD
unsigned short CJpegParse::GetComment(PTJpegIndex pinfo, unsigned char *ptr)
{
unsigned short len = GETWORD(ptr, 0);
pinfo->frmcnt = GETWORD_INV(ptr, 2);
pinfo->qf = GETBYTE(ptr, 25);
return len;
}
开发者ID:stormbay,项目名称:jpeg.tools,代码行数:9,代码来源:jpegparse.cpp
示例17: mysql_fetch_row
// delete/resurect character
bool CCharServer::pakDeleteChar( CCharClient* thisclient, CPacket* P )
{
if(!thisclient->isLoggedIn) return false;
char* name = (char*)&P->Buffer[2];
MYSQL_RES *result;
MYSQL_ROW row;
result = DB->QStore("SELECT account_name FROM characters WHERE char_name='%s' LIMIT 1", name);
if(result==NULL) return false;
row = mysql_fetch_row(result);
if (strcmp(row[0], thisclient->username)!=0)
{
Log(MSG_HACK, "User %s tried deleting another users (%s) character.", thisclient->username, name);
DB->QFree( );
return false;
}
DB->QFree( );
short int action = GETBYTE((*P), 1 );
unsigned long int DeleteTime = 0;
switch(action)
{
case 0x00://Resurect
{
DeleteTime = 0;
if(!DB->QExecute(" UPDATE characters SET deletetime=0 WHERE char_name='%s'",
(char*)&P->Buffer[2] ))
return false;
}
break;
case 0x01://Delete
{
DeleteTime = GetServerTime( ) + Config.DeleteTime;
if(!DB->QExecute(" UPDATE characters SET deletetime=%i WHERE char_name='%s'",
DeleteTime, (char*)&P->Buffer[2] ))
return false;
}
break;
}
BEGINPACKET( pak, 0x714 );
if(DeleteTime > 0 )
{
ADDDWORD ( pak, Config.DeleteTime );
}
else
{
ADDDWORD ( pak, 0x00000000 );
}
ADDSTRING ( pak, (char*)&P->Buffer[2] );
ADDBYTE ( pak, 0x00 );
thisclient->SendPacket( &pak );
return true;
}
开发者ID:osROSE,项目名称:osrose,代码行数:53,代码来源:charpackets.cpp
示例18: GETBYTE
// Change Party Options
bool CWorldServer::pakPartyOption( CPlayer* thisclient, CPacket* P )
{
if(!thisclient->Party->IsMaster)
return true;
CParty* party = thisclient->Party->party;
if(party==NULL)
return true;
party->Option = GETBYTE((*P),0);
BEGINPACKET( pak, 0x7d7 );
ADDBYTE ( pak, party->Option );
ADDBYTE ( pak, 0x00 );
party->SendToMembers( &pak );
return true;
}
开发者ID:TheDgtl,项目名称:osrose-droprev,代码行数:15,代码来源:Party.cpp
示例19: read_pubenc_keyid
static int
read_pubenc_keyid(PullFilter *pkt, uint8 *keyid_buf)
{
uint8 ver;
int res;
GETBYTE(pkt, ver);
if (ver != 3)
return -1;
res = pullf_read_fixed(pkt, 8, keyid_buf);
if (res < 0)
return res;
return pgp_skip_packet(pkt);
}
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:16,代码来源:pgp-info.c
示例20: GETDWORD
// Send server IP
bool CLoginServer::pakGetIP( CLoginClient* thisclient, CPacket* P )
{
if (!thisclient->isLoggedIn) return false;
;
MYSQL_ROW row;
DWORD servernum = GETDWORD( (*P), 0 );
BYTE channelnum = GETBYTE( (*P), 4 );
BEGINPACKET( pak, 0x70a );
if(!DB->QExecute( "UPDATE accounts SET lastsvr=%i,lastip='%s',lasttime=UNIX_TIMESTAMP( NOW() ) WHERE id=%i", channelnum, inet_ntoa( thisclient->clientinfo.sin_addr ), thisclient->userid))
return false;
MYSQL_RES *result = DB->QStore( "SELECT host,port,lanip,lansubmask,connected,maxconnections FROM channels WHERE id=%i and type=1", servernum );
if(result==NULL) return false;
if(mysql_num_rows(result)!=1)
{
Log(MSG_WARNING, "Player selected a invalid channel or channel offline" );
DB->QFree( );
return true;
}
row = mysql_fetch_row(result);
UINT connected = atoi(row[4]);
UINT maxconnections = atoi(row[5]);
ADDBYTE( pak, 0 );
ADDDWORD( pak, thisclient->userid );
ADDDWORD( pak, 0x87654321 );
if(strcmp(thisclient->ClientSubNet,row[3])==0)//from lan
{
ADDSTRING( pak, row[2] );
Log(MSG_INFO, "Lan: %s choice channel #%i", thisclient->username.c_str(), channelnum);
}
else if(strcmp( thisclient->ClientSubNet ,"127.0.0")==0)//same computer
{
ADDSTRING( pak, "127.0.0.1" );
Log(MSG_INFO, "Server: %s choice channel #%i", thisclient->username.c_str(), channelnum);
}
else
{
ADDSTRING( pak, row[0] );
Log(MSG_INFO, "Inet: %s choice channel #%i", thisclient->username.c_str(), channelnum);
}
ADDBYTE( pak, 0 );
ADDWORD( pak, atoi(row[1]) );
DB->QFree( );
thisclient->SendPacket ( &pak );
return true;
}
开发者ID:boermansjo,项目名称:KTRose_Server,代码行数:48,代码来源:loginpackets.cpp
注:本文中的GETBYTE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论