Exemple #1
1
PPPoE::PPPoE(const uint8_t* buffer, uint32_t total_sz)
    : tags_size_() {
    InputMemoryStream stream(buffer, total_sz);
    stream.read(header_);
    stream.size(std::min(stream.size(), (size_t)payload_length()));
    // If this is a session data packet
    if (code() == 0) {
        if (stream) {
            inner_pdu(
                new RawPDU(stream.pointer(), stream.size())
            );
        }
    }
    else {
        while (stream) {
            TagTypes opt_type = static_cast<TagTypes>(stream.read<uint16_t>());
            uint16_t opt_len = stream.read_be<uint16_t>();
            if (!stream.can_read(opt_len)) {
                throw malformed_packet();
            }
            add_tag(tag(opt_type, opt_len, stream.pointer()));
            stream.skip(opt_len);
        }
    }
}
Exemple #2
0
void
reset_tags(struct strb **tags)
{
	add_tag(tags, "user", "%s", "");
	add_tag(tags, "home", "%s", "");
	add_tag(tags, "uid", "%s", "");
	add_tag(tags, "gid", "%s", "");
}
Exemple #3
0
void
update_tags(struct strb **tags, struct userdata *ud)
{
	add_tag(tags, "user", "%s", ud->name);
	add_tag(tags, "home", "%s", ud->home);
	add_tag(tags, "uid", "%lu", (u_long) ud->uid);
	add_tag(tags, "gid", "%lu", (u_long) ud->gid);
}
Exemple #4
0
/* Body state. */
int
imap_state_body(struct account *a, struct fetch_ctx *fctx)
{
	struct fetch_imap_data	*data = a->data;
	struct mail		*m = fctx->mail;
	struct fetch_imap_mail	*aux;
	char			*line, *ptr;
	u_int			 n;

	if (imap_getln(a, fctx, IMAP_UNTAGGED, &line) != 0)
		return (FETCH_ERROR);
	if (line == NULL)
		return (FETCH_BLOCK);

	if (sscanf(line, "* %u FETCH (", &n) != 1)
		return (imap_invalid(a, line));
	if ((ptr = strstr(line, "BODY[] {")) == NULL)
		return (imap_invalid(a, line));

	if (sscanf(ptr, "BODY[] {%zu}", &data->size) != 1)
		return (imap_invalid(a, line));
	data->lines = 0;

	/* Fill in local data. */
	aux = xcalloc(1, sizeof *aux);
	aux->uid = ARRAY_FIRST(&data->wanted);
	m->auxdata = aux;
	m->auxfree = imap_free;
	ARRAY_REMOVE(&data->wanted, 0);

	/* Open the mail. */
	if (mail_open(m, data->size) != 0) {
		log_warnx("%s: failed to create mail", a->name);
		return (FETCH_ERROR);
	}
	m->size = 0;

	/* Tag mail. */
	default_tags(&m->tags, data->src);
	if (data->server.host != NULL) {
		add_tag(&m->tags, "server", "%s", data->server.host);
		add_tag(&m->tags, "port", "%s", data->server.port);
	}
	add_tag(&m->tags, "server_uid", "%u", aux->uid);
	add_tag(&m->tags,
	    "folder", "%s", ARRAY_ITEM(data->folders, data->folder));

	/* If we already know the mail is oversize, start off flushing it. */
	data->flushing = data->size > conf.max_size;

	fctx->state = imap_state_line;
	return (FETCH_AGAIN);
}
Exemple #5
0
void
build_bootp_record(struct bootp *bp,
                   const char *if_name,
                   const char *addrs_ip,
                   const char *addrs_netmask,
                   const char *addrs_broadcast,
                   const char *addrs_gateway,
                   const char *addrs_server)
{
    int i, s;
    in_addr_t addr;
    unsigned char *vp;
    unsigned char cookie[] = VM_RFC1048;
    struct ifreq ifr;

    bzero(bp, sizeof(struct bootp));
    bp->bp_op = BOOTREPLY;
    bp->bp_htype = HTYPE_ETHERNET;
    bp->bp_hlen = 6;

    // Query the hardware address
    for (i = 0;  i < bp->bp_hlen;  i++) {
        bp->bp_chaddr[i] = 0xFF;  // Unknown
    }
    s = socket(AF_INET, SOCK_DGRAM, 0);
    if (s >= 0) {
        strcpy(ifr.ifr_name, if_name);
        if (ioctl(s, SIOCGIFHWADDR, &ifr) >= 0) {
            bcopy(ifr.ifr_hwaddr.sa_data, bp->bp_chaddr, bp->bp_hlen);
        }
        close(s);
    }

    // Fill in the provided IP addresses
    bp->bp_ciaddr.s_addr = inet_addr(addrs_ip);
    bp->bp_yiaddr.s_addr = inet_addr(addrs_ip);
    bp->bp_siaddr.s_addr = inet_addr(addrs_server);
    bp->bp_giaddr.s_addr = inet_addr(addrs_gateway);
    vp = &bp->bp_vend[0];
    bcopy(&cookie, vp, sizeof(cookie));
    vp += sizeof(cookie);
    addr = inet_addr(addrs_netmask);
    vp = add_tag(vp, TAG_SUBNET_MASK, &addr, sizeof(in_addr_t));
    addr = inet_addr(addrs_broadcast);
    vp = add_tag(vp, TAG_IP_BROADCAST, &addr, sizeof(in_addr_t));
    addr = inet_addr(addrs_gateway);
    vp = add_tag(vp, TAG_GATEWAY, &addr, sizeof(in_addr_t));
    *vp = TAG_END;
}
Exemple #6
0
static psf_tag * process_tag_line( psf_tag * tags, char * line )
{
    char * name, * value, * end;
    char * equals = strchr( line, '=' );
    if ( !equals ) return tags;

    name = line;
    value = equals + 1;
    end = line + strlen( line );

    while ( name < equals && *name > 0 && *name <= ' ' ) name++;
    if ( name == equals ) return tags;

    --equals;
    while ( equals > name && *equals > 0 && *equals <= ' ' ) --equals;
    equals[1] = '\0';

    while ( value < end && *value > 0 && *value <= ' ' ) value++;
    if ( value == end ) return tags;

    --end;
    while ( end > value && *value > 0 && *value <= ' ' ) --end;
    end[1] = '\0';

    if ( *name == '_' )
    {
        psf_tag * tag = find_tag( tags, name );
        if ( tag ) return tags;
    }

    return add_tag( tags, name, value );
}
Exemple #7
0
/*************************************************************************
 *
 * Makes a copy of a tag into a PPPoE packe
 *
 ************************************************************************/
