static void childproc_cb(pid_t pid, int status, void *data) { struct procdata *pd = data; myuser_t *mu; const char *domain; return_if_fail(proccount > 0); proccount--; if (!WIFEXITED(status)) return; mu = myuser_find(pd->name); if (mu == NULL || strcmp(pd->email, mu->email)) return; domain = strchr(pd->email, '@'); if (domain == NULL) return; domain++; if (WEXITSTATUS(status) == 1) { snoop("REGISTER: mxcheck: no A/MX records for %s - " "REGISTER failed", domain); myuser_notice(nicksvs.nick, mu, "Sorry, \2%s\2 does not exist, " "I can't send mail there. Please check and try again.", domain); object_unref(mu); } else if (WEXITSTATUS(status) == 0) { snoop("REGISTER: mxcheck: valid MX records for %s", domain); } }
int main(object me, string arg) { object ob; if( !arg ) { if( objectp(ob = query_snooping(me)) ) write("你现在正在监听" + ob->query("name") + "所收到的讯息。\n"); return 1; } else if( arg=="none" ) { snoop(me); write("Ok.\n"); return 1; } ob = find_player(arg); if(!ob) ob = find_living(arg); if(!ob || !me->visible(ob)) return notify_fail("没有这个人。\n"); if( me==ob ) return notify_fail("请用 snoop none 解除监听。\n"); snoop(me, ob); write("你现在开始窃听" + ob->name(1) + "所收到的讯息。\n"); if( userp(ob) ) log_file("SNOOP_PLAYER", sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1), ctime(time()) ) ); return 1; }
static void os_cmd_restart(char *origin) { snoop("UPDATE: \2%s\2", origin); wallops("Updating database by request of \2%s\2.", origin); expire_check(NULL); db_save(NULL); logcommand(opersvs.me, user_find_named(origin), CMDLOG_ADMIN, "RESTART"); snoop("RESTART: \2%s\2", origin); wallops("Restarting by request of \2%s\2.", origin); runflags |= RF_RESTART; }
int main(object me, string arg) { object ob, ob1; if( !arg ) { if( objectp(ob = query_snooping(me)) ) write("─у╧╓╘┌╒¤╘┌╝р╠¤" + ob->query("name") + "╦∙╩╒╡╜╡─╤╢╧вбг\n"); else write("─у╧╓╘┌▓╗╘┌╝р╠¤╚╬║╬╨┼╧вбг\n"); return 1; } else if( arg=="none" ) { if( objectp(ob = query_snooping(me)) && wiz_level(ob) >= wiz_level(me) ) tell_object(ob, HIW + me->name(1) + "═г╓╣╝р╠¤─у╦∙╩╒╡╜╡─╤╢╧вбг\n" NOR); snoop(me); if (objectp(ob)) write("─у╧╓╘┌═г╓╣╝р╠¤" + ob->query("name") + "╦∙╩╒╡╜╡─╤╢╧вбг\n"); else write("─у╧╓╘┌▓╗╘┌╝р╠¤╚╬║╬╨┼╧вбг\n"); return 1; } ob = find_player(arg); if(!ob) ob = find_living(arg); if(!ob || !me->visible(ob)) return notify_fail("├╗╙╨╒т╕Ў╚╦бг\n"); if( wizhood(me) != "(admin)" && wiz_level(me) <= wiz_level(ob) ) return notify_fail("─у├╗╙╨╝р╠¤" + ob->name() + "╦∙╩╒╠¤╤╢╧в╡─╚и└√бг\n"); if( me==ob ) return notify_fail("╟ы╙├ snoop none ╜т│¤╝р╠¤бг\n"); if (objectp(ob1=query_snoop(ob))) return notify_fail(ob1->name()+"╒¤╘┌╝р╠¤"+ob->name()+"╡─╨┼╧вбг\n"); if (ob->query_temp("netdead",1)) return notify_fail("┤╦╚╦╒¤┤ж╘┌╢╧╧▀╫┤╠мбг\n"); if (!userp(ob)) return notify_fail("├╗╖и╟╘╠¤NPC╨┼╧в╡─бг\n"); snoop(me, ob); write("─у╧╓╘┌┐к╩╝╟╘╠¤" + ob->name(1) + "╦∙╩╒╡╜╡─╤╢╧вбг\n"); if( userp(ob) ) log_file("SNOOP_PLAYER", sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1), ctime(time()) ) ); if( wizardp(ob) && wizhood(me) != "(admin)") tell_object(ob, HIW + me->name(1) + "┐к╩╝╝р╠¤─у╦∙╩╒╡╜╡─╤╢╧вбг\n" + NOR); return 1; }
int main(object me, string arg) { object ob; if( !arg ) { if( objectp(ob = query_snooping(me)) ) write("你现在正在监听" + ob->query("name") + "所收到的讯息。\n"); return 1; } else if( arg=="-none" ) { if( objectp(ob = query_snooping(me)) && wizardp(ob) ) tell_object(ob, HIW + me->name(1) + "停止监听你所收到的讯息。\n" NOR); snoop(me); write("Ok.\n"); return 1; } else if(query_snooping(me)) snoop(me); ob = find_player(arg); if(!ob) ob = find_living(arg); if(!ob) ob = LOGIN_D->find_body(arg); /* added by mon. 2/23/97 */ if(!ob || !me->visible(ob)) return notify_fail("没有这个人。\n"); if( wizhood(me) != "(admin)" && wiz_level(me) <= wiz_level(ob) ) return notify_fail("你没有监听" + ob->name() + "所收听讯息的权利。\n"); if( me==ob ) return notify_fail("请用 snoop -none 解除监听。\n"); snoop(me, ob); me->set_temp("snoop_encoding", (int)me->query_encoding()*10+ob->query_encoding()); // added by mon 6/1/98 write("你现在开始窃听" + ob->name(1) + "所收到的讯息。\n"); if( userp(ob) ) log_file("SNOOP_PLAYER", sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1), ctime(time()) ) ); // if( wizardp(ob) && wizhood(me) != "(admin)") if( wizardp(ob)) tell_object(ob, HIW + me->name(1) + "开始监听你所收到的讯息。\n" + NOR); return 1; }
int main(object me, string arg) { object ob; me=this_player(); seteuid(geteuid(me)); if( !arg ) { if( objectp(ob = query_snooping(me)) ) write("你现在正在监听" + ob->query("name") + "所收到的讯息。\n"); return 1; } else if( arg=="none" ) { if( objectp(ob = query_snooping(me))) message_vision (HIW + "$N停止监听$n所收到的讯息。\n"+ NOR,me,ob); snoop(me,); write("Ok.\n"); return 1; } ob = find_player(arg); if (!ob) ob = find_player(arg); if(!ob || (!ob->visible(ob))) return notify_fail("没有这个人。\n"); if (!interactive(ob)) return notify_fail("不能监听断线中的使用者所收到的讯息。\n"); if(wizhood(ob)=="(admin)"||wizhood(ob)=="(manager)") return notify_fail("你不能窃听大神。\n"); if( me==ob ) return notify_fail("请用 snoop none 解除监听。\n"); snoop(me, ob); if( userp(ob) ) log_file("SNOOP_PLAYER", sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1), ctime(time()) ) ); write (HIW"你开始监听"+ob->name()+"所收到的讯息。\n" + NOR); tell_object(ob, HIW + me->name(1) + "开始监听你所收到的讯息。\n" + NOR); return 1; }
void operserv(const char *source, char *buf) { char *cmd; char *s; User *u; u = finduser(source); if (!u) { log("%s: user record for %s not found", s_OperServ, source); notice(s_OperServ, source, getstring(0, USER_RECORD_NOT_FOUND)); return; } log("%s: %s: %s", s_OperServ, source, buf); snoop(s_OperServ, "[OS] %s (%s@%s): %s", u->nick, u->username, u->host, buf); cmd = strtok(buf, " "); if (!cmd) { return; } else if (stricmp(cmd, "\1PING") == 0) { if (!(s = strtok(NULL, ""))) s = "\1"; notice(s_OperServ, source, "\1PING %s", s); } else if (stricmp(cmd, "\1VERSION\1") == 0) { notice(s_OperServ, source, "\1VERSION Blitzed-Based OFTC IRC Services v%s\1", VERSION); } else { run_cmd(s_OperServ, u, cmds, cmd); } }
/* i'm putting usermode in here too */ void user_mode(user_t *user, char *modes) { boolean_t toadd = FALSE; if (!user) { slog(LG_DEBUG, "user_mode(): called for nonexistant user"); return; } while (*modes != '\0') { switch (*modes) { case '+': toadd = TRUE; break; case '-': toadd = FALSE; break; case 'o': if (toadd) { if (!is_ircop(user)) { user->flags |= UF_IRCOP; slog(LG_DEBUG, "user_mode(): %s is now an IRCop", user->nick); snoop("OPER: %s (%s)", user->nick, user->server->name); } } else { if (is_ircop(user)) { user->flags &= ~UF_IRCOP; slog(LG_DEBUG, "user_mode(): %s is no longer an IRCop", user->nick); snoop("DEOPER: %s (%s)", user->nick, user->server->name); } } default: break; } modes++; } }
static void cs_cmd_drop(char *origin) { user_t *u = user_find_named(origin); mychan_t *mc; char *name = strtok(NULL, " "); if (!name) { notice(chansvs.nick, origin, STR_INSUFFICIENT_PARAMS, "DROP"); notice(chansvs.nick, origin, "Syntax: DROP <#channel>"); return; } if (*name != '#') { notice(chansvs.nick, origin, STR_INVALID_PARAMS, "DROP"); notice(chansvs.nick, origin, "Syntax: DROP <#channel>"); return; } if (!(mc = mychan_find(name))) { notice(chansvs.nick, origin, "\2%s\2 is not registered.", name); return; } if (!is_founder(mc, u->myuser) && !has_priv(u, PRIV_CHAN_ADMIN)) { notice(chansvs.nick, origin, "You are not authorized to perform this operation."); return; } if (metadata_find(mc, METADATA_CHANNEL, "private:close:closer") && !has_priv(u, PRIV_CHAN_ADMIN)) { logcommand(chansvs.me, u, CMDLOG_REGISTER, "%s failed DROP (closed)", mc->name); notice(chansvs.nick, origin, "The channel \2%s\2 is closed; it cannot be dropped.", mc->name); return; } if (!is_founder(mc, u->myuser)) { logcommand(chansvs.me, u, CMDLOG_ADMIN, "%s DROP", mc->name); wallops("%s dropped the channel \2%s\2", origin, name); } else logcommand(chansvs.me, u, CMDLOG_REGISTER, "%s DROP", mc->name); snoop("DROP: \2%s\2 by \2%s\2 as \2%s\2", mc->name, u->nick, u->myuser->name); hook_call_event("channel_drop", mc); if ((config_options.chan && irccasecmp(mc->name, config_options.chan)) || !config_options.chan) part(mc->name, chansvs.nick); mychan_delete(mc->name); notice(chansvs.nick, origin, "The channel \2%s\2 has been dropped.", name); return; }
void os_cmd_update(sourceinfo_t *si, int parc, char *parv[]) { snoop("UPDATE: \2%s\2", get_oper_name(si)); logcommand(si, CMDLOG_ADMIN, "UPDATE"); wallops("Updating database by request of \2%s\2.", get_oper_name(si)); expire_check(NULL); if (db_save) db_save(NULL); /* db_save() will wallops/snoop/log the error */ command_success_nodata(si, _("UPDATE completed.")); }
static void check_registration(hook_user_register_check_t *hdata) { char buf[1024]; const char *user; const char *domain; int count; if (hdata->approved) return; strlcpy(buf, hdata->email, sizeof buf); user = strtok(buf, "@"); domain = strtok(NULL, "@"); count = count_mx(domain); if (count > 0) { /* there are MX records for this domain */ snoop("REGISTER: mxcheck: %d MX records for %s", count, domain); } else { /* no MX records or error */ struct hostent *host; /* attempt to resolve host (fallback to A) */ if((host = gethostbyname(domain)) == NULL) { snoop("REGISTER: mxcheck: no A/MX records for %s - " "REGISTER failed", domain); command_fail(hdata->si, fault_noprivs, "Sorry, \2%s\2 does not exist, " "I can't send mail there. Please check and try again.", domain); hdata->approved = 1; return; } } }
int main(object me, string arg) { object ob; if( !arg ) { if( objectp(ob = query_snooping(me)) ) write("你现在正在监听" + ob->query("name") + "所收到的讯息。\n"); return 1; } else if( arg=="none" ) { if( objectp(ob = query_snooping(me)) && wiz_level(ob) >= wiz_level(me) ) tell_object(ob, HIW + me->name(1) + "停止监听你所收到的讯息。\n" NOR); snoop(me); write("Ok.\n"); return 1; } ob = find_player(arg); if(!ob) ob = find_living(arg); if(!ob || !me->visible(ob)) return notify_fail("没有这个人。\n"); if( wizhood(me) != "(admin)" && wiz_level(me) <= wiz_level(ob) ) return notify_fail("你没有监听" + ob->name() + "所收听讯息的权利。\n"); if( me==ob ) return notify_fail("请用 snoop none 解除监听。\n"); snoop(me, ob); write("你现在开始窃听" + ob->name(1) + "所收到的讯息。\n"); if( userp(ob) ) log_file("SNOOP_PLAYER", sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1), ctime(time()) ) ); if( wizardp(ob) && wizhood(me) != "(admin)") tell_object(ob, HIW + me->name(1) + "开始监听你所收到的讯息。\n" + NOR); return 1; }
static void ns_cmd_fdrop(sourceinfo_t *si, int parc, char *parv[]) { myuser_t *mu; mynick_t *mn; char *acc = parv[0]; if (!acc) { command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "FDROP"); command_fail(si, fault_needmoreparams, _("Syntax: FDROP <account>")); return; } if (!(mu = myuser_find(acc))) { if (!nicksvs.no_nick_ownership) { mn = mynick_find(acc); if (mn != NULL && command_find(si->service->cmdtree, "FUNGROUP")) { command_fail(si, fault_nosuch_target, _("\2%s\2 is a grouped nick, use %s to remove it."), acc, "FUNGROUP"); return; } } command_fail(si, fault_nosuch_target, _("\2%s\2 is not registered."), acc); return; } if (is_soper(mu)) { command_fail(si, fault_noprivs, _("The nickname \2%s\2 belongs to a services operator; it cannot be dropped."), acc); return; } if (mu->flags & MU_HOLD) { command_fail(si, fault_noprivs, _("The account \2%s\2 is held; it cannot be dropped."), acc); return; } wallops("%s dropped the account \2%s\2", get_oper_name(si), mu->name); snoop("FDROP: \2%s\2 by \2%s\2", mu->name, get_oper_name(si)); logcommand(si, CMDLOG_ADMIN | LG_REGISTER, "FDROP %s", mu->name); hook_call_user_drop(mu); command_success_nodata(si, _("The account \2%s\2 has been dropped."), mu->name); object_unref(mu); }
void snoop(Display *dpy, Window win) { Window parent, root, *kids = NULL; XSetWindowAttributes sattrs; unsigned int nkids = 0, i; /* firefox stops responding to keys when KeyPressMask is used, so * settle for KeyReleaseMask */ int type = PointerMotionMask | KeyReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask | ButtonMotionMask; if (XQueryTree(dpy, win, &root, &parent, &kids, &nkids) == FALSE) { warn("can't query window tree\n"); goto done; } if (!nkids) goto done; XSelectInput(dpy, root, type); /* listen for newly mapped windows */ sattrs.event_mask = SubstructureNotifyMask; XChangeWindowAttributes(dpy, root, CWEventMask, &sattrs); for (i = 0; i < nkids; i++) { XSelectInput(dpy, kids[i], type); snoop(dpy, kids[i]); } done: if (kids != NULL) XFree(kids); /* hide yo kids */ }
static void ns_cmd_drop(sourceinfo_t *si, int parc, char *parv[]) { myuser_t *mu; mynick_t *mn; char *acc = parv[0]; char *pass = parv[1]; if (!acc || !pass) { command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "DROP"); command_fail(si, fault_needmoreparams, _("Syntax: DROP <account> <password>")); return; } if (!(mu = myuser_find(acc))) { if (!nicksvs.no_nick_ownership) { mn = mynick_find(acc); if (mn != NULL && command_find(si->service->cmdtree, "UNGROUP")) { command_fail(si, fault_nosuch_target, _("\2%s\2 is a grouped nick, use %s to remove it."), acc, "UNGROUP"); return; } } command_fail(si, fault_nosuch_target, _("\2%s\2 is not registered."), acc); return; } if (metadata_find(mu, "private:freeze:freezer")) { command_fail(si, fault_authfail, nicksvs.no_nick_ownership ? "You cannot login as \2%s\2 because the account has been frozen." : "You cannot identify to \2%s\2 because the nickname has been frozen.", mu->name); return; } if (!verify_password(mu, pass)) { command_fail(si, fault_authfail, _("Authentication failed. Invalid password for \2%s\2."), mu->name); bad_password(si, mu); return; } if (!nicksvs.no_nick_ownership && LIST_LENGTH(&mu->nicks) > 1 && command_find(si->service->cmdtree, "UNGROUP")) { command_fail(si, fault_noprivs, _("Account \2%s\2 has %d other nick(s) grouped to it, remove those first."), mu->name, LIST_LENGTH(&mu->nicks) - 1); return; } if (is_soper(mu)) { command_fail(si, fault_noprivs, _("The nickname \2%s\2 belongs to a services operator; it cannot be dropped."), acc); return; } if (mu->flags & MU_HOLD) { command_fail(si, fault_noprivs, _("The account \2%s\2 is held; it cannot be dropped."), acc); return; } snoop("DROP: \2%s\2 by \2%s\2", mu->name, get_source_name(si)); command_add_flood(si, FLOOD_MODERATE); logcommand(si, CMDLOG_REGISTER, "DROP %s", mu->name); hook_call_user_drop(mu); command_success_nodata(si, _("The account \2%s\2 has been dropped."), mu->name); object_unref(mu); }
/* FFLAGS <channel> <user> <flags> */ static void cs_cmd_fflags(sourceinfo_t *si, int parc, char *parv[]) { char *channel = parv[0]; char *target = parv[1]; char *flagstr = parv[2]; mychan_t *mc; myuser_t *tmu; unsigned int addflags, removeflags; if (parc < 3) { command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "FFLAGS"); command_fail(si, fault_needmoreparams, _("Syntax: FFLAGS <channel> <target> <flags>")); return; } mc = mychan_find(channel); if (!mc) { command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), channel); return; } if (*flagstr == '+' || *flagstr == '-' || *flagstr == '=') { flags_make_bitmasks(flagstr, chanacs_flags, &addflags, &removeflags); if (addflags == 0 && removeflags == 0) { command_fail(si, fault_badparams, _("No valid flags given, use /%s%s HELP FLAGS for a list"), ircd->uses_rcommand ? "" : "msg ", chansvs.me->disp); return; } } else { addflags = get_template_flags(mc, flagstr); if (addflags == 0) { /* Hack -- jilles */ if (*target == '+' || *target == '-' || *target == '=') command_fail(si, fault_badparams, _("Usage: FFLAGS %s <target> <flags>"), mc->name); else command_fail(si, fault_badparams, _("Invalid template name given, use /%s%s TEMPLATE %s for a list"), ircd->uses_rcommand ? "" : "msg ", chansvs.me->disp, mc->name); return; } removeflags = ca_all & ~addflags; } if (!validhostmask(target)) { if (!(tmu = myuser_find_ext(target))) { command_fail(si, fault_nosuch_target, _("\2%s\2 is not registered."), target); return; } target = tmu->name; /* XXX this should be more like flags.c */ if (removeflags & CA_FLAGS) removeflags |= CA_FOUNDER, addflags &= ~CA_FOUNDER; else if (addflags & CA_FOUNDER) addflags |= CA_FLAGS, removeflags &= ~CA_FLAGS; if (is_founder(mc, tmu) && removeflags & CA_FOUNDER && mychan_num_founders(mc) == 1) { command_fail(si, fault_noprivs, _("You may not remove the last founder.")); return; } if (!chanacs_change(mc, tmu, NULL, &addflags, &removeflags, ca_all)) { /* this shouldn't happen */ command_fail(si, fault_noprivs, _("You are not allowed to set \2%s\2 on \2%s\2 in \2%s\2."), bitmask_to_flags2(addflags, removeflags, chanacs_flags), tmu->name, mc->name); return; } } else { if (addflags & CA_FOUNDER) { command_fail(si, fault_badparams, _("You may not set founder status on a hostmask.")); return; } if (!chanacs_change(mc, NULL, target, &addflags, &removeflags, ca_all)) { /* this shouldn't happen */ command_fail(si, fault_noprivs, _("You are not allowed to set \2%s\2 on \2%s\2 in \2%s\2."), bitmask_to_flags2(addflags, removeflags, chanacs_flags), target, mc->name); return; } } if ((addflags | removeflags) == 0) { command_fail(si, fault_nochange, _("Channel access to \2%s\2 for \2%s\2 unchanged."), channel, target); return; } flagstr = bitmask_to_flags2(addflags, removeflags, chanacs_flags); wallops("\2%s\2 is forcing flags change \2%s\2 on \2%s\2 in \2%s\2.", get_oper_name(si), flagstr, target, mc->name); snoop("FFLAGS: \2%s\2 \2%s\2 \2%s\2 by \2%s\2", channel, target, flagstr, get_oper_name(si)); command_success_nodata(si, _("Flags \2%s\2 were set on \2%s\2 in \2%s\2."), flagstr, target, channel); logcommand(si, CMDLOG_ADMIN, "%s FFLAGS %s %s", mc->name, target, flagstr); verbose(mc, "\2%s\2 forced flags change \2%s\2 on \2%s\2.", get_source_name(si), flagstr, target); }
int main(int argc, char *argv[]) { Display *dpy; int hiding = 0, ch; XEvent e; while ((ch = getopt(argc, argv, "d")) != -1) switch (ch) { case 'd': debug = 1; break; default: usage(); } argc -= optind; argv += optind; if (!(dpy = XOpenDisplay(NULL))) errx(1, "can't open display %s", XDisplayName(NULL)); XSetErrorHandler(swallow_error); /* recurse from root window down */ snoop(dpy, DefaultRootWindow(dpy)); for (;;) { XNextEvent(dpy, &e); switch (e.type) { case KeyRelease: if (debug) printf("keystroke %d, %shiding cursor\n", e.xkey.keycode, (hiding ? "already " : "")); if (!hiding) { XFixesHideCursor(dpy, DefaultRootWindow(dpy)); hiding = 1; } break; case ButtonRelease: case MotionNotify: if (debug) printf("mouse moved to %d,%d, %sunhiding " "cursor\n", e.xmotion.x_root, e.xmotion.y_root, (hiding ? "" : "already ")); if (hiding) { XFixesShowCursor(dpy, DefaultRootWindow(dpy)); hiding = 0; } break; case CreateNotify: if (debug) printf("created new window, snooping on it\n"); /* not sure why snooping directly on the window doesn't * work, so snoop on all windows from its parent * (probably root) */ snoop(dpy, e.xcreatewindow.parent); break; } } }
status_t BnMediaPlayerService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case CREATE_URL: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); sp<IMediaPlayerClient> client = interface_cast<IMediaPlayerClient>(data.readStrongBinder()); const char* url = data.readCString(); KeyedVector<String8, String8> headers; int32_t numHeaders = data.readInt32(); for (int i = 0; i < numHeaders; ++i) { String8 key = data.readString8(); String8 value = data.readString8(); headers.add(key, value); } sp<IMediaPlayer> player = create( pid, client, url, numHeaders > 0 ? &headers : NULL); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; case CREATE_FD: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); sp<IMediaPlayerClient> client = interface_cast<IMediaPlayerClient>(data.readStrongBinder()); int fd = dup(data.readFileDescriptor()); int64_t offset = data.readInt64(); int64_t length = data.readInt64(); sp<IMediaPlayer> player = create(pid, client, fd, offset, length); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; case DECODE_URL: { CHECK_INTERFACE(IMediaPlayerService, data, reply); const char* url = data.readCString(); uint32_t sampleRate; int numChannels; int format; sp<IMemory> player = decode(url, &sampleRate, &numChannels, &format); reply->writeInt32(sampleRate); reply->writeInt32(numChannels); reply->writeInt32(format); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; case DECODE_FD: { CHECK_INTERFACE(IMediaPlayerService, data, reply); int fd = dup(data.readFileDescriptor()); int64_t offset = data.readInt64(); int64_t length = data.readInt64(); uint32_t sampleRate; int numChannels; int format; sp<IMemory> player = decode(fd, offset, length, &sampleRate, &numChannels, &format); reply->writeInt32(sampleRate); reply->writeInt32(numChannels); reply->writeInt32(format); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; case SNOOP: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp<IMemory> snooped_audio = snoop(); reply->writeStrongBinder(snooped_audio->asBinder()); return NO_ERROR; } break; case CREATE_MEDIA_RECORDER: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); sp<IMediaRecorder> recorder = createMediaRecorder(pid); reply->writeStrongBinder(recorder->asBinder()); return NO_ERROR; } break; case CREATE_METADATA_RETRIEVER: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); sp<IMediaMetadataRetriever> retriever = createMetadataRetriever(pid); reply->writeStrongBinder(retriever->asBinder()); return NO_ERROR; } break; case GET_OMX: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp<IOMX> omx = getOMX(); reply->writeStrongBinder(omx->asBinder()); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } }