コード例 #1
0
ファイル: wsp_session.c プロジェクト: gburiticato/kannel
static void handle_session_event(WSPMachine *sm, WAPEvent *current_event, 
WSP_PDU *pdu) {
	debug("wap.wsp", 0, "WSP: machine %p, state %s, event %s",
		(void *) sm,
		state_name(sm->state), 
		wap_event_name(current_event->type));

	#define STATE_NAME(name)
	#define ROW(state_name, event, condition, action, next_state) \
		{ \
			struct event *e; \
			e = &current_event->u.event; \
			if (sm->state == state_name && \
			   current_event->type == event && \
			   (condition)) { \
				action \
				sm->state = next_state; \
				debug("wap.wsp", 0, "WSP %ld: New state %s", \
					sm->session_id, #next_state); \
				goto end; \
			} \
		}
	#include "wsp_server_session_states.def"
	
	cant_handle_event(sm, current_event);

end:
	wap_event_destroy(current_event);

	if (sm->state == NULL_SESSION)
		machine_destroy(sm);
}
コード例 #2
0
ファイル: machmgr.c プロジェクト: 911csj/logswitch
static void machmgr_delete(int index) {
   int i;
   if (index < 0 || index >= machcount) return;

   machine_destroy(machs[index]);
   for (i = index; i < machcount - 1; i++) machs[i] = machs[i+1];
   machcount--;

   machmgr_selmach_validate();
}
コード例 #3
0
ファイル: machmgr.c プロジェクト: 911csj/logswitch
void machmgr_delete_tagged() {
   int i, j;

   i = 0; /* next position in the vector we will write to */
   j = 0; /* next position in the vector we will look at in search
           * of nontagged machines */
   while (j < machcount) {
      /* advance j to the next untagged machine; finish if no such thing.
       * Delete tagged machines on the way. */
      while (j < machcount && machs[j]->tag) machine_destroy(machs[j++]);

      if (j >= machcount) break;  /* no more machines */
      machs[i++] = machs[j++];
   }
   
   machcount = i;
   machmgr_selmach_validate();
}
コード例 #4
0
ファイル: machmgr.c プロジェクト: 911csj/logswitch
void machmgr_delete_all() {
   int i;
   for (i = 0; i < machcount; i++) machine_destroy(machs[i]);
   machcount = selmach = scrollpos = 0;
}