void copy_tag(struct pppoe_packet *dest, struct pppoe_tag *pt)
{
    struct pppoe_tag *end_tag = get_tag(dest->hdr, PTT_EOL);
    int tagid;
    int tag_len;
    if( !pt ) {
	return;
    }
    tagid = tag_index(pt->tag_type);

    tag_len = sizeof(struct pppoe_tag) + ntohs(pt->tag_len);

    if( end_tag ){
	memcpy(((char*)end_tag)+tag_len ,
	       end_tag, sizeof(struct pppoe_tag));

	dest->tags[tagid]=end_tag;
	dest->tags[TAG_EOL] = (struct pppoe_tag*)((char*)dest->tags[TAG_EOL] + tag_len);
	memcpy(end_tag, pt, tag_len);
	dest->hdr->length = htons(ntohs(dest->hdr->length) + tag_len);

    }else{
	memcpy(next_tag(dest->hdr),pt, tag_len);
	dest->tags[tagid]=next_tag(dest->hdr);
	add_tag(dest->hdr,next_tag(dest->hdr));
    }


}
Exemple #8
0
Fichier : txt.c Projet : aahls/txt
void mode_tag_edit(int argc, char **argv, note_db_t *db, int remove){
    int i, tag_i=0, id_i=0;
    char **tags=(char **) malloc(sizeof(char *)*(argc-optind));
    int *ids=(int *) malloc(sizeof(int *)*(argc-optind));
    for(i=optind;i<argc;i++){
        if(argv[i][0]=='#'){
            //Point to characters just after the hash
            tags[tag_i]=argv[i]+1;
            tag_i++;
        }else if((ids[id_i]=atoi_altfail(argv[i]))!=-1){
            id_i++;
        }else{
            printf("%s is neither a tag (specified with a # sign) or an ID. Ignoring.\n", argv[i]);
        }
    }

    for(i=0;i<id_i;i++){
        int j;
        note_t *note=get_note_id(db, ids[i]);
        for(j=0;j<tag_i;j++){
            if(remove) del_tag(note, tags[j]);
            else add_tag(note, tags[j]);
        }
    }

    free(tags);
    free(ids);
}
Exemple #9
0
void init_tags(void)
{
    num_tags = 0;
    for (int i = 0; i < MAXTAGS; i++)
        tags[i] = NULL;
    add_tag(DEFAULT_TAG_NAME);
}
Exemple #10
0
void PI_ENCRYPT_LAST_BLOCK(
        PI_CTX *ctx,
        void *dest,
        const void *src,
        size_t length_b,
        unsigned long num )
{
    state_t a;
    while (length_b >= PI_PT_BLOCK_LENGTH_BITS) {
        PI_ENCRYPT_BLOCK(ctx, dest, src, num);
        num++;
        length_b -= PI_PT_BLOCK_LENGTH_BITS;
        src = &((uint8_t*)src)[PI_PT_BLOCK_LENGTH_BYTES];
        if (dest) {
            dest = &((uint8_t*)dest)[PI_CT_BLOCK_LENGTH_BYTES];
        }
    }
    ctr_trans(ctx, a, num);
    inject_last_block(a, src, length_b);
    if (dest) {
        uint8_t tmp[PI_PT_BLOCK_LENGTH_BYTES];
        extract_block(tmp, a);
        memcpy(dest, tmp, (length_b + 7) / 8);
    }
    pi((word_t*)a);
    add_tag(ctx, a);
}
Exemple #11
0
void add_pack_id(log_group_builder* bder, const char* pack, size_t pack_len, size_t packNum)
{
    char packStr[128];
    packStr[127] = '\0';
    snprintf(packStr, 127, "%s-%X", pack, (unsigned int)packNum);
    add_tag(bder, "__pack_id__", strlen("__pack_id__"), packStr, strlen(packStr));
}
Exemple #12
0
PPPoE::PPPoE(const uint8_t *buffer, uint32_t total_sz) 
: _tags_size()
{
    if(total_sz < sizeof(_header))
        throw malformed_packet();
    std::memcpy(&_header, buffer, sizeof(_header));
    buffer += sizeof(_header);
    total_sz -= sizeof(_header);
    total_sz = std::min(total_sz, (uint32_t)payload_length());
    const uint8_t *end = buffer + total_sz;
    while(buffer < end) {
        if(buffer + sizeof(uint32_t) * 2 > end)
            throw malformed_packet();
        uint16_t opt_type;
        std::memcpy(&opt_type, buffer, sizeof(uint16_t));
        uint16_t opt_len;
        std::memcpy(&opt_len, buffer + sizeof(uint16_t), sizeof(uint16_t));
        buffer += sizeof(uint16_t) * 2;
        total_sz -= sizeof(uint16_t) * 2;
        if(Endian::be_to_host(opt_len) > total_sz)
            throw malformed_packet();
        add_tag(
            tag(
                static_cast<TagTypes>(opt_type), 
                Endian::be_to_host(opt_len), 
                buffer
            )
        );
        buffer += Endian::be_to_host(opt_len);
        total_sz -= Endian::be_to_host(opt_len);
    }
}
Exemple #13
0
int
deliver_tag_deliver(struct deliver_ctx *dctx, struct actitem *ti)
{
	struct account		*a = dctx->account;
	struct mail		*m = dctx->mail;
	struct deliver_tag_data	*data = ti->data;
	char			*tk, *tv;

	tk = replacestr(&data->key, m->tags, m, &m->rml);
	if (data->value.str != NULL)
		tv = replacestr(&data->value, m->tags, m, &m->rml);
	else
		tv = xstrdup("");

	if (tk == NULL || tv == NULL) {
		if (tk != NULL)
			xfree(tk);
		if (tv != NULL)
			xfree(tv);
		return (DELIVER_SUCCESS);
	}

	if (*tk != '\0') {
		log_debug2("%s: tagging message: %s (%s)", a->name, tk, tv);
		add_tag(&m->tags, tk, "%s", tv);
	}

	xfree(tk);
	xfree(tv);

	return (DELIVER_SUCCESS);
}
Exemple #14
0
void hunpos_tagger_tag(Hunpos hp, int n, void* tokens, const char* (*get_token)(void*,int, int*), void* tags, void (*add_tag)(void*,int,const char*, int*), int* error)
{
	CAMLparam0();
	CAMLlocal3 (return_value, list, v);
	int i;
	list = Val_emptylist;  /* the [] */
	*error = 0;
	for(i = 0; i< n; i ++)
	{
		/* Allocate a cons cell */
		v = caml_alloc_small(2, 0);
		const char* token = get_token(tokens, i, error);
		if (*error != 0) CAMLreturn0;
		Store_field (v, 0, caml_copy_string(token) );
		Store_field (v, 1, list );
		list = v;
	}

	return_value = caml_callback(*((value*)hp), list);
	return_value = Field(return_value,1);

	i = 0;
	while(return_value != Val_emptylist) {
		char* s = String_val(Field(return_value, Tag_cons));
		add_tag(tags, i++, s, error);
		if (*error != 0) CAMLreturn0;
		return_value = Field(return_value, 1);
	}

	CAMLreturn0;

}
Exemple #15
0
class_tag::class_tag(const config & cfg)
	: name_(cfg["name"].str())
	, min_(cfg["min"].to_int())
	, max_(cfg["max"].to_int())
	, super_("")
	, tags_()
	, keys_()
	, links_()
{
		if (max_ < 0){
			max_ = INT_MAX;
		}
		if (cfg.has_attribute("super")){
			super_ = cfg["super"].str();
		}
		foreach (const config &child, cfg.child_range("tag")) {
			class_tag child_tag (child);
			add_tag(child_tag);
		}
		foreach (const config &child, cfg.child_range("key")) {
			class_key child_key (child);
			add_key(child_key);
		}
		foreach (const config &link, cfg.child_range("link")) {
			std::string link_name = link["name"].str();
			add_link(link_name);
		}
}
Exemple #16
0
/* GMail extensions body state. */
int
imap_state_gmext_body(struct account *a, struct fetch_ctx *fctx)
{
	struct fetch_imap_data	*data = a->data;
	struct mail		*m = fctx->mail;
	char			*line, *lb;
	int     	         tag;
	u_int			 n;
	uint64_t		 thrid, msgid;
	size_t			 lblen;

	for (;;) {
		if (imap_getln(a, fctx, IMAP_RAW, &line) != 0)
			return (FETCH_ERROR);
		if (line == NULL)
			return (FETCH_BLOCK);
		tag = imap_tag(line);
		if (tag == IMAP_TAG_NONE)
			break;
		if (tag == data->tag) {
			fctx->state = imap_state_next;
			return (FETCH_MAIL);
		}
		return (FETCH_ERROR);
	}

	if (sscanf(line, "* %u FETCH (X-GM-THRID %llu X-GM-MSGID %llu ", &n,
	    &thrid, &msgid) != 3)
		return (imap_invalid(a, line));
	if ((lb = strstr(line, "X-GM-LABELS")) == NULL)
		return (imap_invalid(a, line));
	if ((lb = strchr(lb, '(')) == NULL)
		return (imap_invalid(a, line));
	lb++; /* drop '(' */
	lblen = strlen(lb);
	if (lblen < 2 || lb[lblen - 1] != ')' || lb[lblen - 2] != ')')
		return (imap_invalid(a, line));
	lblen -= 2; /* drop '))' from the end */

	add_tag(&m->tags, "gmail_msgid", "%llu", msgid);
	add_tag(&m->tags, "gmail_thrid", "%llu", thrid);
	add_tag(&m->tags, "gmail_labels", "%.*s", (int)lblen, lb);

	fctx->state = imap_state_gmext_done;
	return (FETCH_AGAIN);
}
Exemple #17
0
void CESets::add_tag(const std::string &tag_name, const char *value)
{
  iBase_TagHandle tag_handle;
  int err;
  iMesh_getTagHandle(impl_, tag_name.c_str(), &tag_handle, &err,
                     tag_name.size());
  check_error(impl_, err);

  add_tag(tag_handle, value);
}
Exemple #18
0
Fichier : main.c Projet : llxp/llxp
int main()
{
    //mysql_start();
    print_header();
    print_html_header(titel_);
    //var_copy=getenv("QUERY_STRING");
    parse_content(getdata_force("GET"), "=", "&", "POST");
    parse_content(getdata_force("POST"), "=", "&", "GET");
    //parse_content(getdata_force("POST"), "=", "&", "POST");
       // parse_content(getdata_force("POST"), "=", "&", 0);
//    printf("%s\n%s", getdata_force("GET"),getdata_force("POST"));
//char *post_query=(char*) malloc(100 * sizeof(char));
//char *get_query=(char*) malloc(strlen(default_string)*100* sizeof(char));
    //sprintf(post_query, "%s", getdata_force("POST"));
    //sprintf(get_query, "%s", getdata_force("GET"));
   // printf("%s", post_query);
    //strcpy(get_query, getdata_force("GET"));
    /*if(strcmp(_GET[0][0],"method")==0){
        if(strcmp(_GET[0][1], "normal")==0){
            if(strcmp(_GET[1][0],"action")==0){
                if(strcmp(_GET[1][1],"post")==0){

                    char *content_length = getenv("CONTENT_LENGTH");
                    if(content_length==NULL){

                        goto exit;
                    }
                    else{
                        size = (unsigned long) atoi(content_length);
                        if(size<=0){

                            goto exit;
                        }else{
                            content_post = (char *) malloc(size+1);
                            if(content_post==NULL){
                                free(content_post);
                                goto exit;
                            }*/
                            //scanf("%s", post_var);
                            //printf("%s", post_query);
                            //parse_content(post_query, "=", "&", "POST");
                            printf("<h1>!%s!!</h1>", _POST[0][1]);
                            //printf("Hallo!!!%s", _POST[0][1]);
                            //printf("%d", (int)strlen(*_POST[0]));
                           // for(a=0;a<(int)strlen(_POST[a]))
                            //for(b=0;b<(int)strlen(_POST[0][1]);b++){
                              //  stringReplace("+", "", _POST[0][1]);
                            //}
                            printf("\n%s=%s\n", _POST[0][0],_POST[0][1]);
                            add_tag("ul", "style={float:left;} id='left' class='left'");
                            addslash("ul");
                            //free(content_post);
                            //goto exit;

                        }
