Lines Matching refs:p
167 const char* p = trace_setting.c_str(); in adb_trace_init() local
168 while (*p) { in adb_trace_init()
171 const char* q = strpbrk(p, " ,:;"); in adb_trace_init()
173 q = p + strlen(p); in adb_trace_init()
175 len = q - p; in adb_trace_init()
180 if (len == taglen && !memcmp(tags[tagn].tag, p, len)) { in adb_trace_init()
190 p = q; in adb_trace_init()
191 if (*p) in adb_trace_init()
192 p++; in adb_trace_init()
202 apacket* p = reinterpret_cast<apacket*>(malloc(sizeof(apacket))); in get_apacket() local
203 if (p == nullptr) { in get_apacket()
207 memset(p, 0, sizeof(apacket) - MAX_PAYLOAD); in get_apacket()
208 return p; in get_apacket()
211 void put_apacket(apacket *p) in put_apacket() argument
213 free(p); in put_apacket()
232 void print_packet(const char *label, apacket *p) in print_packet() argument
238 switch(p->msg.command){ in print_packet()
250 label, tag, p->msg.arg0, p->msg.arg1, p->msg.data_length); in print_packet()
251 count = p->msg.data_length; in print_packet()
252 x = (char*) p->data; in print_packet()
274 apacket *p = get_apacket(); in send_ready() local
275 p->msg.command = A_OKAY; in send_ready()
276 p->msg.arg0 = local; in send_ready()
277 p->msg.arg1 = remote; in send_ready()
278 send_packet(p, t); in send_ready()
284 apacket *p = get_apacket(); in send_close() local
285 p->msg.command = A_CLSE; in send_close()
286 p->msg.arg0 = local; in send_close()
287 p->msg.arg1 = remote; in send_close()
288 send_packet(p, t); in send_close()
393 void handle_packet(apacket *p, atransport *t) in handle_packet() argument
397 D("handle_packet() %c%c%c%c\n", ((char*) (&(p->msg.command)))[0], in handle_packet()
398 ((char*) (&(p->msg.command)))[1], in handle_packet()
399 ((char*) (&(p->msg.command)))[2], in handle_packet()
400 ((char*) (&(p->msg.command)))[3]); in handle_packet()
401 print_packet("recv", p); in handle_packet()
403 switch(p->msg.command){ in handle_packet()
405 if(p->msg.arg0){ in handle_packet()
406 send_packet(p, t); in handle_packet()
411 send_packet(p, t); in handle_packet()
422 parse_banner(reinterpret_cast<const char*>(p->data), t); in handle_packet()
433 if (p->msg.arg0 == ADB_AUTH_TOKEN) { in handle_packet()
437 send_auth_response(p->data, p->msg.data_length, t); in handle_packet()
442 } else if (p->msg.arg0 == ADB_AUTH_SIGNATURE) { in handle_packet()
443 if (adb_auth_verify(t->token, p->data, p->msg.data_length)) { in handle_packet()
451 } else if (p->msg.arg0 == ADB_AUTH_RSAPUBLICKEY) { in handle_packet()
452 adb_auth_confirm_key(p->data, p->msg.data_length, t); in handle_packet()
457 if (t->online && p->msg.arg0 != 0 && p->msg.arg1 == 0) { in handle_packet()
458 char *name = (char*) p->data; in handle_packet()
459 name[p->msg.data_length > 0 ? p->msg.data_length - 1 : 0] = 0; in handle_packet()
462 send_close(0, p->msg.arg0, t); in handle_packet()
464 s->peer = create_remote_socket(p->msg.arg0, t); in handle_packet()
473 if (t->online && p->msg.arg0 != 0 && p->msg.arg1 != 0) { in handle_packet()
474 if((s = find_local_socket(p->msg.arg1, 0))) { in handle_packet()
477 s->peer = create_remote_socket(p->msg.arg0, t); in handle_packet()
480 } else if (s->peer->id == p->msg.arg0) { in handle_packet()
485 p->msg.arg0, p->msg.arg1, s->peer->id, p->msg.arg1, t->serial); in handle_packet()
492 if (t->online && p->msg.arg1 != 0) { in handle_packet()
493 if((s = find_local_socket(p->msg.arg1, p->msg.arg0))) { in handle_packet()
504 if (p->msg.arg0 == 0 && s->peer && s->peer->transport != t) { in handle_packet()
506 p->msg.arg1, t->serial, s->peer->transport->serial); in handle_packet()
515 if (t->online && p->msg.arg0 != 0 && p->msg.arg1 != 0) { in handle_packet()
516 if((s = find_local_socket(p->msg.arg1, p->msg.arg0))) { in handle_packet()
517 unsigned rid = p->msg.arg0; in handle_packet()
518 p->len = p->msg.data_length; in handle_packet()
520 if(s->enqueue(s, p) == 0) { in handle_packet()
530 printf("handle_packet: what is %08x?!\n", p->msg.command); in handle_packet()
533 put_apacket(p); in handle_packet()