tyir <tyir at users dot sourceforge dot net>
MPD features patch 1319461
+Vivenzio Pagliari <vivenzio@web.de>
+ Some useful patches for port monitoring
+
Walt Nelson <wnelsonjr at comcast dot net>
$freq fix
# $Id$
+2006-03-30
+ * Added patch to support new port monitor REMOTESERVICE peekable.
+
2006-03-29
* Scan port numbers as short. Fixes debian bug# 359974.
item=REMOTEHOST;
else if ( strncmp(itembuf,"rport",31) == 0 )
item=REMOTEPORT;
+ else if ( strncmp(itembuf,"rservice",31) == 0 )
+ item=REMOTESERVICE;
else if ( strncmp(itembuf,"lip",31) == 0 )
item=LOCALIP;
else if ( strncmp(itembuf,"lhost",31) == 0 )
snprintf( p_buffer, buffer_size, "%d", p_monitor->p_peek[ connection_index ]->remote_port );
break;
-
+
+ case REMOTESERVICE:
+
+ p_servent = getservbyport( htons(p_monitor->p_peek[ connection_index ]->remote_port ), "tcp" );
+ /* if no service name found for the port, just use the port number. */
+ if ( !p_servent || !p_servent->s_name ) {
+ snprintf( p_buffer, buffer_size, "%d", p_monitor->p_peek[ connection_index ]->remote_port );
+ } else {
+ snprintf( p_buffer, buffer_size, "%s", p_servent->s_name );
+ }
+ break;
+
case LOCALIP:
net.s_addr = p_monitor->p_peek[ connection_index ]->local_addr;
* ------------------------------------------------------------------- */
/* The inventory of peekable items within the port monitor. */
-enum tcp_port_monitor_peekables { COUNT=0, REMOTEIP, REMOTEHOST, REMOTEPORT, LOCALIP, LOCALHOST, LOCALPORT, LOCALSERVICE };
+enum tcp_port_monitor_peekables { COUNT=0, REMOTEIP, REMOTEHOST, REMOTEPORT, REMOTESERVICE, LOCALIP, LOCALHOST, LOCALPORT, LOCALSERVICE };
/* ------------------------------------------------------------------------
* A single tcp connection