/* XXX - might be better to fill all interfaces into our database at startup instead of searching each time */ int ResolveWin32UUID(e_guid_t if_id, char *uuid_name, int uuid_name_max_len) { TCHAR *reg_uuid_name; HKEY hKey = NULL; DWORD uuid_max_size = MAX_PATH; TCHAR *reg_uuid_str; reg_uuid_name=ep_alloc(MAX_PATH*sizeof(TCHAR)); reg_uuid_str=ep_alloc(MAX_PATH*sizeof(TCHAR)); if(uuid_name_max_len < 2){ return 0; } reg_uuid_name[0] = '\0'; _snwprintf(reg_uuid_str, MAX_PATH, _T("SOFTWARE\\Classes\\Interface\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"), if_id.data1, if_id.data2, if_id.data3, if_id.data4[0], if_id.data4[1], if_id.data4[2], if_id.data4[3], if_id.data4[4], if_id.data4[5], if_id.data4[6], if_id.data4[7]); if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_uuid_str, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { if (RegQueryValueEx(hKey, NULL, NULL, NULL, (LPBYTE)reg_uuid_name, &uuid_max_size) == ERROR_SUCCESS && uuid_max_size <= MAX_PATH) { g_snprintf(uuid_name, uuid_name_max_len, "%s", utf_16to8(reg_uuid_name)); RegCloseKey(hKey); return (int) strlen(uuid_name); } RegCloseKey(hKey); } return 0; /* we didn't find anything anyhow. Please don't use the string! */ }
int FieldInfo_get_range(lua_State* L) { /* The TvbRange covering this field */ FieldInfo fi = checkFieldInfo(L,1); TvbRange r = ep_alloc(sizeof(struct _wslua_tvbrange)); r->tvb = ep_alloc(sizeof(struct _wslua_tvb)); r->tvb->ws_tvb = fi->ds_tvb; r->offset = fi->start; r->len = fi->length; pushTvbRange(L,r); return 1; }
static gboolean verify_password(tvbuff_t *tvb, const char *password) { /* 1. pad non-terminated password-string to a length of 32 bytes * (padding: 0x01, 0x02, 0x03...) * 2. Calculate MD5 of padded password and write it to offset 12 of packet * 3. Calculate MD5 of resulting packet and write it to offset 12 of packet */ gboolean is_valid = TRUE; const guint8 *packetdata; guint32 length; guint8 *workbuffer; guint i; guint8 byte; md5_state_t md_ctx; md5_byte_t *digest; workbuffer=ep_alloc(32); digest=ep_alloc(16); length = tvb_get_ntohs(tvb, 6); packetdata = tvb_get_ptr(tvb, 0, length); for (i = 0; i<32 && *password; i++, password++) { workbuffer[i] = *password; } for (byte = 1; i<32; i++, byte++) { workbuffer[i] = byte; } md5_init(&md_ctx); md5_append(&md_ctx, workbuffer, 32); md5_finish(&md_ctx, digest); md5_init(&md_ctx); md5_append(&md_ctx, packetdata, 12); md5_append(&md_ctx, digest, 16); md5_append(&md_ctx, packetdata + 28, length - 28); md5_finish(&md_ctx, digest); fprintf(stderr, "Calculated digest: "); /* debugging */ for (i = 0; i < 16; i++) { fprintf(stderr, "%02X", digest[i]); /* debugging */ if (digest[i] != *(packetdata + 12 + i)) { is_valid = FALSE; break; } } fprintf(stderr, " (%d)\n", is_valid); /* debugging */ return is_valid; }
static tvbparse_elem_t* new_tok(tvbparse_t* tt, int id, int offset, int len, const tvbparse_wanted_t* wanted) { tvbparse_elem_t* tok; #ifdef TVBPARSE_DEBUG if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NEWTOK) g_warning("new_tok: id=%i offset=%u len=%u",id,offset,len); #endif tok = (tvbparse_elem_t *)ep_alloc(sizeof(tvbparse_elem_t)); tok->tvb = tt->tvb; tok->id = id; tok->offset = offset; tok->len = len; tok->data = NULL; tok->sub = NULL; tok->next = NULL; tok->wanted = wanted; tok->last = tok; return tok; }
static int ep_mca_attach(device_t dev) { struct ep_softc *sc = device_get_softc(dev); int error = 0; if ((error = ep_alloc(dev))) goto bad; sc->stat = F_ACCESS_32_BITS; ep_get_media(sc); GO_WINDOW(sc, 0); SET_IRQ(sc, rman_get_start(sc->irq)); if ((error = ep_attach(sc))) goto bad; if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, ep_intr, sc, &sc->ep_intrhand))) { device_printf(dev, "bus_setup_intr() failed! (%d)\n", error); goto bad; } return (0); bad: ep_free(dev); return (error); }
static const gchar * atmarpnum_to_str(const guint8 *ad, int ad_tl) { int ad_len = ad_tl & ATMARP_LEN_MASK; gchar *cur; if (ad_len == 0) return "<No address>"; if (ad_tl & ATMARP_IS_E164) { /* * I'm assuming this means it's an ASCII (IA5) string. */ cur = ep_alloc(MAX_E164_STR_LEN+3+1); if (ad_len > MAX_E164_STR_LEN) { /* Can't show it all. */ memcpy(cur, ad, MAX_E164_STR_LEN); g_snprintf(&cur[MAX_E164_STR_LEN], 3+1, "..."); } else { memcpy(cur, ad, ad_len); cur[ad_len + 1] = '\0'; } return cur; } else { /* * NSAP. * * XXX - break down into subcomponents. */ return bytes_to_str(ad, ad_len); } }
static const char * optsstr(guint8 opts) { char *msg; gint returned_length, idx = 0; const int MAX_STR_LEN = 256; if (opts == 0) return(""); msg=ep_alloc(MAX_STR_LEN); if (opts & PGM_OPT){ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "Present"); idx += MIN(returned_length, MAX_STR_LEN-idx); } if (opts & PGM_OPT_NETSIG){ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "%sNetSig", (!idx)?"":","); idx += MIN(returned_length, MAX_STR_LEN-idx); } if (opts & PGM_OPT_VAR_PKTLEN){ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "%sVarLen", (!idx)?"":","); idx += MIN(returned_length, MAX_STR_LEN-idx); } if (opts & PGM_OPT_PARITY){ returned_length = g_snprintf(&msg[idx], MAX_STR_LEN-idx, "%sParity", (!idx)?"":","); idx += MIN(returned_length, MAX_STR_LEN-idx); } if (!idx) { g_snprintf(&msg[idx], MAX_STR_LEN-idx, "0x%x", opts); } return(msg); }
static TvbRange new_TvbRange(lua_State* L, tvbuff_t* ws_tvb, int offset, int len) { TvbRange tvbr; if (!ws_tvb) { luaL_error(L,"expired tvb"); return 0; } if (len == -1) { len = tvb_length_remaining(ws_tvb,offset); if (len < 0) { luaL_error(L,"out of bounds"); return 0; } } else if ( (guint)(len + offset) > tvb_length(ws_tvb)) { luaL_error(L,"Range is out of bounds"); return NULL; } tvbr = ep_alloc(sizeof(struct _wslua_tvbrange)); tvbr->tvb = g_malloc(sizeof(struct _wslua_tvb)); tvbr->tvb->ws_tvb = ws_tvb; tvbr->tvb->expired = FALSE; tvbr->offset = offset; tvbr->len = len; return tvbr; }
/* ntp_fmt_ts - converts NTP timestamp to human readable string. * reftime - 64bit timestamp (IN) * returns pointer to filled buffer. This buffer will be freed automatically once * dissection of the next packet occurs. */ const char * ntp_fmt_ts(const guint8 *reftime) { guint32 tempstmp, tempfrac; time_t temptime; struct tm *bd; double fractime; char *buff; tempstmp = pntohl(&reftime[0]); tempfrac = pntohl(&reftime[4]); if ((tempstmp == 0) && (tempfrac == 0)) { return "NULL"; } temptime = tempstmp - (guint32) NTP_BASETIME; bd = gmtime(&temptime); if(!bd){ return "Not representable"; } fractime = bd->tm_sec + tempfrac / 4294967296.0; buff=ep_alloc(NTP_TS_SIZE); g_snprintf(buff, NTP_TS_SIZE, "%s %2d, %d %02d:%02d:%09.6f UTC", mon_names[bd->tm_mon], bd->tm_mday, bd->tm_year + 1900, bd->tm_hour, bd->tm_min, fractime); return buff; }
static void add_message_data(tvbuff_t * tvb, gint offset, gint data_len, proto_tree * tree) { gchar *data = NULL; gchar tmp; int i; if (!tree) return; data = tvb_memcpy(tvb, ep_alloc(data_len + 1), offset, data_len); data[data_len] = '\0'; for (i = 0; i < data_len; i += 2) { /* * There must be a better way to tell * Wireshark not to stop on null bytes * as the length is known */ if (!data[i]) data[i] = ' '; if (!data[i+1]) data[i+1] = ' '; /* Armagetronad swaps unconditionally */ tmp = data[i]; data[i] = data[i+1]; data[i+1] = tmp; } proto_tree_add_string(tree, hf_armagetronad_data, tvb, offset, data_len, (gchar *) data); }
/* tvb_ntp_fmt_ts - converts NTP timestamp to human readable string. * TVB and an offset (IN). * returns pointer to filled buffer. This buffer will be freed automatically once * dissection of the next packet occurs. */ const char * tvb_ntp_fmt_ts(tvbuff_t *tvb, gint offset) { guint32 tempstmp, tempfrac; time_t temptime; struct tm *bd; double fractime; char *buff; tempstmp = tvb_get_ntohl(tvb, offset); tempfrac = tvb_get_ntohl(tvb, offset+4); if ((tempstmp == 0) && (tempfrac == 0)) { return "NULL"; } temptime = tempstmp - (guint32) NTP_BASETIME; bd = gmtime(&temptime); if(!bd){ return "Not representable"; } fractime = bd->tm_sec + tempfrac / NTP_FLOAT_DENOM; buff=ep_alloc(NTP_TS_SIZE); g_snprintf(buff, NTP_TS_SIZE, "%s %2d, %d %02d:%02d:%09.6f UTC", mon_names[bd->tm_mon], bd->tm_mday, bd->tm_year + 1900, bd->tm_hour, bd->tm_min, fractime); return buff; }
static void expert_set_info_vformat(packet_info *pinfo, proto_item *pi, int group, int severity, const char *format, va_list ap) { char formatted[ITEM_LABEL_LENGTH]; int tap; expert_info_t *ei; proto_tree *tree; proto_item *ti; /* if this packet isn't loaded because of a read filter, don't output anything */ if (pinfo == NULL || PINFO_FD_NUM(pinfo) == 0) { return; } if (severity > highest_severity) { highest_severity = severity; } if (pi != NULL && PITEM_FINFO(pi) != NULL) { expert_set_item_flags(pi, group, severity); } col_add_str(pinfo->cinfo, COL_EXPERT, val_to_str(severity, expert_severity_vals, "Unknown (%u)")); g_vsnprintf(formatted, ITEM_LABEL_LENGTH, format, ap); tree = expert_create_tree(pi, group, severity, formatted); ti = proto_tree_add_string(tree, hf_expert_msg, NULL, 0, 0, formatted); PROTO_ITEM_SET_GENERATED(ti); ti = proto_tree_add_uint_format_value(tree, hf_expert_severity, NULL, 0, 0, severity, "%s", val_to_str_const(severity, expert_severity_vals, "Unknown")); PROTO_ITEM_SET_GENERATED(ti); ti = proto_tree_add_uint_format_value(tree, hf_expert_group, NULL, 0, 0, group, "%s", val_to_str_const(group, expert_group_vals, "Unknown")); PROTO_ITEM_SET_GENERATED(ti); tap = have_tap_listener(expert_tap); if (!tap) return; ei = ep_alloc(sizeof(expert_info_t)); ei->packet_num = PINFO_FD_NUM(pinfo); ei->group = group; ei->severity = severity; ei->protocol = pinfo->current_proto; ei->summary = ep_strdup(formatted); /* if we have a proto_item (not a faked item), set expert attributes to it */ if (pi != NULL && PITEM_FINFO(pi) != NULL) { ei->pitem = pi; } else { ei->pitem = NULL; } tap_queue_packet(expert_tap, pinfo, ei); }
static guint8 *unhexbytes(const char *si, guint len, guint *len_p, const char** err) { guint8 *buf; guint8 *p; const guint8 *s = (const guint8 *)si; guint i; if (len % 2) { *err = ep_strdup_printf("Uneven number of chars hex string %u \n'%s'", len, si); return NULL; } buf = (guint8 *)ep_alloc(len/2+1); p = buf; for (i = 0; i<len ; i += 2) { guint8 lo = s[i+1]; guint8 hi = s[i]; if (hi >= '0' && hi <= '9') { hi -= '0'; } else if (hi >= 'a' && hi <= 'f') { hi -= 'a'; hi += 0xa; } else if (hi >= 'A' && hi <= 'F') { hi -= 'A'; hi += 0xa; } else { goto on_error; } if (lo >= '0' && lo <= '9') { lo -= '0'; } else if (lo >= 'a' && lo <= 'f') { lo -= 'a'; lo += 0xa; } else if (lo >= 'A' && lo <= 'F') { lo -= 'A'; lo += 0xa; } else { goto on_error; } *(p++) = (hi*0x10) + lo; } len /= 2; if (len_p) *len_p = len; buf[len] = '\0'; *err = NULL; return buf; on_error: *err = "Error parsing hex string"; return NULL; }
gchar * atalk_addr_to_str(const struct atalk_ddp_addr *addrp) { gchar *cur; cur=ep_alloc(14); atalk_addr_to_str_buf(addrp, cur, 14); return cur; }
/* * XXX - shouldn't there be a centralized routine for dissecting NSAPs? * See also "dissect_atm_nsap()" in epan/dissectors/packet-arp.c and * "dissect_nsap()" in epan/dissectors/packet-isup.c. */ gchar * print_nsap_net( const guint8 *ad, int length ) { gchar *cur; cur = ep_alloc(MAX_NSAP_LEN * 3 + 50); print_nsap_net_buf( ad, length, cur, MAX_NSAP_LEN * 3 + 50); return( cur ); }
gchar * mtp3_pc_to_str(const guint32 pc) { gchar *str; str=ep_alloc(MAX_STRUCTURED_PC_LENGTH); mtp3_pc_to_str_buf(pc, str, MAX_STRUCTURED_PC_LENGTH); return str; }
gchar * print_area(const guint8 *ad, int length) { gchar *cur; cur = ep_alloc(MAX_AREA_LEN * 3 + 20); print_area_buf(ad, length, cur, MAX_AREA_LEN * 3 + 20); return cur; }
gchar * sna_fid_to_str(const address *addr) { gchar *cur; cur=(gchar *)ep_alloc(14); sna_fid_to_str_buf(addr, cur, 14); return cur; }
gchar * print_system_id( const guint8 *ad, int length ) { gchar *cur; cur = ep_alloc(MAX_SYSTEMID_LEN * 3 + 5); print_system_id_buf(ad, length, cur, MAX_SYSTEMID_LEN * 3 + 5); return( cur ); }
int PIDL_dissect_uint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hfindex, guint32 param) { dcerpc_info *di; guint32 val; di=pinfo->private_data; if(di->conformant_run){ /* just a run to handle conformant arrays, no scalars to dissect */ return offset; } if (offset % 4) { offset += 4 - (offset % 4); } offset=dissect_dcerpc_uint32 (tvb, offset, pinfo, tree, drep, hfindex, &val); if(param&PIDL_SET_COL_INFO){ header_field_info *hf_info; char *valstr; hf_info=proto_registrar_get_nth(hfindex); valstr=ep_alloc(64); valstr[0]=0; switch(hf_info->display){ case BASE_DEC: if(hf_info->strings){ g_snprintf(valstr, 64, "%s(%d)",val_to_str(val, hf_info->strings, "Unknown:%u"), val); } else { g_snprintf(valstr, 64, "%d", val); } break; case BASE_HEX: if(hf_info->strings){ g_snprintf(valstr, 64, "%s(0x%08x)",val_to_str(val, hf_info->strings, "Unknown:%u"), val); } else { g_snprintf(valstr, 64, "0x%08x", val); } break; default: REPORT_DISSECTOR_BUG("Invalid hf->display value"); } if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO," %s:%s", hf_info->name, valstr); } } return offset; }
/* Turn a little-endian Unicode '\0'-terminated string into a string we can display. XXX - for now, we just handle the ISO 8859-1 characters. If exactlen==TRUE then us_lenp contains the exact len of the string in bytes. It might not be null terminated ! bc specifies the number of bytes in the byte parameters; Windows 2000, at least, appears, in some cases, to put only 1 byte of 0 at the end of a Unicode string if the byte count */ static gchar * unicode_to_str(tvbuff_t *tvb, int offset, int *us_lenp, gboolean exactlen, guint16 bc) { gchar *cur; gchar *p; guint16 uchar; int len; int us_len; gboolean overflow = FALSE; cur=ep_alloc(MAX_UNICODE_STR_LEN+3+1); p = cur; len = MAX_UNICODE_STR_LEN; us_len = 0; for (;;) { if (bc == 0) break; if (bc == 1) { /* XXX - explain this */ if (!exactlen) us_len += 1; /* this is a one-byte null terminator */ break; } uchar = tvb_get_letohs(tvb, offset); if (uchar == 0) { us_len += 2; /* this is a two-byte null terminator */ break; } if (len > 0) { if ((uchar & 0xFF00) == 0) *p++ = (gchar) uchar; /* ISO 8859-1 */ else *p++ = '?'; /* not 8859-1 */ len--; } else overflow = TRUE; offset += 2; bc -= 2; us_len += 2; if(exactlen){ if(us_len>= *us_lenp){ break; } } } if (overflow) { /* Note that we're not showing the full string. */ *p++ = '.'; *p++ = '.'; *p++ = '.'; } *p = '\0'; *us_lenp = us_len; return cur; }
static gchar * atalkid_to_str(const guint8 *ad) { gint node; gchar *cur; cur=ep_alloc(16); node=ad[1]<<8|ad[2]; g_snprintf(cur, 16, "%d.%d",node,ad[3]); return cur; }
static gchar * prism_rate_return(guint32 rate) { gchar *result=NULL; result = (gchar *)ep_alloc(SHORT_STR); result[0] = '\0'; prism_rate_base_custom(result, rate); return result; }
static gchar * tvb_atalkid_to_str(tvbuff_t *tvb, gint offset) { gint node; gchar *cur; cur=ep_alloc(16); node=tvb_get_guint8(tvb, offset)<<8|tvb_get_guint8(tvb, offset+1); g_snprintf(cur, 16, "%d.%d",node,tvb_get_guint8(tvb, offset+2)); return cur; }
void uat_swap(uat_t* uat, guint a, guint b) { size_t s = uat->record_size; void* tmp = ep_alloc(s); g_assert( a < uat->user_data->len && b < uat->user_data->len ); if (a == b) return; memcpy(tmp, UAT_INDEX_PTR(uat,a), s); memcpy(UAT_INDEX_PTR(uat,a), UAT_INDEX_PTR(uat,b), s); memcpy(UAT_INDEX_PTR(uat,b), tmp, s); }
/* retrieve the registered name for this GUID */ const gchar * guids_get_guid_name(e_guid_t *guid) { emem_tree_key_t guidkey[2]; guint32 g[4]; char *name; #ifdef _WIN32 static char *uuid_name; #endif g[0]=guid->data1; g[1]=guid->data2; g[1]<<=16; g[1]|=guid->data3; g[2]=guid->data4[0]; g[2]<<=8; g[2]|=guid->data4[1]; g[2]<<=8; g[2]|=guid->data4[2]; g[2]<<=8; g[2]|=guid->data4[3]; g[3]=guid->data4[4]; g[3]<<=8; g[3]|=guid->data4[5]; g[3]<<=8; g[3]|=guid->data4[6]; g[3]<<=8; g[3]|=guid->data4[7]; guidkey[0].key=g; guidkey[0].length=4; guidkey[1].length=0; if((name = pe_tree_lookup32_array(guid_to_name_tree, &guidkey[0]))){ return name; } #ifdef _WIN32 /* try to resolve the mapping from the Windows registry */ /* XXX - prefill the resolving database with all the Windows registry entries once at init only (instead of searching each time)? */ uuid_name=ep_alloc(128); if(ResolveWin32UUID(*guid, uuid_name, 128)) { return uuid_name; } #endif return NULL; }
static void dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { tvbparse_t* tt; tvbparse_elem_t* tok = NULL; static GPtrArray* stack = NULL; xml_frame_t* current_frame; char* colinfo_str; if (stack != NULL) g_ptr_array_free(stack,TRUE); stack = g_ptr_array_new(); current_frame = ep_alloc(sizeof(xml_frame_t)); current_frame->type = XML_FRAME_ROOT; current_frame->name = NULL; current_frame->name_orig_case = NULL; current_frame->value = NULL; insert_xml_frame(NULL, current_frame); g_ptr_array_add(stack,current_frame); tt = tvbparse_init(tvb,0,-1,stack,want_ignore); current_frame->start_offset = 0; root_ns = NULL; if (pinfo->match_string) root_ns = g_hash_table_lookup(media_types,pinfo->match_string); if (! root_ns ) { root_ns = &xml_ns; colinfo_str = "/XML"; } else { colinfo_str = ep_strdup_printf("/%s",root_ns->name); ascii_strup_inplace(colinfo_str); } if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_append_str(pinfo->cinfo, COL_PROTOCOL, colinfo_str); current_frame->ns = root_ns; current_frame->item = proto_tree_add_item(tree,current_frame->ns->hf_tag,tvb,0,-1,FALSE); current_frame->tree = proto_item_add_subtree(current_frame->item,current_frame->ns->ett); current_frame->last_item = current_frame->item; while(( tok = tvbparse_get(tt, want) )) ; pinfo->private_data = current_frame; /* pass XML structure to the dissector calling XML */ }
int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data) { char *str, *p; int len; int charoffset; guint16 character; /* display a unicode string from the tree and return new offset */ /* * Get the length of the string. * XXX - is it a bug or a feature that this will throw an exception * if we don't find the '\0'? I think it's a feature. */ len = 0; while (tvb_get_letohs(tvb, offset + len) != '\0') len += 2; len += 2; /* count the '\0' too */ /* * Allocate a buffer for the string; "len" is the length in * bytes, not the length in characters. */ str = ep_alloc(len/2); /* * XXX - this assumes the string is just ISO 8859-1; we need * to better handle multiple character sets in Wireshark, * including Unicode/ISO 10646, and multiple encodings of * that character set (UCS-2, UTF-8, etc.). */ charoffset = offset; p = str; while ((character = tvb_get_letohs(tvb, charoffset)) != '\0') { *p++ = (char) character; charoffset += 2; } *p = '\0'; proto_tree_add_string(tree, hf_index, tvb, offset, len, str); if (data) *data = str; return offset+len; }
/* * Initialize the device - called from Slot manager. */ static int ep_pccard_probe(device_t dev) { struct ep_softc * sc = device_get_softc(dev); struct ep_board * epb = &sc->epb; const char * desc; int error; error = ep_alloc(dev); if (error) return error; /* * XXX - Certain (newer?) 3Com cards need epb->cmd_off == * 2. Sadly, you need to have a correct cmd_off in order to * identify the card. So we have to hit it with both and * cross our virtual fingers. There's got to be a better way * to do this. [email protected] 09/11/1999 */ epb->cmd_off = 0; epb->prod_id = get_e(sc, EEPROM_PROD_ID); if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) { if (bootverbose) device_printf(dev, "Pass 1 of 2 detection " "failed (nonfatal)\n"); epb->cmd_off = 2; epb->prod_id = get_e(sc, EEPROM_PROD_ID); if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) { device_printf(dev, "Unit failed to come ready or " "product ID unknown! (id 0x%x)\n", epb->prod_id); ep_free(dev); return (ENXIO); } } device_set_desc(dev, desc); /* * For some reason the 3c574 needs this. */ ep_get_macaddr(sc, (u_char *)&sc->arpcom.ac_enaddr); ep_free(dev); return (0); }
int dissect_ms_compressed_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, gboolean prepend_dot, char **data) { int old_offset=offset; char *str; int len; len = MAX_UNICODE_STR_LEN+3+1; str=ep_alloc(len); offset=dissect_ms_compressed_string_internal(tvb, offset, str, len, prepend_dot); proto_tree_add_string(tree, hf_index, tvb, old_offset, offset-old_offset, str); if (data) *data = str; return offset; }