Exemple #19
0
ani_request_t *ani_create_request(const char *raw_request)
{
    ani_request_t *request = (ani_request_t *)xmalloc(sizeof(ani_request_t));

    assert(NULL != raw_request);
    (void)xstrncpy(request->msg, raw_request, RAW_LEN);
    add_space(request);
    add_tag(request);
    add_session(request);
    return request;
}
Exemple #20
0
void PI_PROCESS_AD_BLOCK(
        PI_CTX *ctx,
        const void *ad,
        unsigned long ad_num )
{
    state_t a;
    ctr_trans(ctx, a, ad_num);
    inject_block(a, ad);
    pi((word_t*)a);
    add_tag(ctx, a);
}
Exemple #21
0
static void
add_tagsym(rotz_t ctx, const char *tag, const char *sym)
{
	rtz_vtx_t tid;

	tag = rotz_tag(tag);
	if (UNLIKELY((tid = rotz_add_vertex(ctx, tag)) == 0U)) {
		return;
	}
	add_tag(ctx, tid, sym);
	return;
}
Exemple #22
0
static void push_node(lua_State *L, const GumboNode *node) {
    luaL_checkstack(L, 10, "element nesting too deep");
    switch (node->type) {
    case GUMBO_NODE_DOCUMENT: {
        const GumboDocument *document = &node->v.document;
        lua_createtable(L, document->children.length, 4);
        add_literal(L, "type", "document");
        add_string(L, "quirks_mode", quirksmap[document->doc_type_quirks_mode]);
        if (document->has_doctype) {
            lua_createtable(L, 0, 3);
            add_string(L, "name", document->name);
            add_string(L, "publicId", document->public_identifier);
            add_string(L, "systemId", document->system_identifier);
            lua_setfield(L, -2, "doctype");
        }
        add_children(L, &document->children);
        return;
    }
    case GUMBO_NODE_ELEMENT: {
        const GumboElement *element = &node->v.element;
        lua_createtable(L, element->children.length, 7);
        lua_getfield(L, LUA_REGISTRYINDEX, "gumbo.element");
        lua_setmetatable(L, -2);
        add_tag(L, element);
        add_string(L, "tag_namespace", tagnsmap[element->tag_namespace]);
        add_integer(L, "line", element->start_pos.line);
        add_integer(L, "column", element->start_pos.column);
        add_integer(L, "offset", element->start_pos.offset);
        add_parseflags(L, node->parse_flags);
        add_attributes(L, &element->attributes);
        add_children(L, &element->children);
        return;
    }
    case GUMBO_NODE_TEXT:
        create_text_node(L, &node->v.text);
        add_literal(L, "type", "text");
        return;
    case GUMBO_NODE_COMMENT:
        create_text_node(L, &node->v.text);
        add_literal(L, "type", "comment");
        return;
    case GUMBO_NODE_CDATA:
        create_text_node(L, &node->v.text);
        add_literal(L, "type", "cdata");
        return;
    case GUMBO_NODE_WHITESPACE:
        create_text_node(L, &node->v.text);
        add_literal(L, "type", "whitespace");
        return;
    }
}
Exemple #23
0
void PI_ENCRYPT_SMN(
        PI_CTX *ctx,
        void *c0,
        const void *smn)
{
    ctx->ctr++;
    ctr_trans(ctx, ctx->cis, 0);
    inject_block(ctx->cis, smn);
    if (c0) {
        extract_block(c0, ctx->cis);
    }
    pi((word_t*)ctx->cis);
    add_tag(ctx, ctx->cis);
}
Exemple #24
0
/*
 * insert extra into it's list after creating the element
 * and adding the tag into the tag list
 * @param tag
 * @param value
 * @param insert list
 * @return 0(success)/ < 0 (error)
 */
