statistics: Introduce 'struct counter' instead of using unsigned long

This has the advantage that counters can be added all over the code
very easily, while having only one routine that stores all of the
current counter values to the database.  The counters are synced
every 60 seconds, providing relatively fine grained statistics
about the network usage as time passes by.
diff --git a/openbsc/src/paging.c b/openbsc/src/paging.c
index 538e0a8..820773a 100644
--- a/openbsc/src/paging.c
+++ b/openbsc/src/paging.c
@@ -212,7 +212,7 @@
 	cbfn = req->cbfn;
 	paging_remove_request(&req->bts->paging, req);
 
-	req->bts->network->stats.paging.expired++;
+	counter_inc(req->bts->network->stats.paging.expired);
 
 	dispatch_signal(SS_PAGING, S_PAGING_COMPLETED, &sig_data);
 	if (cbfn)
@@ -256,7 +256,7 @@
 	struct gsm_bts *bts = NULL;
 	int num_pages = 0;
 
-	network->stats.paging.attempted++;
+	counter_inc(network->stats.paging.attempted);
 
 	/* start paging subscriber on all BTS within Location Area */
 	do {
@@ -274,7 +274,7 @@
 	} while (1);
 
 	if (num_pages == 0)
-		network->stats.paging.detached++;
+		counter_inc(network->stats.paging.detached);
 
 	return num_pages;
 }