summaryrefslogtreecommitdiff
path: root/libgphoto2_port/ptpip
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2008-03-15 21:45:48 +0000
committerMarcus Meissner <marcus@jet.franken.de>2008-03-15 21:45:48 +0000
commit3c26841fa08d4f7c82ea7b4004a954f6fe146f17 (patch)
tree77e49b5d592507d3aa7e03ef5117c4dcd5850e5e /libgphoto2_port/ptpip
parentf50fb2ec5e87a8538befd8909ae6243711d49baa (diff)
downloadlibgphoto2-3c26841fa08d4f7c82ea7b4004a954f6fe146f17.tar.gz
GPPortInfo struct abstracted into a private struct.
- libgphoto2_port rewritten for new GPPortInfo. - camlibs/directory and camlibs/ptp2 adjusted. - libgphoto2/ adjusted for the changed GPPortInfo list handling. - configure.ac adjusted, NEWS adjusted git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@10990 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port/ptpip')
-rw-r--r--libgphoto2_port/ptpip/ptpip.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/libgphoto2_port/ptpip/ptpip.c b/libgphoto2_port/ptpip/ptpip.c
index 28f6c421e..8597031f9 100644
--- a/libgphoto2_port/ptpip/ptpip.c
+++ b/libgphoto2_port/ptpip/ptpip.c
@@ -96,9 +96,10 @@ _ptpip_resolved (
) {
struct hostent* hent;
struct in_addr inaddr;
- GPPortInfo info;
+ GPPortInfo *info;
int i, cnt;
struct mdnsinfo *mdnsi = context;
+ char path[200];
if (errorCode != kDNSServiceErr_NoError) {
gp_log (GP_LOG_ERROR, "ptpip", "Error on 2nd level query.");
@@ -121,14 +122,11 @@ _ptpip_resolved (
return;
}
memcpy(&inaddr.s_addr,hent->h_addr_list[0],hent->h_length);
- info.type = GP_PORT_PTPIP;
- snprintf (info.name, sizeof(info.name), mdnsi->name);
- snprintf (info.path, sizeof(info.path), "ptpip:%s:%d", inet_ntoa(inaddr), htons(port));
- gp_port_info_list_append (mdnsi->list, info);
-
- /* regexp matcher */
- memset (info.name, 0, sizeof(info.name));
- snprintf (info.path, sizeof(info.path), "^ptpip:");
+ gp_port_info_new (&info);
+ gp_port_info_set_type (info, GP_PORT_PTPIP);
+ gp_port_info_set_name (info, mdnsi->name);
+ snprintf (path, sizeof(path), "ptpip:%s:%d", inet_ntoa(inaddr), htons(port));
+ gp_port_info_set_path (info, path);
gp_port_info_list_append (mdnsi->list, info);
}
@@ -175,14 +173,17 @@ gp_port_library_list (GPPortInfoList *list)
struct timeval tv;
#endif
- info.type = GP_PORT_PTPIP;
- snprintf (info.name, sizeof(info.name), _("PTP/IP Connection"));
- snprintf (info.path, sizeof(info.path), "ptpip:");
+ gp_port_info_new (&info);
+ gp_port_info_set_type (info, GP_PORT_PTPIP);
+ gp_port_info_set_name (info, _("PTP/IP Connection"));
+ gp_port_info_set_path (info, "ptpip:");
CHECK (gp_port_info_list_append (list, info));
/* Generic matcher so you can pass any IP address */
- memset (info.name, 0, sizeof(info.name));
- snprintf (info.path, sizeof(info.path), "^ptpip");
+ gp_port_info_new (&info);
+ gp_port_info_set_type (info, GP_PORT_PTPIP);
+ gp_port_info_set_name (info, "");
+ gp_port_info_set_path (info, "^ptpip:");
CHECK (gp_port_info_list_append (list, info));
#ifdef HAVE_MDNS_BONJOUR