|
|
* | * |
* Copyright (C) 2005 Philip Kovacs kovacsp3@comcast.net | * Copyright (C) 2005 Philip Kovacs kovacsp3@comcast.net |
* | * |
* $Id: libtcp-portmon.c,v 1.13 2005/12/05 23:50:08 pkovacs Exp $ |
* $Id: libtcp-portmon.c,v 1.14 2006/02/13 05:22:25 pkovacs Exp $ |
* | * |
* This library is free software; you can redistribute it and/or | * This library is free software; you can redistribute it and/or |
* modify it under the terms of the GNU Lesser General Public | * modify it under the terms of the GNU Lesser General Public |
|
|
p_monitor1 = (tcp_port_monitor_t *)p_data1; | p_monitor1 = (tcp_port_monitor_t *)p_data1; |
p_monitor2 = (tcp_port_monitor_t *)p_data2; | p_monitor2 = (tcp_port_monitor_t *)p_data2; |
| |
return (p_monitor1->port_range_begin == p_monitor1->port_range_begin && |
return (p_monitor1->port_range_begin == p_monitor2->port_range_begin && |
p_monitor2->port_range_end == p_monitor2->port_range_end); |
p_monitor1->port_range_end == p_monitor2->port_range_end); |
} | } |
| |
/* --------------------------------------------------------------------------- | /* --------------------------------------------------------------------------- |
|
|
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); | current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
if (current_info->mpd.file == NULL) | if (current_info->mpd.file == NULL) |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); | current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
strncpy(current_info->mpd.name, "Unknown", |
*current_info->mpd.name=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.file=0; |
strncpy(current_info->mpd.file, "Unknown", |
*current_info->mpd.artist=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.album=0; |
strncpy(current_info->mpd.artist, "Unknown", |
*current_info->mpd.title=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.random=0; |
strncpy(current_info->mpd.album, "Unknown", |
*current_info->mpd.repeat=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.track=0; |
strncpy(current_info->mpd.title, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.random, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.repeat, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.track, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1); | strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1); |
current_info->mpd.bitrate = 0; | current_info->mpd.bitrate = 0; |
current_info->mpd.progress = 0; | current_info->mpd.progress = 0; |
|
|
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); | current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
if (current_info->mpd.file == NULL) | if (current_info->mpd.file == NULL) |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); | current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
strncpy(current_info->mpd.name, "Unknown", |
*current_info->mpd.name=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.file=0; |
strncpy(current_info->mpd.file, "Unknown", |
*current_info->mpd.artist=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.album=0; |
strncpy(current_info->mpd.artist, "Unknown", |
*current_info->mpd.title=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.random=0; |
strncpy(current_info->mpd.album, "Unknown", |
*current_info->mpd.repeat=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.track=0; |
strncpy(current_info->mpd.title, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.random, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.repeat, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.track, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1); | strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1); |
current_info->mpd.bitrate = 0; | current_info->mpd.bitrate = 0; |
current_info->mpd.progress = 0; | current_info->mpd.progress = 0; |
|
|
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); | current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
if (current_info->mpd.file == NULL) | if (current_info->mpd.file == NULL) |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); | current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
strncpy(current_info->mpd.name, "Unknown", |
*current_info->mpd.name=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.file=0; |
strncpy(current_info->mpd.file, "Unknown", |
*current_info->mpd.artist=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.album=0; |
strncpy(current_info->mpd.artist, "Unknown", |
*current_info->mpd.title=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.random=0; |
strncpy(current_info->mpd.album, "Unknown", |
*current_info->mpd.repeat=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.track=0; |
strncpy(current_info->mpd.title, "Unknown", |
strncpy(current_info->mpd.status, "Stopped", |
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.random, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.repeat, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.track, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.status, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); | TEXT_BUFFER_SIZE - 1); |
} | } |
if (status->state == MPD_STATUS_STATE_PAUSE) { | if (status->state == MPD_STATUS_STATE_PAUSE) { |
|
|
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); | current_info->mpd.name = malloc(TEXT_BUFFER_SIZE); |
if (current_info->mpd.file == NULL) | if (current_info->mpd.file == NULL) |
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); | current_info->mpd.file = malloc(TEXT_BUFFER_SIZE); |
strncpy(current_info->mpd.name, "Unknown", |
*current_info->mpd.name=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.file=0; |
strncpy(current_info->mpd.file, "Unknown", |
*current_info->mpd.artist=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.album=0; |
strncpy(current_info->mpd.artist, "Unknown", |
*current_info->mpd.title=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.random=0; |
strncpy(current_info->mpd.album, "Unknown", |
*current_info->mpd.repeat=0; |
TEXT_BUFFER_SIZE - 1); |
*current_info->mpd.track=0; |
strncpy(current_info->mpd.title, "Unknown", |
*current_info->mpd.status=0; |
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.random, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.repeat, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.track, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
strncpy(current_info->mpd.status, "Unknown", |
|
TEXT_BUFFER_SIZE - 1); |
|
} | } |
if (status->state == MPD_STATUS_STATE_PLAY || | if (status->state == MPD_STATUS_STATE_PLAY || |
status->state == MPD_STATUS_STATE_PAUSE) { | status->state == MPD_STATUS_STATE_PAUSE) { |
|
|
} else if (status->random == 1) { | } else if (status->random == 1) { |
strcpy(current_info->mpd.random, "On"); | strcpy(current_info->mpd.random, "On"); |
} else { | } else { |
strcpy(current_info->mpd.random, "Unknown"); |
*current_info->mpd.random=0; |
} | } |
if (status->repeat == 0) { | if (status->repeat == 0) { |
strcpy(current_info->mpd.repeat, "Off"); | strcpy(current_info->mpd.repeat, "Off"); |
} else if (status->repeat == 1) { | } else if (status->repeat == 1) { |
strcpy(current_info->mpd.repeat, "On"); | strcpy(current_info->mpd.repeat, "On"); |
} else { | } else { |
strcpy(current_info->mpd.repeat, "Unknown"); |
*current_info->mpd.repeat=0; |
} | } |
} | } |
| |
|
|
strncpy(current_info->mpd.artist, song->artist, | strncpy(current_info->mpd.artist, song->artist, |
TEXT_BUFFER_SIZE - 1); | TEXT_BUFFER_SIZE - 1); |
} else { | } else { |
strcpy(current_info->mpd.artist, "Unknown"); |
*current_info->mpd.artist=0; |
} | } |
if (song->album) { | if (song->album) { |
strncpy(current_info->mpd.album, song->album, | strncpy(current_info->mpd.album, song->album, |
TEXT_BUFFER_SIZE - 1); | TEXT_BUFFER_SIZE - 1); |
} else { | } else { |
strcpy(current_info->mpd.album, "Unknown"); |
*current_info->mpd.album=0; |
} | } |
if (song->title) { | if (song->title) { |
strncpy(current_info->mpd.title, song->title, | strncpy(current_info->mpd.title, song->title, |
TEXT_BUFFER_SIZE - 1); | TEXT_BUFFER_SIZE - 1); |
} else { | } else { |
strcpy(current_info->mpd.title, "Unknown"); |
*current_info->mpd.title=0; |
} | } |
if (song->track) { | if (song->track) { |
strncpy(current_info->mpd.track, song->track, | strncpy(current_info->mpd.track, song->track, |
TEXT_BUFFER_SIZE - 1); | TEXT_BUFFER_SIZE - 1); |
} else { | } else { |
strcpy(current_info->mpd.track, "Unknown"); |
*current_info->mpd.track=0; |
} | } |
if (song->name) { | if (song->name) { |
strncpy(current_info->mpd.name, song->name, | strncpy(current_info->mpd.name, song->name, |
TEXT_BUFFER_SIZE - 1); | TEXT_BUFFER_SIZE - 1); |
} else { | } else { |
strcpy(current_info->mpd.name, "Unknown"); |
*current_info->mpd.name=0; |
} | } |
if (song->file) { | if (song->file) { |
strncpy(current_info->mpd.file, | strncpy(current_info->mpd.file, |
song->file, TEXT_BUFFER_SIZE - 1); | song->file, TEXT_BUFFER_SIZE - 1); |
} else { | } else { |
strcpy(current_info->mpd.file, "Unknown"); |
*current_info->mpd.file=0; |
} | } |
if (entity != NULL) { | if (entity != NULL) { |
mpd_freeInfoEntity(entity); | mpd_freeInfoEntity(entity); |