Beispiel #1
0
void aggregator_feed_form( map <string, map <string, string> > &form, map <string, string> item )
{	
  int refresh[] = {900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200, -1};
	int livetime[] = {86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 14515200, 29030400, -1};
	int i = 0;
	vector <pair <string, string> > refresh_options;
	vector <pair <string, string> > livetime_options;

	while( refresh[i] > 0 ) {
		refresh_options.push_back( make_pair( str(refresh[i]), format_interval(refresh[i]) ) );
		i++;
	}

	i = 0;
	livetime_options.push_back( make_pair( "0", "Forever" ) );
	while( livetime[i] > 0 ) {
		livetime_options.push_back( make_pair( str(livetime[i]), format_interval(livetime[i]) ) );
		i++;
	}
  
	form["title"]["#type"] = "textfield";
	form["title"]["#title"] = "Title";
	form["title"]["#value"] = item["title"];
	form["title"]["#maxlength"] = "255";
	form["title"]["#description"] = "The name of the feed (or the name of the website providing the feed).";
	form["title"]["#required"] = _TRUE;
	form["title"]["#weight"] = "1";

	form["url"]["#type"] = "textfield";
	form["url"]["#title"] = "URL";
	form["url"]["#value"] = item["url"];
	form["url"]["#maxlength"] = "255";
	form["url"]["#description"] = "The fully-qualified URL of the feed.";
	form["url"]["#required"] = _TRUE;
	form["url"]["#weight"] = "2";

	form["refresh"]["#type"] = "select";
	form["refresh"]["#title"] = "Update interval";
	form["refresh"]["#value"] = item["refresh"];
	form["refresh"]["#options"] = serialize_array( refresh_options );
	form["refresh"]["#description"] = "The length of time between feed updates. (Requires a correctly configured Cron)";
	form["refresh"]["#weight"] = "3";

  form["livetime"]["#type"] = "select";
	form["livetime"]["#title"] = "Live Time";
	form["livetime"]["#value"] = item["livetime"];
	form["livetime"]["#options"] = serialize_array( livetime_options );
	form["livetime"]["#description"] = "The livetime of the feed.";
	form["livetime"]["#weight"] = "4";

	form["submit"]["#type"] = "submit";
	form["submit"]["#value"] = "Save";
	form["submit"]["#weight"] = "5";
}
Beispiel #2
0
QDebug operator<<(QDebug debug, const QcViewportPart & viewport_part)
{
    QDebugStateSaver saver(debug);

    debug.nospace().noquote() << "QcViewportPart(";
    if (viewport_part) {
      const QcProjection * projection = viewport_part.viewport()->projection_ptr();
      debug << viewport_part.position()
            << ", " << viewport_part.screen_interval()
            << ", " << format_interval(viewport_part.interval(), projection);
    }
    debug << ')';

    return debug;
}
Beispiel #3
0
void template_preprocess_aggregator_feed_source(map <string, string> &variables) 
{
	map <string, string> feed = variables;
	  
	variables["source_icon"] = theme("feed_icon", feed);
	variables["source_image"] = feed["image"];
	variables["source_description"] = aggregator_filter_xss(feed["description"]);
	
	map <string, string> url_options;
	url_options["absolute"] = _TRUE;
	variables["source_url"] = check_url(url( feed["link"], &url_options ));

	if ( isset(feed["checked"]) ) {
		variables["last_checked"] = format_interval( time() - intval(feed["checked"]) ) + " ago";
	}
	else {
		variables["last_checked"] = "never";
	}

	if ( user_access("administer news feeds") ) {
		variables["last_checked"] = "<a href=\""+ url("admin/content/aggregator") +"\">"+ variables["last_checked"] + "</a>";
	}
}
Beispiel #4
0
void template_preprocess_aggregator_item( map <string, string> &variables ) 
{
	map <string, string> item = variables;

	variables["feed_url"] = check_url( item["link"] );
	variables["feed_title"] = check_plain( item["title"] );
	variables["content"] = aggregator_filter_xss( item["description"] );

	variables["source_url"] = "";
	variables["source_title"] = "";
	if ( isset(item["ftitle"]) && isset(item["fid"]) ) 
	{
		variables["source_url"] = url("aggregator/sources/"+item["fid"]);
		variables["source_title"] = check_plain(item["ftitle"]);
	}
	if ( date("Ymd", item["timestamp"]) == date("Ymd") ) 
	{
		variables["source_date"] = format_interval(time() - intval(item["timestamp"]) ) + " ago";
	}
	else 
	{
		variables["source_date"] = format_date( item["timestamp"] );
	}
}
static void
babel_print_v2(const u_char *cp, u_int length) {
    u_int i;
    u_short bodylen;
    u_char v4_prefix[16] =
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 0 };
    u_char v6_prefix[16] = {0};

    TCHECK2(*cp, 4);
    if (length < 4)
        goto corrupt;
    bodylen = EXTRACT_16BITS(cp + 2);
    printf(" (%u)", bodylen);

    /* Process the TLVs in the body */
    i = 0;
    while(i < bodylen) {
        const u_char *message;
        u_int type, len;

        message = cp + 4 + i;

        TCHECK2(*message, 1);
        if((type = message[0]) == MESSAGE_PAD1) {
            printf(vflag ? "\n\tPad 1" : " pad1");
            i += 1;
            continue;
        }

        TCHECK2(*message, 2);
        ICHECK(i, 2);
        len = message[1];

        TCHECK2(*message, 2 + len);
        ICHECK(i, 2 + len);

        switch(type) {
        case MESSAGE_PADN: {
            if(!vflag)
                printf(" padN");
            else
                printf("\n\tPad %d", len + 2);
        }
            break;

        case MESSAGE_ACK_REQ: {
            u_short nonce, interval;
            if(!vflag)
                printf(" ack-req");
            else {
                printf("\n\tAcknowledgment Request ");
                if(len < 6) goto corrupt;
                nonce = EXTRACT_16BITS(message + 4);
                interval = EXTRACT_16BITS(message + 6);
                printf("%04x %s", nonce, format_interval(interval));
            }
        }
            break;

        case MESSAGE_ACK: {
            u_short nonce;
            if(!vflag)
                printf(" ack");
            else {
                printf("\n\tAcknowledgment ");
                if(len < 2) goto corrupt;
                nonce = EXTRACT_16BITS(message + 2);
                printf("%04x", nonce);
            }
        }
            break;

        case MESSAGE_HELLO:  {
            u_short seqno, interval;
            if(!vflag)
                printf(" hello");
            else {
                printf("\n\tHello ");
                if(len < 6) goto corrupt;
                seqno = EXTRACT_16BITS(message + 4);
                interval = EXTRACT_16BITS(message + 6);
                printf("seqno %u interval %s", seqno, format_interval(interval));
            }
        }
            break;

        case MESSAGE_IHU: {
            unsigned short txcost, interval;
            if(!vflag)
                printf(" ihu");
            else {
                u_char address[16];
                int rc;
                printf("\n\tIHU ");
                if(len < 6) goto corrupt;
                txcost = EXTRACT_16BITS(message + 4);
                interval = EXTRACT_16BITS(message + 6);
                rc = network_address(message[2], message + 8, len - 6, address);
                if(rc < 0) { printf("[|babel]"); break; }
                printf("%s txcost %u interval %s",
                       format_address(address), txcost, format_interval(interval));
            }
        }
            break;

        case MESSAGE_ROUTER_ID: {
            if(!vflag)
                printf(" router-id");
            else {
                printf("\n\tRouter Id");
                if(len < 10) goto corrupt;
                printf(" %s", format_id(message + 4));
            }
        }
            break;

        case MESSAGE_NH: {
            if(!vflag)
                printf(" nh");
            else {
                int rc;
                u_char nh[16];
                printf("\n\tNext Hop");
                if(len < 2) goto corrupt;
                rc = network_address(message[2], message + 4, len - 2, nh);
                if(rc < 0) goto corrupt;
                printf(" %s", format_address(nh));
            }
        }
            break;

        case MESSAGE_UPDATE: {
            if(!vflag) {
                printf(" update");
                if(len < 1)
                    printf("/truncated");
                else
                    printf("%s%s%s",
                           (message[3] & 0x80) ? "/prefix": "",
                           (message[3] & 0x40) ? "/id" : "",
                           (message[3] & 0x3f) ? "/unknown" : "");
            } else {
                u_short interval, seqno, metric;
                u_char plen;
                int rc;
                u_char prefix[16];
                printf("\n\tUpdate");
                if(len < 10) goto corrupt;
                plen = message[4] + (message[2] == 1 ? 96 : 0);
                rc = network_prefix(message[2], message[4], message[5],
                                    message + 12,
                                    message[2] == 1 ? v4_prefix : v6_prefix,
                                    len - 10, prefix);
                if(rc < 0) goto corrupt;
                interval = EXTRACT_16BITS(message + 6);
                seqno = EXTRACT_16BITS(message + 8);
                metric = EXTRACT_16BITS(message + 10);
                printf("%s%s%s %s metric %u seqno %u interval %s",
                       (message[3] & 0x80) ? "/prefix": "",
                       (message[3] & 0x40) ? "/id" : "",
                       (message[3] & 0x3f) ? "/unknown" : "",
                       format_prefix(prefix, plen),
                       metric, seqno, format_interval_update(interval));
                if(message[3] & 0x80) {
                    if(message[2] == 1)
                        memcpy(v4_prefix, prefix, 16);
                    else
                        memcpy(v6_prefix, prefix, 16);
                }
                /* extra data? */
                if((u_int)rc < len - 10)
                    subtlvs_print(message + 12 + rc, message + 2 + len, type);
            }
        }
            break;

        case MESSAGE_REQUEST: {
            if(!vflag)
                printf(" request");
            else {
                int rc;
                u_char prefix[16], plen;
                printf("\n\tRequest ");
                if(len < 2) goto corrupt;
                plen = message[3] + (message[2] == 1 ? 96 : 0);
                rc = network_prefix(message[2], message[3], 0,
                                    message + 4, NULL, len - 2, prefix);
                if(rc < 0) goto corrupt;
                plen = message[3] + (message[2] == 1 ? 96 : 0);
                printf("for %s",
                       message[2] == 0 ? "any" : format_prefix(prefix, plen));
            }
        }
            break;

        case MESSAGE_MH_REQUEST : {
            if(!vflag)
                printf(" mh-request");
            else {
                int rc;
                u_short seqno;
                u_char prefix[16], plen;
                printf("\n\tMH-Request ");
                if(len < 14) goto corrupt;
                seqno = EXTRACT_16BITS(message + 4);
                rc = network_prefix(message[2], message[3], 0,
                                    message + 16, NULL, len - 14, prefix);
                if(rc < 0) goto corrupt;
                plen = message[3] + (message[2] == 1 ? 96 : 0);
                printf("(%u hops) for %s seqno %u id %s",
                       message[6], format_prefix(prefix, plen),
                       seqno, format_id(message + 8));
            }
        }
            break;
        case MESSAGE_TSPC :
            if(!vflag)
                printf(" tspc");
            else {
                printf("\n\tTS/PC ");
                if(len < 6) goto corrupt;
                printf("timestamp %u packetcounter %u", EXTRACT_32BITS (message + 4),
                       EXTRACT_16BITS(message + 2));
            }
            break;
        case MESSAGE_HMAC : {
            if(!vflag)
                printf(" hmac");
            else {
                unsigned j;
                printf("\n\tHMAC ");
                if(len < 18) goto corrupt;
                printf("key-id %u digest-%u ", EXTRACT_16BITS(message + 2), len - 2);
                for (j = 0; j < len - 2; j++)
                    printf ("%02X", message[4 + j]);
            }
        }
            break;
        default:
            if(!vflag)
                printf(" unknown");
            else
                printf("\n\tUnknown message type %d", type);
        }
        i += len + 2;
    }
    return;

 trunc:
    printf(" [|babel]");
    return;

 corrupt:
    printf(" (corrupt)");
    return;
}
static const char *
format_interval_update(const u_int16_t i)
{
    return i == 0xFFFF ? "infinity" : format_interval(i);
}
Beispiel #7
0
string aggregator_admin_overview()
{
	map <string, map <string, string> > form;
	vector < map <string, string> > feeds;
	map <string, string> feed;	

	set_page_title( "Feed aggregator" );
	
	form["feeds"]["#type"] = "table";
	form["feeds"]["#header"] = "Title,Items,Last update,Next update,Operations, , ";
	form["feeds"]["#weight"] = "1";
	form["feeds"]["#prefix"] = "<h3>Feed overview</h3>";

	if(DB_TYPE==1)
	{
		REDIS_RES *result = redis_query_fields("SORT aggregator_feed BY aggregator_feed:*->title ALPHA", "GET aggregator_feed:*->", "#fid,title,url,refresh,checked,link,description,etag,modified,image,block");
		while( redis_fetch_fields( result, feed ) ) {
			feed["items"] = redis_str("SCARD aggregator_item:fid:%d", intval(feed["fid"]) );
			feeds.push_back( feed );
		}
	}
	if(DB_TYPE==2)
	{
		MYSQL_RES * result = db_querya("SELECT f.*, COUNT(i.iid) AS items FROM aggregator_feed f LEFT JOIN aggregator_item i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.etag, f.modified, f.image, f.block ORDER BY f.title");
		while ( db_fetch( result, feed ) ) {	
			feeds.push_back( feed );
		}
	}

	for(size_t n=0; n< feeds.size(); n++)
	{
		form["tit_"+str(n)]["#type"] = "markup";
		form["tit_"+str(n)]["#value"] = "<a href=\""+url("aggregator/sources/"+feeds[n]["fid"])+"\">"+feeds[n]["title"]+"</a>";
		form["tit_"+str(n)]["#table"] = "feeds";

		form["ite_"+str(n)]["#type"] = "markup";
		form["ite_"+str(n)]["#value"] = format_plural( intval(feeds[n]["items"]), "%i item", "%i items" );
		form["ite_"+str(n)]["#table"] = "feeds";

		form["ago_"+str(n)]["#type"] = "markup";
		form["ago_"+str(n)]["#value"] = intval( feeds[n]["checked"] ) ? format_interval(time() - intval(feeds[n]["checked"]) )+" ago" : "never";
		form["ago_"+str(n)]["#table"] = "feeds";

		form["lef_"+str(n)]["#type"] = "markup";
		form["lef_"+str(n)]["#value"] = intval( feeds[n]["checked"] ) ? format_interval( intval(feeds[n]["checked"]) + intval(feeds[n]["refresh"]) - time()) + " left" : "never";
		form["lef_"+str(n)]["#table"] = "feeds";

		form["edi_"+str(n)]["#type"] = "markup";
		form["edi_"+str(n)]["#value"] = "<a href=\""+url("admin/aggregator/edit/feed/"+feeds[n]["fid"])+"\">edit</a>";
		form["edi_"+str(n)]["#table"] = "feeds";

		form["rem_"+str(n)]["#type"] = "markup";
		form["rem_"+str(n)]["#value"] = "<a href=\""+url("admin/aggregator/remove/feed/"+feeds[n]["fid"])+"\">remove items</a>";
		form["rem_"+str(n)]["#table"] = "feeds";

		form["upd_"+str(n)]["#type"] = "markup";
		form["upd_"+str(n)]["#value"] = "<a href=\""+url("admin/aggregator/update/feed/"+feeds[n]["fid"])+"\">update items</a>";
		form["upd_"+str(n)]["#table"] = "feeds";
		
		form["feeds"]["#row"+str(n)] = "tit_"+str(n)+",ite_"+str(n)+",ago_"+str(n)+",lef_"+str(n)+",edi_"+str(n)+",rem_"+str(n)+",upd_"+str(n);
	}

	return get_form("aggregator_admin_overview", form);
}
Beispiel #8
0
static void
babel_print_v2(netdissect_options *ndo,
               const u_char *cp, u_int length)
{
    u_int i;
    u_short bodylen;
    u_char v4_prefix[16] =
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 0 };
    u_char v6_prefix[16] = {0};

    ND_TCHECK2(*cp, 4);
    if (length < 4)
        goto corrupt;
    bodylen = EXTRACT_16BITS(cp + 2);
    ND_PRINT((ndo, " (%u)", bodylen));

    /* Process the TLVs in the body */
    i = 0;
    while(i < bodylen) {
        const u_char *message;
        u_int type, len;

        message = cp + 4 + i;

        ND_TCHECK2(*message, 1);
        if((type = message[0]) == MESSAGE_PAD1) {
            ND_PRINT((ndo, ndo->ndo_vflag ? "\n\tPad 1" : " pad1"));
            i += 1;
            continue;
        }

        ND_TCHECK2(*message, 2);
        ICHECK(i, 2);
        len = message[1];

        ND_TCHECK2(*message, 2 + len);
        ICHECK(i, 2 + len);

        switch(type) {
        case MESSAGE_PADN: {
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " padN"));
            else
                ND_PRINT((ndo, "\n\tPad %d", len + 2));
        }
            break;

        case MESSAGE_ACK_REQ: {
            u_short nonce, interval;
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " ack-req"));
            else {
                ND_PRINT((ndo, "\n\tAcknowledgment Request "));
                if(len < 6) goto corrupt;
                nonce = EXTRACT_16BITS(message + 4);
                interval = EXTRACT_16BITS(message + 6);
                ND_PRINT((ndo, "%04x %s", nonce, format_interval(interval)));
            }
        }
            break;

        case MESSAGE_ACK: {
            u_short nonce;
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " ack"));
            else {
                ND_PRINT((ndo, "\n\tAcknowledgment "));
                if(len < 2) goto corrupt;
                nonce = EXTRACT_16BITS(message + 2);
                ND_PRINT((ndo, "%04x", nonce));
            }
        }
            break;

        case MESSAGE_HELLO:  {
            u_short seqno, interval;
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " hello"));
            else {
                ND_PRINT((ndo, "\n\tHello "));
                if(len < 6) goto corrupt;
                seqno = EXTRACT_16BITS(message + 4);
                interval = EXTRACT_16BITS(message + 6);
                ND_PRINT((ndo, "seqno %u interval %s", seqno, format_interval(interval)));
                /* Extra data. */
                if(len > 6)
                    subtlvs_print(ndo, message + 8, message + 2 + len, type);
            }
        }
            break;

        case MESSAGE_IHU: {
            unsigned short txcost, interval;
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " ihu"));
            else {
                u_char address[16];
                int rc;
                ND_PRINT((ndo, "\n\tIHU "));
                if(len < 6) goto corrupt;
                txcost = EXTRACT_16BITS(message + 4);
                interval = EXTRACT_16BITS(message + 6);
                rc = network_address(message[2], message + 8, len - 6, address);
                if(rc < 0) { ND_PRINT((ndo, "%s", tstr)); break; }
                ND_PRINT((ndo, "%s txcost %u interval %s",
                       format_address(ndo, address), txcost, format_interval(interval)));
                /* Extra data. */
                if((u_int)rc < len - 6)
                    subtlvs_print(ndo, message + 8 + rc, message + 2 + len,
                                  type);
            }
        }
            break;

        case MESSAGE_ROUTER_ID: {
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " router-id"));
            else {
                ND_PRINT((ndo, "\n\tRouter Id"));
                if(len < 10) goto corrupt;
                ND_PRINT((ndo, " %s", format_id(message + 4)));
            }
        }
            break;

        case MESSAGE_NH: {
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " nh"));
            else {
                int rc;
                u_char nh[16];
                ND_PRINT((ndo, "\n\tNext Hop"));
                if(len < 2) goto corrupt;
                rc = network_address(message[2], message + 4, len - 2, nh);
                if(rc < 0) goto corrupt;
                ND_PRINT((ndo, " %s", format_address(ndo, nh)));
            }
        }
            break;

        case MESSAGE_UPDATE: {
            if (!ndo->ndo_vflag) {
                ND_PRINT((ndo, " update"));
                if(len < 1)
                    ND_PRINT((ndo, "/truncated"));
                else
                    ND_PRINT((ndo, "%s%s%s",
                           (message[3] & 0x80) ? "/prefix": "",
                           (message[3] & 0x40) ? "/id" : "",
                           (message[3] & 0x3f) ? "/unknown" : ""));
            } else {
                u_short interval, seqno, metric;
                u_char plen;
                int rc;
                u_char prefix[16];
                ND_PRINT((ndo, "\n\tUpdate"));
                if(len < 10) goto corrupt;
                plen = message[4] + (message[2] == 1 ? 96 : 0);
                rc = network_prefix(message[2], message[4], message[5],
                                    message + 12,
                                    message[2] == 1 ? v4_prefix : v6_prefix,
                                    len - 10, prefix);
                if(rc < 0) goto corrupt;
                interval = EXTRACT_16BITS(message + 6);
                seqno = EXTRACT_16BITS(message + 8);
                metric = EXTRACT_16BITS(message + 10);
                ND_PRINT((ndo, "%s%s%s %s metric %u seqno %u interval %s",
                       (message[3] & 0x80) ? "/prefix": "",
                       (message[3] & 0x40) ? "/id" : "",
                       (message[3] & 0x3f) ? "/unknown" : "",
                       format_prefix(ndo, prefix, plen),
                       metric, seqno, format_interval_update(interval)));
                if(message[3] & 0x80) {
                    if(message[2] == 1)
                        memcpy(v4_prefix, prefix, 16);
                    else
                        memcpy(v6_prefix, prefix, 16);
                }
                /* extra data? */
                if((u_int)rc < len - 10)
                    subtlvs_print(ndo, message + 12 + rc, message + 2 + len, type);
            }
        }
            break;

        case MESSAGE_REQUEST: {
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " request"));
            else {
                int rc;
                u_char prefix[16], plen;
                ND_PRINT((ndo, "\n\tRequest "));
                if(len < 2) goto corrupt;
                plen = message[3] + (message[2] == 1 ? 96 : 0);
                rc = network_prefix(message[2], message[3], 0,
                                    message + 4, NULL, len - 2, prefix);
                if(rc < 0) goto corrupt;
                ND_PRINT((ndo, "for %s",
                       message[2] == 0 ? "any" : format_prefix(ndo, prefix, plen)));
            }
        }
            break;

        case MESSAGE_MH_REQUEST : {
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " mh-request"));
            else {
                int rc;
                u_short seqno;
                u_char prefix[16], plen;
                ND_PRINT((ndo, "\n\tMH-Request "));
                if(len < 14) goto corrupt;
                seqno = EXTRACT_16BITS(message + 4);
                rc = network_prefix(message[2], message[3], 0,
                                    message + 16, NULL, len - 14, prefix);
                if(rc < 0) goto corrupt;
                plen = message[3] + (message[2] == 1 ? 96 : 0);
                ND_PRINT((ndo, "(%u hops) for %s seqno %u id %s",
                       message[6], format_prefix(ndo, prefix, plen),
                       seqno, format_id(message + 8)));
            }
        }
            break;
        case MESSAGE_TSPC :
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " tspc"));
            else {
                ND_PRINT((ndo, "\n\tTS/PC "));
                if(len < 6) goto corrupt;
                ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_32BITS (message + 4),
                       EXTRACT_16BITS(message + 2)));
            }
            break;
        case MESSAGE_HMAC : {
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " hmac"));
            else {
                unsigned j;
                ND_PRINT((ndo, "\n\tHMAC "));
                if(len < 18) goto corrupt;
                ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_16BITS(message + 2), len - 2));
                for (j = 0; j < len - 2; j++)
                    ND_PRINT((ndo, "%02X", message[4 + j]));
            }
        }
            break;

        case MESSAGE_UPDATE_SRC_SPECIFIC : {
            if(!ndo->ndo_vflag) {
                ND_PRINT((ndo, " ss-update"));
            } else {
                u_char prefix[16], src_prefix[16];
                u_short interval, seqno, metric;
                u_char ae, plen, src_plen, omitted;
                int rc;
                int parsed_len = 10;
                ND_PRINT((ndo, "\n\tSS-Update"));
                if(len < 10) goto corrupt;
                ae = message[2];
                src_plen = message[3];
                plen = message[4];
                omitted = message[5];
                interval = EXTRACT_16BITS(message + 6);
                seqno = EXTRACT_16BITS(message + 8);
                metric = EXTRACT_16BITS(message + 10);
                rc = network_prefix(ae, plen, omitted, message + 2 + parsed_len,
                                    ae == 1 ? v4_prefix : v6_prefix,
                                    len - parsed_len, prefix);
                if(rc < 0) goto corrupt;
                if(ae == 1)
                    plen += 96;
                parsed_len += rc;
                rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len,
                                    NULL, len - parsed_len, src_prefix);
                if(rc < 0) goto corrupt;
                if(ae == 1)
                    src_plen += 96;
                parsed_len += rc;

                ND_PRINT((ndo, " %s from", format_prefix(ndo, prefix, plen)));
                ND_PRINT((ndo, " %s metric %u seqno %u interval %s",
                          format_prefix(ndo, src_prefix, src_plen),
                          metric, seqno, format_interval_update(interval)));
                /* extra data? */
                if((u_int)parsed_len < len)
                    subtlvs_print(ndo, message + 2 + parsed_len,
                                  message + 2 + len, type);
            }
        }
            break;

        case MESSAGE_REQUEST_SRC_SPECIFIC : {
            if(!ndo->ndo_vflag)
                ND_PRINT((ndo, " ss-request"));
            else {
                int rc, parsed_len = 3;
                u_char ae, plen, src_plen, prefix[16], src_prefix[16];
                ND_PRINT((ndo, "\n\tSS-Request "));
                if(len < 3) goto corrupt;
                ae = message[2];
                plen = message[3];
                src_plen = message[4];
                rc = network_prefix(ae, plen, 0, message + 2 + parsed_len,
                                    NULL, len - parsed_len, prefix);
                if(rc < 0) goto corrupt;
                if(ae == 1)
                    plen += 96;
                parsed_len += rc;
                rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len,
                                    NULL, len - parsed_len, src_prefix);
                if(rc < 0) goto corrupt;
                if(ae == 1)
                    src_plen += 96;
                parsed_len += rc;
                if(ae == 0) {
                    ND_PRINT((ndo, "for any"));
                } else {
                    ND_PRINT((ndo, "for (%s, ", format_prefix(ndo, prefix, plen)));
                    ND_PRINT((ndo, "%s)", format_prefix(ndo, src_prefix, src_plen)));
                }
            }
        }
            break;

        case MESSAGE_MH_REQUEST_SRC_SPECIFIC : {
            if(!ndo->ndo_vflag)
                ND_PRINT((ndo, " ss-mh-request"));
            else {
                int rc, parsed_len = 14;
                u_short seqno;
                u_char ae, plen, src_plen, prefix[16], src_prefix[16], hopc;
                const u_char *router_id = NULL;
                ND_PRINT((ndo, "\n\tSS-MH-Request "));
                if(len < 14) goto corrupt;
                ae = message[2];
                plen = message[3];
                seqno = EXTRACT_16BITS(message + 4);
                hopc = message[6];
                src_plen = message[7];
                router_id = message + 8;
                rc = network_prefix(ae, plen, 0, message + 2 + parsed_len,
                                    NULL, len - parsed_len, prefix);
                if(rc < 0) goto corrupt;
                if(ae == 1)
                    plen += 96;
                parsed_len += rc;
                rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len,
                                    NULL, len - parsed_len, src_prefix);
                if(rc < 0) goto corrupt;
                if(ae == 1)
                    src_plen += 96;
                ND_PRINT((ndo, "(%u hops) for (%s, ",
                          hopc, format_prefix(ndo, prefix, plen)));
                ND_PRINT((ndo, "%s) seqno %u id %s",
                          format_prefix(ndo, src_prefix, src_plen),
                          seqno, format_id(router_id)));
            }
        }
            break;

        default:
            if (!ndo->ndo_vflag)
                ND_PRINT((ndo, " unknown"));
            else
                ND_PRINT((ndo, "\n\tUnknown message type %d", type));
        }
        i += len + 2;
    }
    return;

 trunc:
    ND_PRINT((ndo, " %s", tstr));
    return;

 corrupt:
    ND_PRINT((ndo, " (corrupt)"));
    return;
}