本文整理汇总了C++中pitem_free函数的典型用法代码示例。如果您正苦于以下问题:C++ pitem_free函数的具体用法?C++ pitem_free怎么用?C++ pitem_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pitem_free函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dtls1_clear_queues
static void dtls1_clear_queues(SSL *s)
{
pitem *item = NULL;
DTLS1_RECORD_DATA *rdata;
while ((item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *)item->data;
if (rdata->rbuf.buf) {
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->processed_rcds.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *)item->data;
if (rdata->rbuf.buf) {
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *)item->data;
if (rdata->rbuf.buf) {
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
dtls1_clear_received_buffer(s);
dtls1_clear_sent_buffer(s);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:35,代码来源:d1_lib.c
示例2: dtls1_buffer_record
int dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority)
{
DTLS1_RECORD_DATA *rdata;
pitem *item;
/* Limit the size of the queue to prevent DOS attacks */
if (pqueue_size(queue->q) >= 100)
return 0;
rdata = OPENSSL_malloc(sizeof(*rdata));
item = pitem_new(priority, rdata);
if (rdata == NULL || item == NULL) {
OPENSSL_free(rdata);
pitem_free(item);
SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR);
return -1;
}
rdata->packet = s->rlayer.packet;
rdata->packet_length = s->rlayer.packet_length;
memcpy(&(rdata->rbuf), &s->rlayer.rbuf, sizeof(SSL3_BUFFER));
memcpy(&(rdata->rrec), &s->rlayer.rrec, sizeof(SSL3_RECORD));
item->data = rdata;
#ifndef OPENSSL_NO_SCTP
/* Store bio_dgram_sctp_rcvinfo struct */
if (BIO_dgram_is_sctp(SSL_get_rbio(s)) &&
(SSL_get_state(s) == TLS_ST_SR_FINISHED
|| SSL_get_state(s) == TLS_ST_CR_FINISHED)) {
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_GET_RCVINFO,
sizeof(rdata->recordinfo), &rdata->recordinfo);
}
#endif
s->rlayer.packet = NULL;
s->rlayer.packet_length = 0;
memset(&s->rlayer.rbuf, 0, sizeof(s->rlayer.rbuf));
memset(&s->rlayer.rrec, 0, sizeof(s->rlayer.rrec));
if (!ssl3_setup_buffers(s)) {
SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR);
OPENSSL_free(rdata->rbuf.buf);
OPENSSL_free(rdata);
pitem_free(item);
return (-1);
}
/* insert should not fail, since duplicates are dropped */
if (pqueue_insert(queue->q, item) == NULL) {
SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR);
OPENSSL_free(rdata->rbuf.buf);
OPENSSL_free(rdata);
pitem_free(item);
return (-1);
}
return (1);
}
开发者ID:hydnoracoin,项目名称:Open-Source-Cryptocurrency-Exchange,代码行数:59,代码来源:rec_layer_d1.c
示例3: dtls1_clear_queues
static void dtls1_clear_queues(SSL *s)
{
pitem *item = NULL;
hm_fragment *frag = NULL;
DTLS1_RECORD_DATA *rdata;
while( (item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL)
{
rdata = (DTLS1_RECORD_DATA *) item->data;
if (rdata->rbuf.buf)
{
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
while( (item = pqueue_pop(s->d1->processed_rcds.q)) != NULL)
{
rdata = (DTLS1_RECORD_DATA *) item->data;
if (rdata->rbuf.buf)
{
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
while( (item = pqueue_pop(s->d1->buffered_messages)) != NULL)
{
frag = (hm_fragment *)item->data;
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
}
while ( (item = pqueue_pop(s->d1->sent_messages)) != NULL)
{
frag = (hm_fragment *)item->data;
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
}
while ( (item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL)
{
rdata = (DTLS1_RECORD_DATA *) item->data;
if (rdata->rbuf.buf)
{
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
}
开发者ID:AmineToujani,项目名称:openssl,代码行数:55,代码来源:d1_lib.c
示例4: dtls1_free
void dtls1_free(SSL *s)
{
pitem *item = NULL;
hm_fragment *frag = NULL;
ssl3_free(s);
while( (item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL)
{
OPENSSL_free(item->data);
pitem_free(item);
}
pqueue_free(s->d1->unprocessed_rcds.q);
while( (item = pqueue_pop(s->d1->processed_rcds.q)) != NULL)
{
OPENSSL_free(item->data);
pitem_free(item);
}
pqueue_free(s->d1->processed_rcds.q);
while( (item = pqueue_pop(s->d1->buffered_messages)) != NULL)
{
frag = (hm_fragment *)item->data;
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
}
pqueue_free(s->d1->buffered_messages);
while ( (item = pqueue_pop(s->d1->sent_messages)) != NULL)
{
frag = (hm_fragment *)item->data;
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
}
pqueue_free(s->d1->sent_messages);
while ( (item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL)
{
frag = (hm_fragment *)item->data;
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
}
pqueue_free(s->d1->buffered_app_data.q);
OPENSSL_free(s->d1);
}
开发者ID:dienbk7x,项目名称:NetmfSTM32,代码行数:50,代码来源:d1_lib.cpp
示例5: dtls1_clear_queues
static void dtls1_clear_queues(SSL *s) {
pitem *item = NULL;
hm_fragment *frag = NULL;
while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) {
frag = (hm_fragment *)item->data;
dtls1_hm_fragment_free(frag);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) {
frag = (hm_fragment *)item->data;
dtls1_hm_fragment_free(frag);
pitem_free(item);
}
}
开发者ID:friends110110,项目名称:boringssl,代码行数:16,代码来源:d1_lib.c
示例6: main
int
main(void)
{
pitem *item;
pqueue pq;
pq = pqueue_new();
item = pitem_new(3, NULL);
pqueue_insert(pq, item);
item = pitem_new(1, NULL);
pqueue_insert(pq, item);
item = pitem_new(2, NULL);
pqueue_insert(pq, item);
item = pqueue_find(pq, 1);
fprintf(stderr, "found %ld\n", item->priority);
item = pqueue_find(pq, 2);
fprintf(stderr, "found %ld\n", item->priority);
item = pqueue_find(pq, 3);
fprintf(stderr, "found %ld\n", item ? item->priority: 0);
pqueue_print(pq);
for(item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
pitem_free(item);
pqueue_free(pq);
return 0;
}
开发者ID:0b10011,项目名称:node,代码行数:34,代码来源:pq_test.c
示例7: dtls1_free
void dtls1_free(SSL *s)
{
pitem *item = NULL;
hm_fragment *frag = NULL;
ssl3_free(s);
while( (item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL)
{
OPENSSL_free(item->data);
pitem_free(item);
}
pqueue_free(s->d1->unprocessed_rcds.q);
while( (item = pqueue_pop(s->d1->processed_rcds.q)) != NULL)
{
OPENSSL_free(item->data);
pitem_free(item);
}
pqueue_free(s->d1->processed_rcds.q);
while( (item = pqueue_pop(s->d1->buffered_messages)) != NULL)
{
frag = (hm_fragment *)item->data;
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
}
pqueue_free(s->d1->buffered_messages);
while ( (item = pqueue_pop(s->d1->sent_messages)) != NULL)
{
frag = (hm_fragment *)item->data;
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
}
pqueue_free(s->d1->sent_messages);
pq_64bit_free(&(s->d1->bitmap.map));
pq_64bit_free(&(s->d1->bitmap.max_seq_num));
pq_64bit_free(&(s->d1->next_bitmap.map));
pq_64bit_free(&(s->d1->next_bitmap.max_seq_num));
OPENSSL_free(s->d1);
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:47,代码来源:d1_lib.c
示例8: DTLS_RECORD_LAYER_clear
void DTLS_RECORD_LAYER_clear(RECORD_LAYER *rl)
{
DTLS_RECORD_LAYER *d;
pitem *item = NULL;
DTLS1_RECORD_DATA *rdata;
pqueue unprocessed_rcds;
pqueue processed_rcds;
pqueue buffered_app_data;
d = rl->d;
while ((item = pqueue_pop(d->unprocessed_rcds.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *)item->data;
if (rdata->rbuf.buf) {
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
while ((item = pqueue_pop(d->processed_rcds.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *)item->data;
if (rdata->rbuf.buf) {
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
while ((item = pqueue_pop(d->buffered_app_data.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *)item->data;
if (rdata->rbuf.buf) {
OPENSSL_free(rdata->rbuf.buf);
}
OPENSSL_free(item->data);
pitem_free(item);
}
unprocessed_rcds = d->unprocessed_rcds.q;
processed_rcds = d->processed_rcds.q;
buffered_app_data = d->buffered_app_data.q;
memset(d, 0, sizeof *d);
d->unprocessed_rcds.q = unprocessed_rcds;
d->processed_rcds.q = processed_rcds;
d->buffered_app_data.q = buffered_app_data;
}
开发者ID:VaryJames,项目名称:Sample,代码行数:46,代码来源:rec_layer_d1.c
示例9: dtls1_retrieve_buffered_fragment
static int
dtls1_retrieve_buffered_fragment(SSL *s, long max, int *ok)
{
/* (0) check whether the desired fragment is available
* if so:
* (1) copy over the fragment to s->init_buf->data[]
* (2) update s->init_num
*/
pitem *item;
hm_fragment *frag;
int al;
*ok = 0;
item = pqueue_peek(s->d1->buffered_messages);
if ( item == NULL)
return 0;
frag = (hm_fragment *)item->data;
/* Don't return if reassembly still in progress */
if (frag->reassembly != NULL)
return 0;
if ( s->d1->handshake_read_seq == frag->msg_header.seq)
{
unsigned long frag_len = frag->msg_header.frag_len;
pqueue_pop(s->d1->buffered_messages);
al=dtls1_preprocess_fragment(s,&frag->msg_header,max);
if (al==0) /* no alert */
{
unsigned char *p = (unsigned char *)s->init_buf->data+DTLS1_HM_HEADER_LENGTH;
memcpy(&p[frag->msg_header.frag_off],
frag->fragment,frag->msg_header.frag_len);
}
dtls1_hm_fragment_free(frag);
pitem_free(item);
if (al==0)
{
*ok = 1;
return frag_len;
}
ssl3_send_alert(s,SSL3_AL_FATAL,al);
s->init_num = 0;
*ok = 0;
return -1;
}
else
return 0;
}
开发者ID:aosm,项目名称:OpenSSL098,代码行数:54,代码来源:d1_both.c
示例10: dtls1_clear_record_buffer
/* call this function when the buffered messages are no longer needed */
void
dtls1_clear_record_buffer(SSL *s)
{
pitem *item;
for(item = pqueue_pop(s->d1->sent_messages);
item != NULL; item = pqueue_pop(s->d1->sent_messages))
{
dtls1_hm_fragment_free((hm_fragment *)item->data);
pitem_free(item);
}
}
开发者ID:aosm,项目名称:OpenSSL098,代码行数:13,代码来源:d1_both.c
示例11: dtls1_retrieve_buffered_record
int dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue)
{
pitem *item;
item = pqueue_pop(queue->q);
if (item) {
dtls1_copy_record(s, item);
OPENSSL_free(item->data);
pitem_free(item);
return 1;
}
return 0;
}
开发者ID:Ana06,项目名称:openssl,代码行数:16,代码来源:rec_layer_d1.c
示例12: dtls1_retrieve_buffered_fragment
static int
dtls1_retrieve_buffered_fragment(SSL *s, unsigned long *copied)
{
/* (0) check whether the desired fragment is available
* if so:
* (1) copy over the fragment to s->init_buf->data[]
* (2) update s->init_num
*/
pitem *item;
hm_fragment *frag;
unsigned long overlap;
unsigned char *p;
item = pqueue_peek(s->d1->buffered_messages);
if ( item == NULL)
return 0;
frag = (hm_fragment *)item->data;
if ( s->d1->handshake_read_seq == frag->msg_header.seq &&
frag->msg_header.frag_off <= (unsigned int)s->init_num - DTLS1_HM_HEADER_LENGTH)
{
pqueue_pop(s->d1->buffered_messages);
overlap = s->init_num - DTLS1_HM_HEADER_LENGTH
- frag->msg_header.frag_off;
p = frag->fragment;
memcpy(&s->init_buf->data[s->init_num],
p + DTLS1_HM_HEADER_LENGTH + overlap,
frag->msg_header.frag_len - overlap);
OPENSSL_free(frag->fragment);
OPENSSL_free(frag);
pitem_free(item);
*copied = frag->msg_header.frag_len - overlap;
return *copied;
}
else
return 0;
}
开发者ID:174high,项目名称:openssl-0.9.8e_linux_porting,代码行数:42,代码来源:d1_both.c
示例13: trivial
static int trivial() {
pqueue q = pqueue_new();
if (q == NULL) {
return 0;
}
int32_t data = 0xdeadbeef;
uint8_t priority[8] = {0};
pitem *item = pitem_new(priority, &data);
if (item == NULL ||
pqueue_insert(q, item) != item ||
pqueue_size(q) != 1 ||
pqueue_peek(q) != item ||
pqueue_pop(q) != item ||
pqueue_size(q) != 0 ||
pqueue_pop(q) != NULL) {
return 0;
}
pitem_free(item);
pqueue_free(q);
return 1;
}
开发者ID:ZzeetteEZzOLARINventionZ,项目名称:libwebrtc,代码行数:21,代码来源:pqueue_test.c
示例14: main
int
main(void)
{
pitem *item;
pqueue pq;
int one = 1;
int two = 2;
int three = 3;
pq = pqueue_new();
item = pitem_new((unsigned char*)&three, NULL);
pqueue_insert(pq, item);
item = pitem_new((unsigned char*)&one, NULL);
pqueue_insert(pq, item);
item = pitem_new((unsigned char*)&two, NULL);
pqueue_insert(pq, item);
item = pqueue_find(pq, (unsigned char*)&one);
TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR, "found %ld\n", item->priority);
item = pqueue_find(pq, (unsigned char*)&two);
TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR, "found %ld\n", item->priority);
item = pqueue_find(pq, (unsigned char*)&three);
TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR, "found %ld\n", item ? item->priority: 0);
pqueue_print(pq);
for(item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
pitem_free(item);
pqueue_free(pq);
return 0;
}
开发者ID:Sorcha,项目名称:NETMF-LPC,代码行数:38,代码来源:pq_test.cpp
示例15: main
int main(void)
{
pitem *item;
pqueue pq;
pq = pqueue_new();
item = pitem_new(prio3, NULL);
pqueue_insert(pq, item);
item = pitem_new(prio1, NULL);
pqueue_insert(pq, item);
item = pitem_new(prio2, NULL);
pqueue_insert(pq, item);
item = pqueue_find(pq, prio1);
fprintf(stderr, "found %p\n", item->priority);
item = pqueue_find(pq, prio2);
fprintf(stderr, "found %p\n", item->priority);
item = pqueue_find(pq, prio3);
fprintf(stderr, "found %p\n", item ? item->priority : 0);
pqueue_print(pq);
if (!pqueue_test(pq))
return 1;
for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
pitem_free(item);
pqueue_free(pq);
return 0;
}
开发者ID:vigortls,项目名称:vigortls,代码行数:37,代码来源:pqueue_test.c
示例16: dtls1_read_bytes
/*-
* Return up to 'len' payload bytes received in 'type' records.
* 'type' is one of the following:
*
* - SSL3_RT_HANDSHAKE (when ssl3_get_message calls us)
* - SSL3_RT_APPLICATION_DATA (when ssl3_read calls us)
* - 0 (during a shutdown, no data has to be returned)
*
* If we don't have stored data to work from, read a SSL/TLS record first
* (possibly multiple records if we still don't have anything to return).
*
* This function must handle any surprises the peer may have for us, such as
* Alert records (e.g. close_notify) or renegotiation requests. ChangeCipherSpec
* messages are treated as if they were handshake messages *if* the |recd_type|
* argument is non NULL.
* Also if record payloads contain fragments too small to process, we store
* them until there is enough for the respective protocol (the record protocol
* may use arbitrary fragmentation and even interleaving):
* Change cipher spec protocol
* just 1 byte needed, no need for keeping anything stored
* Alert protocol
* 2 bytes needed (AlertLevel, AlertDescription)
* Handshake protocol
* 4 bytes needed (HandshakeType, uint24 length) -- we just have
* to detect unexpected Client Hello and Hello Request messages
* here, anything else is handled by higher layers
* Application data protocol
* none of our business
*/
int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
size_t len, int peek, size_t *readbytes)
{
int i, j, iret;
size_t n;
SSL3_RECORD *rr;
void (*cb) (const SSL *ssl, int type2, int val) = NULL;
if (!SSL3_BUFFER_is_initialised(&s->rlayer.rbuf)) {
/* Not initialized yet */
if (!ssl3_setup_buffers(s)) {
/* SSLfatal() already called */
return -1;
}
}
if ((type && (type != SSL3_RT_APPLICATION_DATA) &&
(type != SSL3_RT_HANDSHAKE)) ||
(peek && (type != SSL3_RT_APPLICATION_DATA))) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_DTLS1_READ_BYTES,
ERR_R_INTERNAL_ERROR);
return -1;
}
if (!ossl_statem_get_in_handshake(s) && SSL_in_init(s)) {
/* type == SSL3_RT_APPLICATION_DATA */
i = s->handshake_func(s);
/* SSLfatal() already called if appropriate */
if (i < 0)
return i;
if (i == 0)
return -1;
}
start:
s->rwstate = SSL_NOTHING;
/*-
* s->s3.rrec.type - is the type of record
* s->s3.rrec.data, - data
* s->s3.rrec.off, - offset into 'data' for next read
* s->s3.rrec.length, - number of bytes.
*/
rr = s->rlayer.rrec;
/*
* We are not handshaking and have no data yet, so process data buffered
* during the last handshake in advance, if any.
*/
if (SSL_is_init_finished(s) && SSL3_RECORD_get_length(rr) == 0) {
pitem *item;
item = pqueue_pop(s->rlayer.d->buffered_app_data.q);
if (item) {
#ifndef OPENSSL_NO_SCTP
/* Restore bio_dgram_sctp_rcvinfo struct */
if (BIO_dgram_is_sctp(SSL_get_rbio(s))) {
DTLS1_RECORD_DATA *rdata = (DTLS1_RECORD_DATA *)item->data;
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_SET_RCVINFO,
sizeof(rdata->recordinfo), &rdata->recordinfo);
}
#endif
dtls1_copy_record(s, item);
OPENSSL_free(item->data);
pitem_free(item);
}
}
/* Check for timeout */
if (dtls1_handle_timeout(s) > 0) {
//.........这里部分代码省略.........
开发者ID:Ana06,项目名称:openssl,代码行数:101,代码来源:rec_layer_d1.c
示例17: dtls1_read_bytes
//.........这里部分代码省略.........
}
start:
s->rwstate = SSL_NOTHING;
/*-
* s->s3->rrec.type - is the type of record
* s->s3->rrec.data, - data
* s->s3->rrec.off, - offset into 'data' for next read
* s->s3->rrec.length, - number of bytes.
*/
rr = s->rlayer.rrec;
/*
* We are not handshaking and have no data yet, so process data buffered
* during the last handshake in advance, if any.
*/
if (SSL_is_init_finished(s) && SSL3_RECORD_get_length(rr) == 0) {
pitem *item;
item = pqueue_pop(s->rlayer.d->buffered_app_data.q);
if (item) {
#ifndef OPENSSL_NO_SCTP
/* Restore bio_dgram_sctp_rcvinfo struct */
if (BIO_dgram_is_sctp(SSL_get_rbio(s))) {
DTLS1_RECORD_DATA *rdata = (DTLS1_RECORD_DATA *)item->data;
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_SET_RCVINFO,
sizeof(rdata->recordinfo), &rdata->recordinfo);
}
#endif
dtls1_copy_record(s, item);
OPENSSL_free(item->data);
pitem_free(item);
}
}
/* Check for timeout */
if (dtls1_handle_timeout(s) > 0)
goto start;
/* get new packet if necessary */
if ((SSL3_RECORD_get_length(rr) == 0)
|| (s->rlayer.rstate == SSL_ST_READ_BODY)) {
ret = dtls1_get_record(s);
if (ret <= 0) {
ret = dtls1_read_failed(s, ret);
/* anything other than a timeout is an error */
if (ret <= 0)
return (ret);
else
goto start;
}
}
/*
* Reset the count of consecutive warning alerts if we've got a non-empty
* record that isn't an alert.
*/
if (SSL3_RECORD_get_type(rr) != SSL3_RT_ALERT
&& SSL3_RECORD_get_length(rr) != 0)
s->rlayer.alert_count = 0;
/* we now have a packet which can be read and processed */
if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec,
开发者ID:hydnoracoin,项目名称:Open-Source-Cryptocurrency-Exchange,代码行数:67,代码来源:rec_layer_d1.c
示例18: fixed_random
static int fixed_random() {
/* Random order of 10 elements, chosen by
* random.choice(list(itertools.permutations(range(10)))) */
int ordering[NUM_ITEMS] = {9, 6, 3, 4, 0, 2, 7, 1, 8, 5};
int i;
pqueue q = pqueue_new();
uint8_t priority[8] = {0};
piterator iter;
pitem *curr, *item;
if (q == NULL) {
return 0;
}
/* Insert the elements */
for (i = 0; i < NUM_ITEMS; i++) {
priority[7] = ordering[i];
item = pitem_new(priority, &ordering[i]);
if (pqueue_insert(q, item) != item) {
return 0;
}
}
/* Insert the elements again. This inserts duplicates and should
* fail. */
for (i = 0; i < NUM_ITEMS; i++) {
priority[7] = ordering[i];
item = pitem_new(priority, &ordering[i]);
if (pqueue_insert(q, item) != NULL) {
return 0;
}
pitem_free(item);
}
if (pqueue_size(q) != NUM_ITEMS) {
return 0;
}
/* Iterate over the elements. */
iter = pqueue_iterator(q);
curr = pqueue_next(&iter);
if (curr == NULL) {
return 0;
}
while (1) {
pitem *next = pqueue_next(&iter);
int *curr_data, *next_data;
if (next == NULL) {
break;
}
curr_data = (int*)curr->data;
next_data = (int*)next->data;
if (*curr_data >= *next_data) {
return 0;
}
curr = next;
}
pqueue_free(q);
return 1;
}
开发者ID:ZzeetteEZzOLARINventionZ,项目名称:libwebrtc,代码行数:61,代码来源:pqueue_test.c
注:本文中的pitem_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论