static inline int add_extra(str* tag, str* value,
		struct acc_extra** bkend_list, tag_t** tag_arr, int* tags_len)
{
	int tag_idx;

	struct acc_extra *xel, *it;

	/* first try adding the tag */
	if ((tag_idx=add_tag(tag, tag_arr, tags_len)) < 0) {
		LM_ERR("failed to add tag\n");
		return -1;
	}

	if ((xel=shm_malloc(sizeof(struct acc_extra))) == NULL) {
		LM_ERR("no more pkg mem!\n");
		return -1;
	}

	xel->tag_idx = tag_idx;
	xel->name = *value;


	xel->next  = NULL;

	if (*bkend_list == NULL) {
		*bkend_list = xel;
		return 0;
	}

	for ( it=*bkend_list; it; it=it->next) {
		/* check if someone is trying to define same tag twice
		 * for the same backend*/
		if (it->tag_idx == xel->tag_idx) {
			LM_WARN("Tag <%.*s> redefined for same backend!"
				" Previous definition for this tag in this backend"
				" will be overridden!\n",
				extra_tags[xel->tag_idx].len, extra_tags[xel->tag_idx].s);
			break;
		}

		/* add the element at the end of the list and exit */
		if (it->next == NULL) {
			it->next = xel;
			break;
		}
	}

	return 0;
}
Exemple #25
0
void PI_ENCRYPT_BLOCK(
        PI_CTX *ctx,
        void *dest,
        const void *src,
        unsigned long num )
{
    state_t a;
    ctr_trans(ctx, a, num);
    inject_block(a, src);
    if (dest) {
        extract_block(dest, a);
    }
    pi((word_t*)a);
    add_tag(ctx, a);
}
Exemple #26
0
void PI_DECRYPT_SMN(
        PI_CTX *ctx,
        void *smn,
        const void *c0)
{
    ctx->ctr++;
    ctr_trans(ctx, ctx->cis, 0);
    inject_block(ctx->cis, c0);
    if (smn) {
        extract_block(smn, ctx->cis);
    }
    replace_block(ctx->cis, c0);
    pi((word_t*)ctx->cis);
    add_tag(ctx, ctx->cis);
}
Exemple #27
0
Transition* add_tag_to_token_tree(struct fst2txt_token_tree* tree,Transition* trans,
                                  struct fst2txt_parameters* p) {
// case 1: empty transition
if (trans==NULL) return NULL;
// case 2: transition by something else that a sequence of letter like %hello
//         or sub-graph call
if (trans->tag_number<0 || not_a_letter_sequence(p->fst2->tags[trans->tag_number],p->alphabet)) {
   trans->next=add_tag_to_token_tree(tree,trans->next,p);
   return trans;
}
Transition* tmp=add_tag_to_token_tree(tree,trans->next,p);
add_tag(p->fst2->tags[trans->tag_number]->input,trans->tag_number,trans->state_number,tree);
free(trans);
return tmp;
}
Exemple #28
0
void PPPoE::vendor_specific(const vendor_spec_type &value) {
    std::vector<uint8_t> buffer(sizeof(uint32_t) + value.data.size());
    *(uint32_t*)&buffer[0] = Endian::host_to_be(value.vendor_id);
    std::copy(
        value.data.begin(), 
        value.data.end(), 
        buffer.begin() + sizeof(uint32_t)
    );
    add_tag(
        tag(
            VENDOR_SPECIFIC,
            buffer.begin(),
            buffer.end()
        )
    );
}
Exemple #29
0
void PPPoE::vendor_specific(const vendor_spec_type& value) {
    vector<uint8_t> buffer(sizeof(uint32_t) + value.data.size());
    uint32_t tmp_vendor_id = Endian::host_to_be(value.vendor_id);
    memcpy(&buffer[0], &tmp_vendor_id, sizeof(uint32_t));
    copy(
        value.data.begin(),
        value.data.end(),
        buffer.begin() + sizeof(uint32_t)
    );
    add_tag(
        tag(
            VENDOR_SPECIFIC,
            buffer.begin(),
            buffer.end()
        )
    );
}
Exemple #30
0
void PI_DECRYPT_LAST_BLOCK(
        PI_CTX *ctx,
        void *dest,
        const void *src,
        size_t length_B,
        unsigned long num )
{
    state_t a;
    ctr_trans(ctx, a, num);
    inject_last_block(a, src, length_B * 8);
    if (dest) {
        uint8_t tmp[PI_PT_BLOCK_LENGTH_BYTES];
        extract_block(tmp, a);
        memcpy(dest, tmp, length_B);
    }
    replace_last_block(a, src, length_B * 8);
    pi((word_t*)a);
    add_tag(ctx, a);
}